]> granicus.if.org Git - php/commitdiff
Fixed bug #51269 (zlib.output_compression Overwrites Vary Header).
authorAdam Harvey <aharvey@php.net>
Thu, 11 Mar 2010 06:20:22 +0000 (06:20 +0000)
committerAdam Harvey <aharvey@php.net>
Thu, 11 Mar 2010 06:20:22 +0000 (06:20 +0000)
NEWS
ext/zlib/tests/bug51269.phpt [new file with mode: 0644]
ext/zlib/zlib.c

diff --git a/NEWS b/NEWS
index e1f3bc1c86ddfbb994be41c67fc3d50a745fab6f..f11fd95af04133bd6489de766a6918eae5979b67 100644 (file)
--- 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 (file)
index 0000000..6b97bac
--- /dev/null
@@ -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
index 448e5b2fc8dcc239b05f0b6be4666eb29ea67a4d..f11aa9b56181dab1fb1447a572a122142b22bded 100644 (file)
@@ -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;