php.net |  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
Votes:2
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: boris at povolnam dot ru
New email:
PHP Version: OS:

 

 [2010-04-17 01:22 UTC] boris at povolnam dot ru
Description:
------------
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:
---------------
<?php
ob_start("ob_gzhandler");
header('HTTP/1.1 304 Not Modified');
ob_end_flush();
?>

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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] mike@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: mike
 [2013-09-27 08:31 UTC] mike@php.net
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 Mar 29 14:01:28 2024 UTC