|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #51579 ob_gzhandler/header("304") incompatibility
Submitted: 2010-04-17 01:22 UTC Modified: 2013-10-15 11:54 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: boris at povolnam dot ru Assigned: mike (profile)
Status: No Feedback Package: Unknown/Other Function
PHP Version: 5.2.13 OS: irrelevant
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-04-17 01:22 UTC] boris at povolnam dot ru
test script below will produce a response with not empty body (it will contain gzip stream header) which breaks the W3C standart that requires 304 response to have empty body.

The idea was to speed up things with compression and leveraging client side caching, but end up firefox (v.3.6.3) prepending with that body some of conseqent responces (css file in my case, which broken styles rendering - that was really really hard to find - i just coudn't understand why my server returns corrupted file and only to firefox)

Test script:
header('HTTP/1.1 304 Not Modified');

Expected result:
ob_gzhandler() to look into response headers and wipe out buffer and disable compression if 304 is set. Cause it's a subtle thing about 304 header, its body and the way ob_gzhandler() works and others can run into same problem while trying to speed up website as compression and client-side caching are 2 main things to do.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-10 16:36 UTC] roan dot kattouw at gmail dot com
Clarification: the HTTP spec requires 304 responses be empty, and Firefox is very particular about that. But ob_gzhandler gzips even empty responses, and gzipping the empty string does not return the empty string (GZIP header, at least).

Proposed solution: if there was no output (empty buffer), do not compress and do not send Content-Encoding:gzip
 [2013-09-27 08:31 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: mike
 [2013-09-27 08:31 UTC]
Please try a newer PHP version, though, usually, your web server should prevent sending a body with 304 responses.
 [2013-10-15 11:54 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 12 18:01:31 2024 UTC