version 1.1.1.2, 2012/05/29 12:34:37
|
version 1.1.1.3, 2013/07/22 01:32:11
|
Line 2
|
Line 2
|
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| PHP Version 5 | |
| PHP Version 5 | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Copyright (c) 1997-2012 The PHP Group | | | Copyright (c) 1997-2013 The PHP Group | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| This source file is subject to version 3.01 of the PHP license, | |
| This source file is subject to version 3.01 of the PHP license, | |
| that is bundled with this package in the file LICENSE, and is | |
| that is bundled with this package in the file LICENSE, and is | |
Line 187 static int php_zlib_output_handler(void **handler_cont
|
Line 187 static int php_zlib_output_handler(void **handler_cont
|
-Vary: $ HTTP_ACCEPT_ENCODING=gzip ./sapi/cgi/php <<<'<?php ob_start("ob_gzhandler"); echo "foo\n"; ob_end_clean();' |
-Vary: $ HTTP_ACCEPT_ENCODING=gzip ./sapi/cgi/php <<<'<?php ob_start("ob_gzhandler"); echo "foo\n"; ob_end_clean();' |
-Vary: $ HTTP_ACCEPT_ENCODING= ./sapi/cgi/php <<<'<?php ob_start("ob_gzhandler"); echo "foo\n"; ob_end_clean();' |
-Vary: $ HTTP_ACCEPT_ENCODING= ./sapi/cgi/php <<<'<?php ob_start("ob_gzhandler"); echo "foo\n"; ob_end_clean();' |
*/ |
*/ |
if (output_context->op != (PHP_OUTPUT_HANDLER_START|PHP_OUTPUT_HANDLER_CLEAN|PHP_OUTPUT_HANDLER_FINAL)) { | if ((output_context->op & PHP_OUTPUT_HANDLER_START) |
| && (output_context->op != (PHP_OUTPUT_HANDLER_START|PHP_OUTPUT_HANDLER_CLEAN|PHP_OUTPUT_HANDLER_FINAL)) |
| ) { |
sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC); |
sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC); |
} |
} |
return FAILURE; |
return FAILURE; |
Line 261 static php_output_handler *php_zlib_output_handler_ini
|
Line 263 static php_output_handler *php_zlib_output_handler_ini
|
ZLIBG(output_compression) = chunk_size ? chunk_size : PHP_OUTPUT_HANDLER_DEFAULT_SIZE; |
ZLIBG(output_compression) = chunk_size ? chunk_size : PHP_OUTPUT_HANDLER_DEFAULT_SIZE; |
} |
} |
|
|
|
ZLIBG(handler_registered) = 1; |
|
|
if ((h = php_output_handler_create_internal(handler_name, handler_name_len, php_zlib_output_handler, chunk_size, flags TSRMLS_CC))) { |
if ((h = php_output_handler_create_internal(handler_name, handler_name_len, php_zlib_output_handler, chunk_size, flags TSRMLS_CC))) { |
php_output_handler_set_context(h, php_zlib_output_handler_context_init(TSRMLS_C), php_zlib_output_handler_context_dtor TSRMLS_CC); |
php_output_handler_set_context(h, php_zlib_output_handler_context_init(TSRMLS_C), php_zlib_output_handler_context_dtor TSRMLS_CC); |
} |
} |
Line 282 static void php_zlib_output_compression_start(TSRMLS_D
|
Line 286 static void php_zlib_output_compression_start(TSRMLS_D
|
ZLIBG(output_compression) = PHP_OUTPUT_HANDLER_DEFAULT_SIZE; |
ZLIBG(output_compression) = PHP_OUTPUT_HANDLER_DEFAULT_SIZE; |
/* break omitted intentionally */ |
/* break omitted intentionally */ |
default: |
default: |
if ( (h = php_zlib_output_handler_init(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME), ZLIBG(output_compression), PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC)) && | if ( php_zlib_output_encoding(TSRMLS_C) && |
| (h = php_zlib_output_handler_init(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME), ZLIBG(output_compression), PHP_OUTPUT_HANDLER_STDFLAGS TSRMLS_CC)) && |
(SUCCESS == php_output_handler_start(h TSRMLS_CC))) { |
(SUCCESS == php_output_handler_start(h TSRMLS_CC))) { |
if (ZLIBG(output_handler) && *ZLIBG(output_handler)) { |
if (ZLIBG(output_handler) && *ZLIBG(output_handler)) { |
MAKE_STD_ZVAL(zoh); |
MAKE_STD_ZVAL(zoh); |
Line 687 PHP_ZLIB_ENCODE_FUNC(zlib_encode, 0);
|
Line 692 PHP_ZLIB_ENCODE_FUNC(zlib_encode, 0);
|
/* {{{ proto binary zlib_decode(binary data[, int max_decoded_len]) |
/* {{{ proto binary zlib_decode(binary data[, int max_decoded_len]) |
Uncompress any raw/gzip/zlib encoded data */ |
Uncompress any raw/gzip/zlib encoded data */ |
PHP_ZLIB_DECODE_FUNC(zlib_decode, PHP_ZLIB_ENCODING_ANY); |
PHP_ZLIB_DECODE_FUNC(zlib_decode, PHP_ZLIB_ENCODING_ANY); |
|
/* }}} */ |
|
|
/* NOTE: The naming of these userland functions was quite unlucky */ |
/* NOTE: The naming of these userland functions was quite unlucky */ |
/* {{{ proto binary gzdeflate(binary data[, int level = -1[, int encoding = ZLIB_ENCODING_RAW]) |
/* {{{ proto binary gzdeflate(binary data[, int level = -1[, int encoding = ZLIB_ENCODING_RAW]) |
Line 698 PHP_ZLIB_ENCODE_FUNC(gzdeflate, PHP_ZLIB_ENCODING_RAW)
|
Line 704 PHP_ZLIB_ENCODE_FUNC(gzdeflate, PHP_ZLIB_ENCODING_RAW)
|
Encode data with the gzip encoding */ |
Encode data with the gzip encoding */ |
PHP_ZLIB_ENCODE_FUNC(gzencode, PHP_ZLIB_ENCODING_GZIP); |
PHP_ZLIB_ENCODE_FUNC(gzencode, PHP_ZLIB_ENCODING_GZIP); |
/* }}} */ |
/* }}} */ |
|
|
/* {{{ proto binary gzcompress(binary data[, int level = -1[, int encoding = ZLIB_ENCODING_DEFLATE]) |
/* {{{ proto binary gzcompress(binary data[, int level = -1[, int encoding = ZLIB_ENCODING_DEFLATE]) |
Encode data with the zlib encoding */ |
Encode data with the zlib encoding */ |
PHP_ZLIB_ENCODE_FUNC(gzcompress, PHP_ZLIB_ENCODING_DEFLATE); |
PHP_ZLIB_ENCODE_FUNC(gzcompress, PHP_ZLIB_ENCODING_DEFLATE); |
/* }}} */ |
/* }}} */ |
|
|
/* {{{ proto binary gzinflate(binary data[, int max_decoded_len]) |
/* {{{ proto binary gzinflate(binary data[, int max_decoded_len]) |
Decode raw deflate encoded data */ |
Decode raw deflate encoded data */ |
PHP_ZLIB_DECODE_FUNC(gzinflate, PHP_ZLIB_ENCODING_RAW); |
PHP_ZLIB_DECODE_FUNC(gzinflate, PHP_ZLIB_ENCODING_RAW); |
/* }}} */ |
/* }}} */ |
|
|
/* {{{ proto binary gzdecode(binary data[, int max_decoded_len]) |
/* {{{ proto binary gzdecode(binary data[, int max_decoded_len]) |
Decode gzip encoded data */ |
Decode gzip encoded data */ |
PHP_ZLIB_DECODE_FUNC(gzdecode, PHP_ZLIB_ENCODING_GZIP); |
PHP_ZLIB_DECODE_FUNC(gzdecode, PHP_ZLIB_ENCODING_GZIP); |
/* }}} */ |
/* }}} */ |
|
|
/* {{{ proto binary gzuncompress(binary data[, int max_decoded_len]) |
/* {{{ proto binary gzuncompress(binary data[, int max_decoded_len]) |
Decode zlib encoded data */ |
Decode zlib encoded data */ |
PHP_ZLIB_DECODE_FUNC(gzuncompress, PHP_ZLIB_ENCODING_DEFLATE); |
PHP_ZLIB_DECODE_FUNC(gzuncompress, PHP_ZLIB_ENCODING_DEFLATE); |
Line 882 static PHP_INI_MH(OnUpdate_zlib_output_compression)
|
Line 892 static PHP_INI_MH(OnUpdate_zlib_output_compression)
|
if (status & PHP_OUTPUT_SENT) { |
if (status & PHP_OUTPUT_SENT) { |
php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "Cannot change zlib.output_compression - headers already sent"); |
php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "Cannot change zlib.output_compression - headers already sent"); |
return FAILURE; |
return FAILURE; |
} else if ((status & PHP_OUTPUT_WRITTEN) && int_value) { |
|
php_error_docref("ref.outcontrol" TSRMLS_CC, E_WARNING, "Cannot enable zlib.output_compression - there has already been output"); |
|
return FAILURE; |
|
} |
} |
} |
} |
|
|
status = OnUpdateLong(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); |
status = OnUpdateLong(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); |
|
|
|
ZLIBG(output_compression) = ZLIBG(output_compression_default); |
if (stage == PHP_INI_STAGE_RUNTIME && int_value) { |
if (stage == PHP_INI_STAGE_RUNTIME && int_value) { |
if (!php_output_handler_started(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME) TSRMLS_CC)) { |
if (!php_output_handler_started(ZEND_STRL(PHP_ZLIB_OUTPUT_HANDLER_NAME) TSRMLS_CC)) { |
php_zlib_output_compression_start(TSRMLS_C); |
php_zlib_output_compression_start(TSRMLS_C); |
Line 914 static PHP_INI_MH(OnUpdate_zlib_output_handler)
|
Line 922 static PHP_INI_MH(OnUpdate_zlib_output_handler)
|
|
|
/* {{{ INI */ |
/* {{{ INI */ |
PHP_INI_BEGIN() |
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_default, zend_zlib_globals, zlib_globals) |
STD_PHP_INI_ENTRY("zlib.output_compression_level", "-1", PHP_INI_ALL, OnUpdateLong, output_compression_level, zend_zlib_globals, zlib_globals) |
STD_PHP_INI_ENTRY("zlib.output_compression_level", "-1", PHP_INI_ALL, OnUpdateLong, 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() |
PHP_INI_END() |
Line 958 static PHP_MSHUTDOWN_FUNCTION(zlib)
|
Line 966 static PHP_MSHUTDOWN_FUNCTION(zlib)
|
static PHP_RINIT_FUNCTION(zlib) |
static PHP_RINIT_FUNCTION(zlib) |
{ |
{ |
ZLIBG(compression_coding) = 0; |
ZLIBG(compression_coding) = 0; |
|
if (!ZLIBG(handler_registered)) { |
|
ZLIBG(output_compression) = ZLIBG(output_compression_default); |
|
php_zlib_output_compression_start(TSRMLS_C); |
|
} |
|
|
php_zlib_output_compression_start(TSRMLS_C); |
|
|
|
return SUCCESS; |
return SUCCESS; |
} |
} |
/* }}} */ |
/* }}} */ |
|
|
|
/* {{{ PHP_RSHUTDOWN_FUNCTION */ |
static PHP_RSHUTDOWN_FUNCTION(zlib) |
static PHP_RSHUTDOWN_FUNCTION(zlib) |
{ |
{ |
ZLIBG(output_compression) = 0; |
|
php_zlib_cleanup_ob_gzhandler_mess(TSRMLS_C); |
php_zlib_cleanup_ob_gzhandler_mess(TSRMLS_C); |
|
ZLIBG(handler_registered) = 0; |
|
|
return SUCCESS; |
return SUCCESS; |
} |
} |
|
/* }}} */ |
|
|
/* {{{ PHP_MINFO_FUNCTION */ |
/* {{{ PHP_MINFO_FUNCTION */ |
static PHP_MINFO_FUNCTION(zlib) |
static PHP_MINFO_FUNCTION(zlib) |
Line 992 static PHP_MINFO_FUNCTION(zlib)
|
Line 1004 static PHP_MINFO_FUNCTION(zlib)
|
static ZEND_MODULE_GLOBALS_CTOR_D(zlib) |
static ZEND_MODULE_GLOBALS_CTOR_D(zlib) |
{ |
{ |
zlib_globals->ob_gzhandler = NULL; |
zlib_globals->ob_gzhandler = NULL; |
|
zlib_globals->handler_registered = 0; |
} |
} |
/* }}} */ |
/* }}} */ |
|
|