ZF-1318: HTTPS connection through Proxy

Issue Type: New Feature Created: 2007-04-26T15:21:59.000+0000 Last Updated: 2008-03-21T16:25:19.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: ming (myhusky) Assignee: Shahar Evron (shahar) Tags: - Zend_Http_Client

Related issues: Attachments:


I try to make HTTPS connection through Proxy with Zend_Http_Client and Zend_Http_Client_Adapter_Proxy. but always get expection "Unable to read response, or response is empty". Proxy has been verified no problem. After some debugging, I found that the only message returned from the proxy is "Connection: close".

p.s. make direct HTTPS connection works fine with Zend_Http_Client.


Posted by Shahar Evron (shahar) on 2007-04-29T04:06:44.000+0000


Is this proxy open? Can you pass some example code and if possible the address of a proxy I can test on?


Posted by ming (myhusky) on 2007-04-29T13:11:07.000+0000

here are some code you can take a look. the proxy used is Tor, I donot have a open to public proxy server , but you can easily install Tor on almost any platform.

<pre class="highlight">

require_once 'Zend/Http/Client.php';
require_once 'Zend/Db.php';


$client = new Zend_Http_Client();
    'maxredirects'      => 5,
    'useragent'          => 'Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv: Gecko/20070309 Firefox/',
    'timeout'           => 30,
    'keepalive'      => true,
    'adapter'    => 'Zend_Http_Client_Adapter_Proxy',
    //'ssltransport' => 'ssl',
    'proxy_host' => 'localhost',
    'proxy_port' => 8118,

$client->setUri('<a href=""></a>');
try {
   $response = $client->request();
} catch (Zend_Http_Client_Exception $ex) {
   // Report the exception to the user
   die('Client Excep'.$ex->getMessage());
} catch (Zend_Http_Exception $ex) {
    die('Http Excep'. $ex->getMessage());
echo $response->getBody();


Posted by Shahar Evron (shahar) on 2007-05-01T07:11:22.000+0000


I've done some research and I believe that in order to properly support tunneling of HTTPS connections, we need to properly implement the CONNECT method in the client.

This is a big change and thus cannot be applied on the main branch before 1.0 is released. Also, it would require some time to work on.

I will do my best to look into this, but I am not sure this will be supported soon.

Posted by ming (myhusky) on 2007-05-02T12:25:01.000+0000

OK then, thanks

Posted by Shahar Evron (shahar) on 2007-05-09T02:41:11.000+0000

Changed to 'new feature' - add proper support for HTTP CONNECT requests

Posted by Shahar Evron (shahar) on 2007-07-31T10:32:31.000+0000

Support was added in one of the latest revisions and should be available in SVN HEAD. I am still waiting for feedback (got none) to see if it properly works or not.

Posted by ming (myhusky) on 2007-07-31T16:08:16.000+0000

I have tested the ZF latest revision. It did not work, I'm getting following errors

Warning: stream_socket_enable_crypto() [streams.crypto]: this stream does not support SSL/crypto in /Applications/Zend/ZendStudio-5.5.0/bin/ZendFramework/library/Zend/Http/Client/Adapter/Proxy.php on line 194

Posted by ming (myhusky) on 2007-07-31T16:31:02.000+0000

above my last comment, the problem was because of I did not have openssl installed.

It works now!!!


Posted by Shahar Evron (shahar) on 2007-10-11T13:14:32.000+0000

No complaints yet - seems to be relatively well implemented. If any bugs appear they should be opened as new issues.

Have you found an issue?

See the Overview section for more details.


© 2006-2022 by Zend by Perforce. Made with by awesome contributors.

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