From: Dmitry Stogov Date: Fri, 13 Jul 2007 14:01:11 +0000 (+0000) Subject: Fixed bug #41635 (SoapServer and zlib.output_compression with FastCGI result in major... X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~135 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=36add00ccddc33f92a9e6ccf11690c8e82e98c03;p=php Fixed bug #41635 (SoapServer and zlib.output_compression with FastCGI result in major slowdown --- diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 4ec0aeeb0a..000d8ac664 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -2134,8 +2134,6 @@ PHP_METHOD(SoapServer, handle) php_error_docref(NULL TSRMLS_CC, E_ERROR, "Dump memory failed"); } - snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size); - sapi_add_header(cont_len, strlen(cont_len), 1); if (soap_version == SOAP_1_2) { sapi_add_header("Content-Type: application/soap+xml; charset=utf-8", sizeof("Content-Type: application/soap+xml; charset=utf-8")-1, 1); } else { @@ -2147,10 +2145,18 @@ PHP_METHOD(SoapServer, handle) old_output_conv = UG(output_encoding_conv); UG(runtime_encoding_conv) = UG(utf8_conv); UG(output_encoding_conv) = UG(utf8_conv); + + if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { + sapi_add_header("Connection: close", sizeof("Connection: close")-1, 1); + } else { + snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", size); + sapi_add_header(cont_len, strlen(cont_len), 1); + } php_write(buf, size TSRMLS_CC); + xmlFree(buf); + UG(runtime_encoding_conv) = old_runtime_conv; UG(output_encoding_conv) = old_output_conv; - xmlFree(buf); } else { sapi_add_header("HTTP/1.1 202 Accepted", sizeof("HTTP/1.1 202 Accepted")-1, 1); sapi_add_header("Content-Length: 0", sizeof("Content-Length: 0")-1, 1);