From: Michael J. Rubinsky Date: Sat, 28 Feb 2009 21:06:42 +0000 (-0500) Subject: Check for proxy configuration first, so we don't lose the Proxy-Authorization X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=886b276378ab7b38c72813ceb386a2ecd7fa196b;p=horde.git Check for proxy configuration first, so we don't lose the Proxy-Authorization header. Need to concatenate the header name with the value before we perform the implode function on the array or we lose the header names. --- diff --git a/framework/Http_Client/lib/Horde/Http/Client.php b/framework/Http_Client/lib/Horde/Http/Client.php index 64ca8fffe..0ed43653a 100644 --- a/framework/Http_Client/lib/Horde/Http/Client.php +++ b/framework/Http_Client/lib/Horde/Http/Client.php @@ -209,15 +209,8 @@ class Horde_Http_Client 'data' => $data, ); - // Stream context config. - $opts = array('http' => array( - 'method' => $method, - 'header' => implode("\n", $headers), - 'content' => $data, - 'timeout' => $this->_timeout, - )); - - // Proxy settings + $opts = array('http' => array()); + // Proxy settings - check first, so we can include the correct headers if ($this->proxyServer) { $opts['http']['proxy'] = 'tcp://' . $this->proxyServer; $opts['http']['request_fulluri'] = true; @@ -226,6 +219,18 @@ class Horde_Http_Client } } + // Concantenate the headers + $hdr = array(); + foreach ($headers as $header => $value) { + $hdr[] = $header . ': ' . $value; + } + + // Stream context config. + $opts['http']['method'] = $method; + $opts['http']['header'] = implode("\n", $hdr); + $opts['http']['content'] = $data; + $opts['http']['timeout'] = $this->_timeout; + $context = stream_context_create($opts); $stream = @fopen($uri, 'rb', false, $context); if (!$stream) {