Issues

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 (core.cure@gmail.com) Assignee: Shahar Evron (shahar) Tags: - Zend_Http_Client

Related issues: Attachments:

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:

<pre class="highlight">
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

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?

Thanks.

Posted by John Hopper (core.cure@gmail.com) on 2008-12-09T03:29:34.000+0000

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:

Posted by John Hopper (core.cure@gmail.com) on 2008-12-09T03:39:29.000+0000

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

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 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):

<pre class="highlight">
HTTP/1.0 302 Found
Location: <a href="http://sourceforge.nethttps//www.sf.net:443/">http://sourceforge.nethttps://www.sf.net:443/</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.

Thanks!

Shahar.

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.

Copyright

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

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

Contacts