dmitry Mon Dec 1 09:49:58 2008 UTC Modified files: (Branch: PHP_5_3) /php-src NEWS /php-src/ext/soap php_http.c php_sdl.c /php-src/ext/soap/tests/bugs bug44811.phpt Log: Fixed bug #43069 (SoapClient causes 505 HTTP Version not supported error message) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.395&r2=1.2027.2.547.2.965.2.396&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.395 php-src/NEWS:1.2027.2.547.2.965.2.396 --- php-src/NEWS:1.2027.2.547.2.965.2.395 Sun Nov 30 17:34:07 2008 +++ php-src/NEWS Mon Dec 1 09:49:57 2008 @@ -95,6 +95,8 @@ (David C.) - Fixed bug #44154 (pdo->errorInfo() always have three elements in the returned array). (David C.) +- Fixed bug #43069 (SoapClient causes 505 HTTP Version not supported error + message). (Dmitry) - Fixed bug #41534 (SoapClient over HTTPS fails to reestablish connection). (Dmitry) http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_http.c?r1=1.77.2.11.2.12.2.7&r2=1.77.2.11.2.12.2.8&diff_format=u Index: php-src/ext/soap/php_http.c diff -u php-src/ext/soap/php_http.c:1.77.2.11.2.12.2.7 php-src/ext/soap/php_http.c:1.77.2.11.2.12.2.8 --- php-src/ext/soap/php_http.c:1.77.2.11.2.12.2.7 Fri Nov 28 14:20:58 2008 +++ php-src/ext/soap/php_http.c Mon Dec 1 09:49:57 2008 @@ -17,7 +17,7 @@ | Dmitry Stogov <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: php_http.c,v 1.77.2.11.2.12.2.7 2008/11/28 14:20:58 dmitry Exp $ */ +/* $Id: php_http.c,v 1.77.2.11.2.12.2.8 2008/12/01 09:49:57 dmitry Exp $ */ #include "php_soap.h" #include "ext/standard/base64.h" @@ -373,6 +373,15 @@ add_property_resource(this_ptr, "httpurl", ret); /*zend_list_addref(ret);*/ + if (context && + php_stream_context_get_option(context, "http", "protocol_version", &tmp) == SUCCESS && + Z_TYPE_PP(tmp) == IS_DOUBLE && + Z_DVAL_PP(tmp) == 1.0) { + http_1_1 = 0; + } else { + http_1_1 = 1; + } + smart_str_append_const(&soap_headers, "POST "); if (use_proxy && !use_ssl) { smart_str_appends(&soap_headers, phpurl->scheme); @@ -394,19 +403,24 @@ smart_str_appendc(&soap_headers, '#'); smart_str_appends(&soap_headers, phpurl->fragment); } - smart_str_append_const(&soap_headers, " HTTP/1.1\r\n" - "Host: "); + if (http_1_1) { + smart_str_append_const(&soap_headers, " HTTP/1.1\r\n"); + } else { + smart_str_append_const(&soap_headers, " HTTP/1.0\r\n"); + } + smart_str_append_const(&soap_headers, "Host: "); smart_str_appends(&soap_headers, phpurl->host); if (phpurl->port != (use_ssl?443:80)) { 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"); -/* - "Connection: close\r\n" - "Accept: text/html; text/xml; text/plain\r\n" -*/ + if (http_1_1) { + smart_str_append_const(&soap_headers, "\r\n" + "Connection: Keep-Alive\r\n"); + } else { + smart_str_append_const(&soap_headers, "\r\n" + "Connection: close\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) { http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_sdl.c?r1=1.88.2.12.2.9.2.4&r2=1.88.2.12.2.9.2.5&diff_format=u Index: php-src/ext/soap/php_sdl.c diff -u php-src/ext/soap/php_sdl.c:1.88.2.12.2.9.2.4 php-src/ext/soap/php_sdl.c:1.88.2.12.2.9.2.5 --- php-src/ext/soap/php_sdl.c:1.88.2.12.2.9.2.4 Wed Jun 18 07:23:58 2008 +++ php-src/ext/soap/php_sdl.c Mon Dec 1 09:49:58 2008 @@ -17,7 +17,7 @@ | Dmitry Stogov <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: php_sdl.c,v 1.88.2.12.2.9.2.4 2008/06/18 07:23:58 dmitry Exp $ */ +/* $Id: php_sdl.c,v 1.88.2.12.2.9.2.5 2008/12/01 09:49:58 dmitry Exp $ */ #include "php_soap.h" #include "ext/libxml/php_libxml.h" @@ -3152,6 +3152,8 @@ if (SUCCESS == zend_hash_find(Z_OBJPROP_P(this_ptr), "_stream_context", sizeof("_stream_context"), (void**)&tmp)) { context = php_stream_context_from_zval(*tmp, 0); + } else { + context = php_stream_context_alloc(); } if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host"), (void **) &proxy_host) == SUCCESS && @@ -3189,6 +3191,16 @@ basic_authentication(this_ptr, &headers TSRMLS_CC); + /* Use HTTP/1.1 with "Connection: close" by default */ + if (php_stream_context_get_option(context, "http", "protocol_version", &tmp) == FAILURE) { + zval *http_version; + MAKE_STD_ZVAL(http_version); + ZVAL_DOUBLE(http_version, 1.1); + php_stream_context_set_option(context, "http", "protocol_version", http_version); + zval_ptr_dtor(&http_version); + smart_str_appendl(&headers, "Connection: close", sizeof("Connection: close")-1); + } + if (headers.len > 0) { zval *str_headers; http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug44811.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u Index: php-src/ext/soap/tests/bugs/bug44811.phpt diff -u php-src/ext/soap/tests/bugs/bug44811.phpt:1.1.4.2 php-src/ext/soap/tests/bugs/bug44811.phpt:1.1.4.3 --- php-src/ext/soap/tests/bugs/bug44811.phpt:1.1.4.2 Wed May 7 15:23:31 2008 +++ php-src/ext/soap/tests/bugs/bug44811.phpt Mon Dec 1 09:49:58 2008 @@ -13,7 +13,7 @@ } die('ok'); ?> ---EXPECT-- -SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://slashdot.org' : Premature end of data in tag html line 3 +--EXPECTF-- +SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://slashdot.org' : %s ok
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php