Patch php-soap-patch-2152.patch for SOAP related Bug #69137
Patch version 2018-11-14 14:53 UTC
Return to Bug #69137 |
Download this patch
Patch Revisions:
Developer: tomp@tomp.uk
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 3246091..fcf593e 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -163,7 +163,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 TSRMLS_DC)
{
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;
@@ -245,6 +245,13 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
char *http_headers;
int http_header_size;
+ /* Set peer_name or name verification will try to use the proxy server name */
+ if (!stream->context || php_stream_context_get_option(stream->context, "ssl", "peer_name", &tmp) != SUCCESS) {
+ ZVAL_STRING(&ssl_proxy_peer_name, phpurl->host, 1);
+ php_stream_context_set_option(stream->context, "ssl", "peer_name", &ssl_proxy_peer_name);
+ zval_dtor(&ssl_proxy_peer_name);
+ }
+
smart_str_append_const(&soap_headers, "CONNECT ");
smart_str_appends(&soap_headers, phpurl->host);
smart_str_appendc(&soap_headers, ':');
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 569701a..571db1f 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -2398,7 +2398,9 @@ PHP_METHOD(SoapClient, SoapClient)
Z_TYPE_PP(tmp) == IS_RESOURCE) {
context = php_stream_context_from_zval(*tmp, 1);
zend_list_addref(context->rsrc_id);
- }
+ } else {
+ context = php_stream_context_alloc();
+ }
if (zend_hash_find(ht, "location", sizeof("location"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
|