summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2006-04-13 08:18:36 +0000
committerDmitry Stogov <dmitry@php.net>2006-04-13 08:18:36 +0000
commitf897cff4807fe994275ed08429700b5e9decc8e7 (patch)
tree7b0b131b8afafb4e496d675498b401a1455f174d
parent851801a7955bf8f244c6619d18f47121f520695c (diff)
downloadphp-git-f897cff4807fe994275ed08429700b5e9decc8e7.tar.gz
Fixed bug #37054 (SoapClient Error Fetching http headers)
-rw-r--r--NEWS1
-rw-r--r--ext/soap/php_http.c15
-rw-r--r--ext/soap/soap.c5
3 files changed, 18 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 26763079c8..7947604326 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ PHP NEWS
which are unaccessible). (Tony)
- Fixed bug #37055 (incorrect reference counting for persistent OCI8
connections). (Tony)
+- Fixed bug #37054 (SoapClient Error Fetching http headers). (Dmitry)
- Fixed bug #37053 (html_errors with internal classes produces wrong links).
(Tony)
- Fixed bug #37046 (foreach breaks static scope). (Dmitry)
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 34e55b2bf3..e70a006dcb 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -416,13 +416,22 @@ try_again:
smart_str_appendc(&soap_headers, ':');
smart_str_append_unsigned(&soap_headers, phpurl->port);
}
- smart_str_append_const(&soap_headers, "\r\n"
- "Connection: Keep-Alive\r\n"
+ smart_str_append_const(&soap_headers, "\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);
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 0962d8e785..d1c5cfe9cc 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -2284,6 +2284,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;