From 886b276378ab7b38c72813ceb386a2ecd7fa196b Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sat, 28 Feb 2009 16:06:42 -0500 Subject: [PATCH] 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. --- framework/Http_Client/lib/Horde/Http/Client.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) 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) { -- 2.11.0