summaryrefslogtreecommitdiff
path: root/ext/zlib
diff options
context:
space:
mode:
authorAdam Harvey <aharvey@php.net>2010-03-11 06:20:22 +0000
committerAdam Harvey <aharvey@php.net>2010-03-11 06:20:22 +0000
commit3be951ae898e31479bff7fa076e32a6b1c670e0e (patch)
tree6fd2d0136d5806bb70e7c0eabb036837555d21ae /ext/zlib
parentc15857413c9769426caa75c2f4ed383b7afbf782 (diff)
downloadphp-git-3be951ae898e31479bff7fa076e32a6b1c670e0e.tar.gz
Fixed bug #51269 (zlib.output_compression Overwrites Vary Header).
Diffstat (limited to 'ext/zlib')
-rw-r--r--ext/zlib/tests/bug51269.phpt21
-rw-r--r--ext/zlib/zlib.c2
2 files changed, 22 insertions, 1 deletions
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--
+<?php
+if (!extension_loaded("zlib")) die("skip zlib required");
+?>
+--FILE--
+<?php
+header('Vary: Cookie');
+echo 'foo';
+?>
+--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;