From: Michael Wallner Date: Wed, 18 Apr 2007 19:39:12 +0000 (+0000) Subject: - fixed bug #40325 (Vary: header missing in gzip output handlers); no MFH X-Git-Tag: RELEASE_1_2_0~280 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f81c0d4e44aa6e6ed51e06065488d53b707d7280;p=php - fixed bug #40325 (Vary: header missing in gzip output handlers); no MFH [DOC] since PHP 6 a Vary header will be sent without regards to whether the negotiation was successful or not and unless the complete output buffer gets discarded --- diff --git a/NEWS b/NEWS index 4dae024bdf..a1be27f842 100644 --- a/NEWS +++ b/NEWS @@ -61,4 +61,4 @@ PHP NEWS - Added str_getcsv() function. (Sara) - Added ext/hash support to ext/session's ID generator. (Sara) - +- Fixed bug #40325 (Vary: header missing in gzip output handlers). (Mike) diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 5cb700a9ad..392b7a95f4 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -124,6 +124,19 @@ int php_zlib_output_handler(void **handler_context, php_output_context *output_c PHP_OUTPUT_TSRMLS(output_context); if (!php_zlib_output_encoding(TSRMLS_C)) { + /* "Vary: Accept-Encoding" header sent along uncompressed content breaks caching in MSIE, + so let's just send it with successfully compressed content or unless the complete + buffer gets discarded, see http://bugs.php.net/40325; + + Test as follows: + +Vary: $ HTTP_ACCEPT_ENCODING=gzip ./sapi/cgi/php <<<'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); + } return FAILURE; } @@ -218,8 +231,6 @@ int php_zlib_output_handler(void **handler_context, php_output_context *output_c deflateEnd(&ctx->Z); return FAILURE; } - /* "Vary: Accept-Encoding" header sent along uncompressed content breaks caching in MSIE, - so let's just send it with successfully compressed content, see http://bugs.php.net/40325 */ sapi_add_header_ex(ZEND_STRL("Vary: Accept-Encoding"), 1, 1 TSRMLS_CC); php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC); }