Zend Framework

Add support for stream context in the Socket adapter

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.8.0
  • Fix Version/s: 1.0.2
  • Component/s: Zend_Http_Client
  • Labels:
    None

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().

Activity

Hide
Shahar Evron added a comment -

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.

Show
Shahar Evron added a comment - 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.
Hide
Alex Adriaanse added a comment -

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.

Show
Alex Adriaanse added a comment - 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.
Hide
Shahar Evron added a comment -

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/ZFPROP/Contributor+License+Agreement

Show
Shahar Evron added a comment - 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/ZFPROP/Contributor+License+Agreement
Hide
Alex Adriaanse added a comment -

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

Show
Alex Adriaanse added a comment - You're welcome. Yes, I signed the CLA back in November 2006.
Hide
Shahar Evron added a comment -

Patch applied in revision 6146.

Show
Shahar Evron added a comment - Patch applied in revision 6146.
Hide
Shahar Evron added a comment -

Fixed for both 1.1.0 and 1.0.2

Show
Shahar Evron added a comment - Fixed for both 1.1.0 and 1.0.2
Hide
Wil Sinclair added a comment -

Updating Fix Version to follow issue tracker conventions.

Show
Wil Sinclair added a comment - Updating Fix Version to follow issue tracker conventions.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: