diff options
Diffstat (limited to 'ext/soap/php_http.c')
-rw-r--r-- | ext/soap/php_http.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 91ab27d52..b8efbcbc5 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -118,7 +118,7 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph namelen = spprintf(&name, 0, "%s://%s:%d", (use_ssl && !*use_proxy)? "ssl" : "tcp", host, port); stream = php_stream_xport_create(name, namelen, - ENFORCE_SAFE_MODE | REPORT_ERRORS, + REPORT_ERRORS, STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, NULL /*persistent_id*/, timeout, @@ -387,7 +387,7 @@ try_again: if (stream) { zval **cookies, **login, **password; - int ret = zend_list_insert(phpurl, le_url); + int ret = zend_list_insert(phpurl, le_url TSRMLS_CC); add_property_resource(this_ptr, "httpurl", ret); /*zend_list_addref(ret);*/ @@ -433,12 +433,14 @@ try_again: smart_str_appendc(&soap_headers, ':'); smart_str_append_unsigned(&soap_headers, phpurl->port); } - if (http_1_1) { + if (!http_1_1 || + (zend_hash_find(Z_OBJPROP_P(this_ptr), "_keep_alive", sizeof("_keep_alive"), (void **)&tmp) == SUCCESS && + Z_LVAL_PP(tmp) == 0)) { smart_str_append_const(&soap_headers, "\r\n" - "Connection: Keep-Alive\r\n"); + "Connection: close\r\n"); } else { smart_str_append_const(&soap_headers, "\r\n" - "Connection: close\r\n"); + "Connection: Keep-Alive\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) { @@ -1386,7 +1388,7 @@ static int get_http_body(php_stream *stream, int close, char *headers, char **r if (header_length < 0 || header_length >= INT_MAX) { return FALSE; } - http_buf = emalloc(header_length + 1); + http_buf = safe_emalloc(1, header_length, 1); while (http_buf_size < header_length) { int len_read = php_stream_read(stream, http_buf + http_buf_size, header_length - http_buf_size); if (len_read <= 0) { |