]> granicus.if.org Git - php/commitdiff
Fixed bug #60887 (SoapClient ignores user_agent option and sends no User-Agent header)
authorDmitry Stogov <dmitry@php.net>
Mon, 5 Mar 2012 12:59:01 +0000 (12:59 +0000)
committerDmitry Stogov <dmitry@php.net>
Mon, 5 Mar 2012 12:59:01 +0000 (12:59 +0000)
NEWS
ext/soap/php_sdl.c

diff --git a/NEWS b/NEWS
index 638c4e78269ef5f81d2d9219ac9a9436bdd104dc..8708b1abd8862c874821f42d7abdbe52b0add7c2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -38,6 +38,10 @@ PHP                                                                        NEWS
 - mbstring:
   . MFH mb_ereg_replace_callback() for security enhancements. (Rui)
 
+- SOAP
+  . Fixed bug #60887 (SoapClient ignores user_agent option and sends no
+    User-Agent header). (carloschilazo at gmail dot com)
+
 - Phar
   . Fixed bug #61184 (Phar::webPhar() generates headers with trailing NUL
     bytes). (Nikita Popov)
index 961dcf29e65737334604d5c10d81ca3990c59b03..eeedc510f18faa8e3e3679b0370da2c932c38f9c 100644 (file)
@@ -3259,6 +3259,13 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC)
                context = php_stream_context_alloc(TSRMLS_C);
        }
 
+       if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent"), (void **) &tmp) == SUCCESS &&
+           Z_TYPE_PP(tmp) == IS_STRING && Z_STRLEN_PP(tmp) > 0) {      
+               smart_str_appends(&headers, "User-Agent: ");
+               smart_str_appends(&headers, Z_STRVAL_PP(tmp));
+               smart_str_appends(&headers, "\r\n");
+       }
+
        if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host"), (void **) &proxy_host) == SUCCESS &&
            Z_TYPE_PP(proxy_host) == IS_STRING &&
            zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port"), (void **) &proxy_port) == SUCCESS &&