Good News Everyone! After breaking my head a little bit over this, I managed to implement the long-awaited HTTPS through proxy support in Zend_Http_Client. Those of you who want to test it, are more than welcome to update to HEAD (r. 5843 and up) and try to connect to an HTTPS server through a proxy (that supports the CONNECT method of course).
The following code sample shows how to connect to an HTTPS server though
a proxy with Zend_Http_Client:
<?php
require_once 'Zend/Http/Client.php';
$client = new Zend_Http_Client('https://www.example.com/', array(
'adapter' => 'Zend_Http_Client_Adapter_Proxy',
'proxy_host' => 'myproxy.example.com',
'proxy_port' => 8080,
'proxy_user' => 'shahar',
'proxy_pass' => 'secret'
));
$response = $client->request();
echo $response->asString();
?>
The configuration is similar to non-secure HTTP proxy client
configuration.
Needless to say this code is lightly tested and is probably not finished
yet. I would like to get your feedback if you encounter troubles.
One strange behavior which should be mentioned is the fact that if your
proxy requires authentication and you provide the wrong credentials,
you'll get an exception thrown instead of a regular 407 response. This
is because of tunneling issues, and requires a bit of ugly hacking to
work around. I am still arguing with myself whether I should work on it
or not, so your thoughts about this are also welcome.
Enjoy!
Shahar.
signature.asc
Description: This is a digitally signed message part
