From a7a9875535b63bb7bb2266feca61bb3019f48c28 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Thu, 1 Aug 2013 16:33:36 +0200 Subject: [PATCH] resolve bug #44168 remove any previous Content-Length header and retain output compression --- ext/zlib/tests/bug44168.phpt | Bin 0 -> 557 bytes ext/zlib/zlib.c | 4 ++++ main/SAPI.c | 8 -------- 3 files changed, 4 insertions(+), 8 deletions(-) create mode 100644 ext/zlib/tests/bug44168.phpt diff --git a/ext/zlib/tests/bug44168.phpt b/ext/zlib/tests/bug44168.phpt new file mode 100644 index 0000000000000000000000000000000000000000..2438caafb809aa9a0f06b87a7c827fb896e24fa2 GIT binary patch literal 557 zcmZ{hUrOXa5XQwtklq{Yi)Gx04s4XDh^re#V_btW6EG|bx-@Z8Gil6phjhok>z$w)*}{RN zG)#z?Io8(4XTF7v$8<2Z>AiT`W2Dk>(2z!&j` zsI5+vnpin^T8`tokW1u_xs(+s#2iSt(v`N^?hetS-XB7>ZHT=vjFMDDy|8}}_kIVX zJ6Vw;?!~0|q_3c_NRsp?1Lw_nd>iZ); return FAILURE; } + + sapi_header_op(SAPI_HEADER_DELETE, &cl_header); switch (ZLIBG(compression_coding)) { case PHP_ZLIB_ENCODING_GZIP: sapi_add_header_ex(ZEND_STRL("Content-Encoding: gzip"), 1, 1 TSRMLS_CC); diff --git a/main/SAPI.c b/main/SAPI.c index dcb2da629a03b..c737f5ec7cd6e 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -804,14 +804,6 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) } efree(mimetype); SG(sapi_headers).send_default_content_type = 0; - } else if (!STRCASECMP(header_line, "Content-Length")) { - /* Script is setting Content-length. The script cannot reasonably - * know the size of the message body after compression, so it's best - * do disable compression altogether. This contributes to making scripts - * portable between setups that have and don't have zlib compression - * enabled globally. See req #44164 */ - zend_alter_ini_entry("zlib.output_compression", sizeof("zlib.output_compression"), - "0", sizeof("0") - 1, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } else if (!STRCASECMP(header_line, "Location")) { if ((SG(sapi_headers).http_response_code < 300 || SG(sapi_headers).http_response_code > 307) &&