ZF-4259: zend http client with proxy

Description

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:


if($this->negotiated){
    $request = "{$method} {$uri->getPath()} HTTP/{$http_ver}\r\n";
}
else{
    $request = "{$method} {$uri->__toString()} HTTP/{$http_ver}\r\n";
}

tcpdump:

CONNECT h1.host.com:443 HTTP/1.1 Host: 10.10.0.1

HTTP/1.0 200 Connection established

CONNECT h5.host.comhttps:443 HTTP/1.1 Host: 10.10.0.1

Comments

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?

Thanks.

sorry for the delay.

code + tcp dump follows:

require_once("Zend/Http/Client.php");

$config = array(

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

$uri = "https://<a rel="nofollow" href="www.sf.net/">www.sf.net/</a>";

    try{
        $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 www.sf.net:443 HTTP/1.1. Host: 10.3.0.24. User-agent:

HTTP/1.0 200 Connection established.

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

redirection for http works fine. tested using proxy and the same host (http://sf.net )

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 sf.net servers because plain Apache works fine (I've been testing this for some time now).

Actually the SF.net servers send a pretty malformed redirection header (this is a dump of the response from sf.net):


HTTP/1.0 302 Found
Location: http://sourceforge.nethttps://www.sf.net:443/
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!

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.

Thanks!

Shahar.

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