cvs: php4 /ext/zlib zlib.c
| From: | Marcus B�rger | Date: | Tue, 20 Aug 2002 19:51:00 +0000 |
| Subject: | cvs: php4 /ext/zlib zlib.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-13494@lists.php.net to get a copy of this message | ||
helly Tue Aug 20 15:51:00 2002 EDT
Modified files:
/php4/ext/zlib zlib.c
Log:
Changed handling of output buffer sizes.
Index: php4/ext/zlib/zlib.c
diff -u php4/ext/zlib/zlib.c:1.143 php4/ext/zlib/zlib.c:1.144
--- php4/ext/zlib/zlib.c:1.143 Sat Aug 10 22:32:49 2002
+++ php4/ext/zlib/zlib.c Tue Aug 20 15:51:00 2002
@@ -18,7 +18,7 @@
| Jade Nicoletti <nicoletti@nns.ch> |
+----------------------------------------------------------------------+
*/
-/* $Id: zlib.c,v 1.143 2002/08/11 02:32:49 yohgaki Exp $ */
+/* $Id: zlib.c,v 1.144 2002/08/20 19:51:00 helly Exp $ */
#define IS_EXT_MODULE
#ifdef HAVE_CONFIG_H
@@ -149,12 +149,8 @@
new_value = "0";
new_value_length = sizeof("0");
} else if(!strncasecmp(new_value, "on", sizeof("on"))) {
- new_value = "4096";
- new_value_length = sizeof("4096");
- } else if(stage == PHP_INI_STAGE_RUNTIME &&
- strncmp(new_value, "0", sizeof("0")) && strncmp(new_value,
"1", sizeof("1"))) {
- php_error(E_WARNING, "Cannot change zlib.output_compression buffer size during script
execution");
- return FAILURE;
+ new_value = "1";
+ new_value_length = sizeof("1");
}
if (stage == PHP_INI_STAGE_RUNTIME && SG(headers_sent) &&
!SG(request_info).no_headers) {
@@ -193,9 +189,9 @@
PHP_INI_BEGIN()
- STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_ALL,
OnUpdate_zlib_output_compression, output_compression, zend_zlib_globals, zlib_globals)
+ STD_PHP_INI_BOOLEAN("zlib.output_compression", "0", PHP_INI_ALL,
OnUpdate_zlib_output_compression, output_compression, zend_zlib_globals, zlib_globals)
STD_PHP_INI_ENTRY("zlib.output_compression_level", "-1", PHP_INI_ALL,
OnUpdate_zlib_output_compression_level, output_compression_level, zend_zlib_globals, zlib_globals)
- STD_PHP_INI_ENTRY("zlib.output_handler", "", PHP_INI_ALL,
OnUpdate_zlib_output_handler, output_handler, zend_zlib_globals, zlib_globals)
+ STD_PHP_INI_ENTRY("zlib.output_handler", "", PHP_INI_ALL,
OnUpdate_zlib_output_handler, output_handler, zend_zlib_globals, zlib_globals)
PHP_INI_END()
#ifdef ZTS
@@ -229,16 +225,12 @@
*/
PHP_RINIT_FUNCTION(zlib)
{
+ uint chunk_size = ZLIBG(output_compression);
+
ZLIBG(ob_gzhandler_status) = 0;
ZLIBG(ob_gzip_coding) = 0;
- switch (ZLIBG(output_compression)) {
- case 0:
- break;
- case 1:
- php_enable_output_compression(4096 TSRMLS_CC);
- break;
- default:
- php_enable_output_compression(ZLIBG(output_compression) TSRMLS_CC);
+ if (chunk_size) {
+ php_enable_output_compression(chunk_size TSRMLS_CC);
}
return SUCCESS;
}
@@ -1013,7 +1005,7 @@
return FAILURE;
}
- php_ob_set_internal_handler(php_gzip_output_handler, (uint)(buffer_size*3/2), "zlib output
compression", 0 TSRMLS_CC);
+ php_ob_set_internal_handler(php_gzip_output_handler, (uint)buffer_size, "zlib output
compression", 0 TSRMLS_CC);
if (ZLIBG(output_handler) && strlen(ZLIBG(output_handler))) {
php_start_ob_buffer_named(ZLIBG(output_handler), 0, 1 TSRMLS_CC);
}