dmitry Mon Dec 1 09:50:18 2008 UTC
Modified files:
/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/ext/soap/php_http.c?r1=1.115&r2=1.116&diff_format=u
Index: php-src/ext/soap/php_http.c
diff -u php-src/ext/soap/php_http.c:1.115 php-src/ext/soap/php_http.c:1.116
--- php-src/ext/soap/php_http.c:1.115 Fri Nov 28 14:21:08 2008
+++ php-src/ext/soap/php_http.c Mon Dec 1 09:50:17 2008
@@ -17,7 +17,7 @@
| Dmitry Stogov <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_http.c,v 1.115 2008/11/28 14:21:08 dmitry Exp $ */
+/* $Id: php_http.c,v 1.116 2008/12/01 09:50:17 dmitry Exp $ */
#include "php_soap.h"
#include "ext/standard/base64.h"
@@ -374,6 +374,16 @@
client->url = NULL;
}
client->url = phpurl;
+
+ if (client->stream_context &&
+ php_stream_context_get_option(client->stream_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);
@@ -395,19 +405,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 (client->user_agent) {
if (client->user_agent[0] != 0) {
smart_str_append_const(&soap_headers,
"User-Agent: ");
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_sdl.c?r1=1.113&r2=1.114&diff_format=u
Index: php-src/ext/soap/php_sdl.c
diff -u php-src/ext/soap/php_sdl.c:1.113 php-src/ext/soap/php_sdl.c:1.114
--- php-src/ext/soap/php_sdl.c:1.113 Wed Jun 18 07:24:14 2008
+++ php-src/ext/soap/php_sdl.c Mon Dec 1 09:50:18 2008
@@ -17,7 +17,7 @@
| Dmitry Stogov <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_sdl.c,v 1.113 2008/06/18 07:24:14 dmitry Exp $ */
+/* $Id: php_sdl.c,v 1.114 2008/12/01 09:50:18 dmitry Exp $ */
#include "php_soap.h"
#include "ext/libxml/php_libxml.h"
@@ -3092,6 +3092,7 @@
smart_str headers = {0};
char* key = NULL;
time_t t = time(0);
+ zval **tmp;
if (strchr(uri,':') != NULL || IS_ABSOLUTE_PATH(uri, uri_len)) {
uri_len = strlen(uri);
@@ -3155,6 +3156,8 @@
if (client->stream_context) {
context = client->stream_context;
+ } else {
+ context = php_stream_context_alloc();
}
if (client->proxy_host) {
@@ -3185,6 +3188,18 @@
}
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) {
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug44811.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/soap/tests/bugs/bug44811.phpt
diff -u php-src/ext/soap/tests/bugs/bug44811.phpt:1.2
php-src/ext/soap/tests/bugs/bug44811.phpt:1.3
--- php-src/ext/soap/tests/bugs/bug44811.phpt:1.2 Wed May 7 15:45:56 2008
+++ php-src/ext/soap/tests/bugs/bug44811.phpt Mon Dec 1 09:50:18 2008
@@ -14,7 +14,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