summaryrefslogtreecommitdiff
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
commit82ff467d8368e84b5f100f5eca6384dbcfd51dee (patch)
tree54073bc7e5d102ade6ae421fe2e0988786323af0
parentcf711f6ee86d8a1e641e9f25aca07765281d2799 (diff)
downloadphp-git-82ff467d8368e84b5f100f5eca6384dbcfd51dee.tar.gz
Fixed bug #51269 (zlib.output_compression Overwrites Vary Header).
-rw-r--r--ext/zlib/tests/bug51269.phpt21
-rw-r--r--ext/zlib/zlib.c4
2 files changed, 23 insertions, 2 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 e46c9ca049..a7e97952d6 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -102,7 +102,7 @@ static int php_zlib_output_handler(void **handler_context, php_output_context *o
-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)) {
- 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);
}
return FAILURE;
}
@@ -196,7 +196,7 @@ static int php_zlib_output_handler(void **handler_context, php_output_context *o
deflateEnd(&ctx->Z);
return FAILURE;
}
- 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);
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC);
}