From 3be951ae898e31479bff7fa076e32a6b1c670e0e Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Thu, 11 Mar 2010 06:20:22 +0000 Subject: [PATCH] Fixed bug #51269 (zlib.output_compression Overwrites Vary Header). --- NEWS | 1 + ext/zlib/tests/bug51269.phpt | 21 +++++++++++++++++++++ ext/zlib/zlib.c | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 ext/zlib/tests/bug51269.phpt diff --git a/NEWS b/NEWS index e1f3bc1c86..f11fd95af0 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ PHP NEWS ?? ??? 2010, PHP 5.2.14 - Updated timezone database to version 2010.3. (Derick) +- Fixed bug #51269 (zlib.output_compression Overwrites Vary Header). (Adam) - Fixed bug #51237 (milter SAPI crash on startup). (igmar at palsenberg dot com) - Fixed bug #51213 (pdo_mssql is trimming value of the money column). (Ilia, alexr at oplot dot com) diff --git a/ext/zlib/tests/bug51269.phpt b/ext/zlib/tests/bug51269.phpt new file mode 100644 index 0000000000..6b97bacf08 --- /dev/null +++ b/ext/zlib/tests/bug51269.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #51269 (zlib.output_compression Overwrites Vary Header) +--INI-- +zlib.output_compression=1 +--ENV-- +HTTP_ACCEPT_ENCODING=gzip +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +%s +--EXPECTHEADERS-- +Vary: Cookie +Content-Encoding: gzip +Vary: Accept-Encoding diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 448e5b2fc8..f11aa9b561 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -1004,7 +1004,7 @@ static void php_gzip_output_handler(char *output, uint output_len, char **handle sapi_add_header_ex(ZEND_STRL("Content-Encoding: deflate"), 1, 1 TSRMLS_CC); break; } - sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC); + sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 0 TSRMLS_CC); } else { /* Disable compression if headers can not be set (Fix for bug #49816) */ ZLIBG(output_compression) = 0; -- 2.50.1