]> granicus.if.org Git - php/commitdiff
Fixed bug #41635 (SoapServer and zlib.output_compression with FastCGI result in major...
authorDmitry Stogov <dmitry@php.net>
Fri, 13 Jul 2007 14:01:11 +0000 (14:01 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 13 Jul 2007 14:01:11 +0000 (14:01 +0000)
ext/soap/soap.c

index 4ec0aeeb0a0f017cdc25e2d1d450125f952db0f8..000d8ac66433c68ef82522f58bff852577469113 100644 (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);