]> granicus.if.org Git - php/commitdiff
Fixed bug #37054 (SoapClient Error Fetching http headers)
authorDmitry Stogov <dmitry@php.net>
Thu, 13 Apr 2006 08:18:54 +0000 (08:18 +0000)
committerDmitry Stogov <dmitry@php.net>
Thu, 13 Apr 2006 08:18:54 +0000 (08:18 +0000)
ext/soap/php_http.c
ext/soap/soap.c

index cb7622fdfff94e7dcaf034af99f24a10645a7fd5..f18d10042cf3d93db4f4a5a3e4b71e158eaca9ea 100644 (file)
@@ -417,12 +417,21 @@ try_again:
                        smart_str_append_unsigned(&soap_headers, phpurl->port);
                }
                smart_str_append_const(&soap_headers, "\r\n"
-                       "Connection: Keep-Alive\r\n"
+                       "Connection: Keep-Alive\r\n");
 /*
                        "Connection: close\r\n"
                        "Accept: text/html; text/xml; text/plain\r\n"
 */
-                       "User-Agent: PHP SOAP 0.1\r\n");
+               if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent"), (void **)&tmp) == SUCCESS &&
+                   Z_TYPE_PP(tmp) == IS_STRING) {
+                       if (Z_STRLEN_PP(tmp) > 0) {
+                               smart_str_append_const(&soap_headers, "User-Agent: ");
+                               smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
+                               smart_str_append_const(&soap_headers, "\r\n");
+                       }
+               } else{
+                       smart_str_append_const(&soap_headers, "User-Agent: PHP-SOAP/"PHP_VERSION"\r\n");
+               }
 
                smart_str_append(&soap_headers, &soap_headers_z);
                smart_str_free(&soap_headers_z);
index 52572902e79ef08b8cf526c294010e0615e0c490..2f872c8c3138f8c34526966cf0b344e4ace9c46a 100644 (file)
@@ -2278,6 +2278,11 @@ PHP_METHOD(SoapClient, SoapClient)
                        persistent = zend_is_true(*tmp);
                }
 
+               if (zend_hash_find(ht, "user_agent", sizeof("user_agent"), (void**)&tmp) == SUCCESS &&
+                   Z_TYPE_PP(tmp) == IS_STRING) {
+                       add_property_stringl(this_ptr, "_user_agent", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
+               }
+
        } else if (wsdl == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' and 'uri' options are requred in nonWSDL mode");
                return;