Fixed bug #41635 (SoapServer and zlib.output_compression with FastCGI result in major slowdown

This commit is contained in:
Dmitry Stogov 2007-07-13 14:01:11 +00:00
parent 982967b637
commit 36add00ccd

View File

@ -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);