php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51269 zlib.output_compression Overwrites Vary Header
Submitted: 2010-03-11 02:17 UTC Modified: 2010-03-11 07:22 UTC
From: rcumming at ea dot com Assigned: aharvey
Status: Closed Package: Zlib related
PHP Version: 5.3.2 OS: Linux
Private report: No CVE-ID:
 [2010-03-11 02:17 UTC] rcumming at ea dot com
Description:
------------
We have an application which requires Vary: Cookie for its caching scheme to work correctly. It's using the header() function to set the header during the request. With PHP 5.2.9/Apache requesting a page with both Accept-Encoding: gzip and without will correctly append Accept-Encoding to the Vary:

--
HEAD / HTTP/1.1
Host: www.easports.com
        
HTTP/1.1 200 OK
Date: Thu, 11 Mar 2010 01:06:33 GMT
Vary: Cookie,Accept-Encoding
--

--
HEAD / HTTP/1.1
Host: www.easports.com
Accept-Encoding: gzip

HTTP/1.1 200 OK
Date: Thu, 11 Mar 2010 01:07:37 GMT
Vary: Cookie,Accept-Encoding
Content-Encoding: gzip
--

With PHP 5.3.2 the Vary header is overwritten when the content is served as gzip:

---
HEAD / HTTP/1.1
Host: devsonet.dev.easports.ea.com

HTTP/1.1 200 OK
Date: Thu, 11 Mar 2010 01:10:00 GMT
Vary: Cookie,Accept-Encoding
--

--
HEAD / HTTP/1.1
Host: devsonet.dev.easports.ea.com
Accept-Encoding: gzip

HTTP/1.1 200 OK
Date: Thu, 11 Mar 2010 01:10:53 GMT
Vary: Accept-Encoding
Content-Encoding: gzip
--

The attached diff will make the application work as expected. This was based on reverting a chunk that had changed between PHP 5.2.9 and PHP 5.2.13. This diff was clearly put in there to fix another bug so it's *not* intended to be applied; it's just for demonstration purposes 



Patches

workaround-vary-header-revert (last revision 2010-03-11 01:18 UTC) by rcumming at ea dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-03-11 06:26 UTC] aharvey@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: aharvey
 [2010-03-11 07:20 UTC] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=296060
Log: Fixed bug #51269 (zlib.output_compression Overwrites Vary Header).
 [2010-03-11 07:22 UTC] aharvey@php.net
-Status: Assigned +Status: Closed
 [2010-03-11 07:22 UTC] aharvey@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sun Apr 20 19:01:51 2014 UTC