diff options
Diffstat (limited to 'main')
| -rw-r--r-- | main/network.c | 12 | ||||
| -rw-r--r-- | main/php_network.h | 3 |
2 files changed, 13 insertions, 2 deletions
diff --git a/main/network.c b/main/network.c index 68aa87bbe1..8d4f921a4d 100644 --- a/main/network.c +++ b/main/network.c @@ -582,11 +582,16 @@ PHPAPI php_stream *_php_stream_sock_open_unix(const char *path, int pathlen, int } #if HAVE_OPENSSL_EXT -PHPAPI int php_stream_sock_ssl_activate_with_method(php_stream *stream, int activate, SSL_METHOD *method TSRMLS_DC) +PHPAPI int php_stream_sock_ssl_activate_with_method_ex(php_stream *stream, int activate, SSL_METHOD *method, php_stream *control TSRMLS_DC) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *psock = NULL; SSL_CTX *ctx = NULL; + if (control) { + psock = (php_netstream_data_t*)control->abstract; + } + if (!php_stream_is(stream, PHP_STREAM_IS_SOCKET)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "php_stream_sock_ssl_activate_with_method: stream is not a network stream"); return FAILURE; @@ -610,6 +615,10 @@ PHPAPI int php_stream_sock_ssl_activate_with_method(php_stream *stream, int acti } SSL_set_fd(sock->ssl_handle, sock->socket); + + if (psock) { + SSL_copy_session_id(sock->ssl_handle, psock->ssl_handle); + } } if (activate) { @@ -626,6 +635,7 @@ PHPAPI int php_stream_sock_ssl_activate_with_method(php_stream *stream, int acti } return SUCCESS; } + #endif PHPAPI void php_stream_sock_set_timeout(php_stream *stream, struct timeval *timeout TSRMLS_DC) diff --git a/main/php_network.h b/main/php_network.h index 6602ddd6b4..139f19ce8f 100644 --- a/main/php_network.h +++ b/main/php_network.h @@ -148,7 +148,8 @@ PHPAPI void php_stream_sock_set_timeout(php_stream *stream, struct timeval *time PHPAPI size_t php_stream_sock_set_chunk_size(php_stream *stream, size_t size TSRMLS_DC); #if HAVE_OPENSSL_EXT -PHPAPI int php_stream_sock_ssl_activate_with_method(php_stream *stream, int activate, SSL_METHOD *method TSRMLS_DC); +PHPAPI int php_stream_sock_ssl_activate_with_method_ex(php_stream *stream, int activate, SSL_METHOD *method, php_stream *control TSRMLS_DC); +#define php_stream_sock_ssl_activate_with_method(stream, activate, method) php_stream_sock_ssl_activate_with_method_ex((stream), (activate), SSLv23_client_method(), NULL TSRMLS_CC) #define php_stream_sock_ssl_activate(stream, activate) php_stream_sock_ssl_activate_with_method((stream), (activate), SSLv23_client_method() TSRMLS_CC) #endif |
