summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lowrey <rdlowrey@php.net>2014-07-12 10:56:57 -0400
committerDaniel Lowrey <rdlowrey@php.net>2014-07-12 10:57:30 -0400
commit4bdb0120dc26a14d906e2e8a69e841920df3de99 (patch)
treeb462bf46eb5a338078ba3dba3fac8acc21125502
parent3a9bdafeff344543311e84436176625f4ce88b40 (diff)
parentf3bf887e6d84619fd03efc244756f68fa857b346 (diff)
downloadphp-git-4bdb0120dc26a14d906e2e8a69e841920df3de99.tar.gz
Merge branch 'PHP-5.6'
-rw-r--r--ext/standard/http_fopen_wrapper.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index ce4c2ba0ea..3eecd7bdae 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -120,7 +120,7 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
char *scratch = NULL;
char *tmp = NULL;
char *ua_str = NULL;
- zval **ua_zval = NULL, **tmpzval = NULL;
+ zval **ua_zval = NULL, **tmpzval = NULL, *ssl_proxy_peer_name = NULL;
int scratch_len = 0;
int body = 0;
char location[HTTP_HEADER_BLOCK_SIZE];
@@ -224,6 +224,13 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
efree(transport_string);
if (stream && use_proxy && use_ssl) {
+ /* Set peer_name or name verification will try to use the proxy server name */
+ if (!context || php_stream_context_get_option(context, "ssl", "peer_name", &tmpzval) == FAILURE) {
+ MAKE_STD_ZVAL(ssl_proxy_peer_name);
+ ZVAL_STRING(ssl_proxy_peer_name, resource->host, 1);
+ php_stream_context_set_option(stream->context, "ssl", "peer_name", ssl_proxy_peer_name);
+ }
+
smart_str header = {0};
smart_str_appendl(&header, "CONNECT ", sizeof("CONNECT ")-1);
@@ -316,7 +323,7 @@ finish:
/* enable SSL transport layer */
if (stream) {
- if (php_stream_xport_crypto_setup(stream, STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 ||
+ if (php_stream_xport_crypto_setup(stream, STREAM_CRYPTO_METHOD_ANY_CLIENT, NULL TSRMLS_CC) < 0 ||
php_stream_xport_crypto_enable(stream, 1 TSRMLS_CC) < 0) {
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Cannot connect to HTTPS server through proxy");
php_stream_close(stream);