dmitry Thu Nov 1 14:11:47 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/soap soap.c Log: Fixed bug #41635 (SoapServer and zlib.output_compression with FastCGI result in major slowdown) http://cvs.php.net/viewvc.cgi/php-src/ext/soap/soap.c?r1=1.156.2.28.2.31&r2=1.156.2.28.2.32&diff_format=u Index: php-src/ext/soap/soap.c diff -u php-src/ext/soap/soap.c:1.156.2.28.2.31 php-src/ext/soap/soap.c:1.156.2.28.2.32 --- php-src/ext/soap/soap.c:1.156.2.28.2.31 Thu Nov 1 14:10:19 2007 +++ php-src/ext/soap/soap.c Thu Nov 1 14:11:47 2007 @@ -17,7 +17,7 @@ | Dmitry Stogov <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: soap.c,v 1.156.2.28.2.31 2007/11/01 14:10:19 dmitry Exp $ */ +/* $Id: soap.c,v 1.156.2.28.2.32 2007/11/01 14:11:47 dmitry Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1872,8 +1872,10 @@ INIT_ZVAL(result); ZVAL_STRINGL(&nm_ob_gzhandler, "ob_gzhandler", sizeof("ob_gzhandler") - 1, 0); + INIT_PZVAL(&str); ZVAL_STRINGL(&str, (char*)buf, size, 0); params[0] = &str; + INIT_PZVAL(&mode); ZVAL_LONG(&mode, PHP_OUTPUT_HANDLER_START | PHP_OUTPUT_HANDLER_END); params[1] = &mode; if (call_user_function(CG(function_table), NULL, &nm_ob_gzhandler, &result, 2, params TSRMLS_CC) != FAILURE && @@ -2011,17 +2013,47 @@ our fault code with their own handling... Figure this out later */ sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error")-1, 1); - 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 { sapi_add_header("Content-Type: text/xml; charset=utf-8", sizeof("Content-Type: text/xml; charset=utf-8")-1, 1); } - php_write(buf, size TSRMLS_CC); + + if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0) && + zend_hash_exists(EG(function_table), "ob_gzhandler", sizeof("ob_gzhandler"))) { + zval nm_ob_gzhandler; + zval str; + zval mode; + zval result; + zval *params[2]; + + INIT_ZVAL(result); + ZVAL_STRINGL(&nm_ob_gzhandler, "ob_gzhandler", sizeof("ob_gzhandler") - 1, 0); + INIT_PZVAL(&str); + ZVAL_STRINGL(&str, (char*)buf, size, 0); + params[0] = &str; + INIT_PZVAL(&mode); + ZVAL_LONG(&mode, PHP_OUTPUT_HANDLER_START | PHP_OUTPUT_HANDLER_END); + params[1] = &mode; + if (call_user_function(CG(function_table), NULL, &nm_ob_gzhandler, &result, 2, params TSRMLS_CC) != FAILURE && + Z_TYPE(result) == IS_STRING && + zend_alter_ini_entry("zlib.output_compression", sizeof("zlib.output_compression"), "0", sizeof("0")-1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME) == SUCCESS) { + xmlFree(buf); + buf = NULL; + snprintf(cont_len, sizeof(cont_len), "Content-Length: %d", Z_STRLEN(result)); + sapi_add_header(cont_len, strlen(cont_len), 1); + php_write(Z_STRVAL(result), Z_STRLEN(result) TSRMLS_CC); + } + zval_dtor(&result); + } + if (buf) { + 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); + } xmlFreeDoc(doc_return); - xmlFree(buf); zend_clear_exception(TSRMLS_C); }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php