diff options
author | Marcus Boerger <helly@php.net> | 2002-08-09 22:29:58 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2002-08-09 22:29:58 +0000 |
commit | 9c8ba935d6cce59d515087b5ce222f22619726f7 (patch) | |
tree | 3735e25221dd3866b0026a3761b4d2ca3af2dfff /ext/zlib | |
parent | 2e29e53e00d39aa6f5ea1ff4102f792f6ba7ae60 (diff) | |
download | php-git-9c8ba935d6cce59d515087b5ce222f22619726f7.tar.gz |
Improved handling of output buffers (see news)\n#No trim for the string parameter...
Diffstat (limited to 'ext/zlib')
-rw-r--r-- | ext/zlib/php_zlib.h | 1 | ||||
-rw-r--r-- | ext/zlib/zlib.c | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h index ce57652a46..5366337986 100644 --- a/ext/zlib/php_zlib.h +++ b/ext/zlib/php_zlib.h @@ -33,6 +33,7 @@ ZEND_BEGIN_MODULE_GLOBALS(zlib) int ob_gzip_coding; int output_compression; int output_compression_level; + char *output_handler; ZEND_END_MODULE_GLOBALS(zlib) extern zend_module_entry php_zlib_module_entry; diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 3848b25186..10ef6aa273 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -177,10 +177,25 @@ static PHP_INI_MH(OnUpdate_zlib_output_compression_level) } /* }}} */ +/* {{{ OnUpdate_zlib_output_handler */ +static PHP_INI_MH(OnUpdate_zlib_output_handler) +{ + if (stage == PHP_INI_STAGE_RUNTIME && SG(headers_sent) && !SG(request_info).no_headers) { + php_error(E_WARNING, "Cannot change zlib.output_handler - headers already sent"); + return FAILURE; + } + + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + + return SUCCESS; +} +/* }}} */ + 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_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) PHP_INI_END() #ifdef ZTS @@ -1000,6 +1015,9 @@ int php_enable_output_compression(int buffer_size TSRMLS_DC) php_start_ob_buffer(NULL, buffer_size, 0 TSRMLS_CC); php_ob_set_internal_handler(php_gzip_output_handler, buffer_size*1.5, "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); + } return SUCCESS; } /* }}} */ |