Issues

ZF-1004: Add support for stream context in the Socket adapter

Description

Currently, the default Socket adapter does not support stream contexts - for example, there is no way to set a local certificate for HTTPS connections (might be important for PayPal access for example)

We should either improve the socket adapter to support this or create a new adapter based on stream_socket_client() instead of fsockopen().

Comments

apparently, stream_context_set_params() can be used on sockets created by fsockopen as well - so there is not much rewriting to be done here. This can be done using a new configuration option and a call to stream_context_set_params() on the socket after opening the connection.

I have attached a patch that changes the Socket adapter to use stream_context_create() instead of fsockopen(), and adds 'sslcert' and 'sslpassphrase' options to allow client SSL certificates to be used. Although the conversion from fsockopen() to stream_socket_client() may not have been needed, it only required changes in a few lines of code and as far as I can tell does not have any drawbacks.

Hi Alex,

Thanks for the patch, it looks great! One question: Did you sign your CLA yet? I can only apply the patch if you signed the Framework CLA: http://framework.zend.com/wiki/display/…

You're welcome. Yes, I signed the CLA back in November 2006.

Patch applied in revision 6146.

Fixed for both 1.1.0 and 1.0.2

Updating Fix Version to follow issue tracker conventions.