diff options
author | Keith Smiley <ksmiley@salesforce.com> | 2016-06-20 14:23:49 -0400 |
---|---|---|
committer | Keith Smiley <ksmiley@salesforce.com> | 2016-10-03 14:02:34 -0400 |
commit | 31cbce341c4a5017eac3239c8ff1278cb9ff3900 (patch) | |
tree | 8603ab02d97755b365ab08c39c9b0dc42c488e30 /ext/soap/php_http.c | |
parent | 8908df690f7bc29b606421c18eb06414154fa183 (diff) | |
download | php-git-31cbce341c4a5017eac3239c8ff1278cb9ff3900.tar.gz |
soap #69137 - Fix SSL verify when using a proxy
Name verification was failing because the OpenSSL extension was picking
the proxy server's address when guessing which name to compare to the
SSL certificate. This scenario is already handled for stream wrappers
in http_fopen_wrapper.c. This patch applies the same fix to the SOAP
extension: when a proxy is used, set peer_name explicitly on the stream
context.
Diffstat (limited to 'ext/soap/php_http.c')
-rw-r--r-- | ext/soap/php_http.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 7c9183613c..cb5550adb4 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -161,7 +161,7 @@ void http_context_headers(php_stream_context* context, static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, php_stream_context *context, int *use_proxy) { php_stream *stream; - zval *proxy_host, *proxy_port, *tmp; + zval *proxy_host, *proxy_port, *tmp, ssl_proxy_peer_name; char *host; char *name; char *protocol; @@ -241,6 +241,13 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph if (stream && *use_proxy && use_ssl) { smart_str soap_headers = {0}; + /* Set peer_name or name verification will try to use the proxy server name */ + if (context && (tmp = php_stream_context_get_option(context, "ssl", "peer_name")) != NULL) { + ZVAL_STRING(&ssl_proxy_peer_name, phpurl->host); + php_stream_context_set_option(PHP_STREAM_CONTEXT(stream), "ssl", "peer_name", &ssl_proxy_peer_name); + zval_ptr_dtor(&ssl_proxy_peer_name); + } + smart_str_append_const(&soap_headers, "CONNECT "); smart_str_appends(&soap_headers, phpurl->host); smart_str_appendc(&soap_headers, ':'); |