diff options
author | Dmitry Stogov <dmitry@php.net> | 2008-12-01 09:50:18 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2008-12-01 09:50:18 +0000 |
commit | 03a2f54d50e6d87ba50a8f87f84d9512cb44fff0 (patch) | |
tree | 15620d00b5fbb0550da4ab47d4a2322f2f58d838 /ext/soap/php_http.c | |
parent | 865dbf5bba938ad52981ed80666f95def12664ec (diff) | |
download | php-git-03a2f54d50e6d87ba50a8f87f84d9512cb44fff0.tar.gz |
Fixed bug #43069 (SoapClient causes 505 HTTP Version not supported error message)
Diffstat (limited to 'ext/soap/php_http.c')
-rw-r--r-- | ext/soap/php_http.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index e0df57d3c6..397ef25d8c 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -374,6 +374,16 @@ try_again: 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 @@ try_again: 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: "); |