ZF-4259: zend http client with proxy

Issue Type: Bug Created: 2008-09-12T00:20:25.000+0000 Last Updated: 2009-11-17T22:51:12.000+0000 Status: Resolved Fix version(s): - 1.9.0 (31/Jul/09)

Reporter: John Hopper ( Assignee: Shahar Evron (shahar) Tags: - Zend_Http_Client

Related issues: Attachments:


not working when rediretion occurs on server. (will add more info later). same address works when Fireox or Explorer is used with proxy

i made it works by changing 'write' method in Proxy.php:

<pre class="highlight">
    $request = "{$method} {$uri->getPath()} HTTP/{$http_ver}\r\n";
    $request = "{$method} {$uri->__toString()} HTTP/{$http_ver}\r\n";



HTTP/1.0 200 Connection established



Posted by Shahar Evron (shahar) on 2008-10-21T15:03:43.000+0000

Hi -

Can you provide a more clear scenario?

I see you have HTTPS - does it also happen when you use regular HTTP proxy and not HTTPS ?

Where does the redirection happen? On the proxy server or on the remote server? What is the redirection code?


Posted by John Hopper ( on 2008-12-09T03:29:34.000+0000

sorry for the delay.

code + tcp dump follows:


$config = array(

    'adapter'       => 'Zend_Http_Client_Adapter_Proxy',
    'timeout'       => '15',
    //'ssltransport'    => 'ssl',
    'useragent'     => '',
    'proxy_host'    => '',
    'proxy_port'    => '3128',
    'proxy_user'    => '',
    'proxy_pass'    => ''

$uri = "https://<a rel="nofollow" href=""></a>";

        $client = new Zend_Http_Client($uri, $config);
        $response = $client->request();
        $body = $response->getBody();
        file_put_contents('proxyssl.dump', $body);
    catch (Exception $ex){
        echo $ex->getMessage();

CONNECT HTTP/1.1. Host: User-agent:

HTTP/1.0 200 Connection established.

CONNECT sourceforge.nethttps:443 HTTP/1.1. Host: User-agent:

Posted by John Hopper ( on 2008-12-09T03:39:29.000+0000

redirection for http works fine. tested using proxy and the same host ( )

Posted by Shahar Evron (shahar) on 2009-07-23T16:15:01.000+0000

Sorry for delaying with this - I almost used your patch to fix this. Please test with trunk after CS-17014. BTW this looks like some odd behavior of the servers because plain Apache works fine (I've been testing this for some time now).

Actually the servers send a pretty malformed redirection header (this is a dump of the response from

<pre class="highlight">
HTTP/1.0 302 Found
Location: <a href="http://sourceforge.nethttps//">http://sourceforge.net</a>
Server: BigIP
Connection: close
Content-Length: 0

As you can see something is buggy either in their code, or with their servers.. But since you say this doesn't happen with Firefox, I assumed this is something we can probably do better :)

Thanks for reporting!

Posted by Shahar Evron (shahar) on 2009-07-24T06:44:31.000+0000

This is indeed the difference, and this problem was fixed in SVN trunk. You can test with the latest SVN checkout or wait for the next release which will probably include this fix.



Posted by Satoru Yoshida (satoruyoshida) on 2009-11-17T22:51:11.000+0000

I set fix version. I find this at SVN r17118 in 1.9 branch.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.