Last modified: 2009-03-18 21:27:13 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T19537, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 17537 - Turn off zlib.output_compression for 304
Turn off zlib.output_compression for 304
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.15.x
All All
: Normal normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-02-17 21:28 UTC by Edward Z. Yang
Modified: 2009-03-18 21:27 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Fixes bug (1.58 KB, patch)
2009-02-17 21:28 UTC, Edward Z. Yang
Details
Fixes bug (1.58 KB, patch)
2009-02-19 01:11 UTC, Edward Z. Yang
Details

Description Edward Z. Yang 2009-02-17 21:28:44 UTC
Created attachment 5824 [details]
Fixes bug

When PHP has zlib.output_compression enabled, it compresses all pages output, regardless of their HTTP status code. Even empty pages get a ~13 byte empty gzipped file tacked as their response. Unfortunately, for HTTP status code 304, this is in direct violation of the specification; furthermore, if SSL and Keep-Alive are enabled, Firefox gets sufficiently confused such as to post a download page for the page immediately after the 304 with extra information afterwards (it mixes up the packets).

I've attached a patch that fixes this bug by manually turning off zlib.output_compression when a 304 is being sent. I am also coordinating with PHP's maintainers to get this fixed upstream.

Relevant links:
https://bugzilla.mozilla.org/show_bug.cgi?id=363109 (bug for Firefox getting confused by data after 304)
http://bugs.php.net/bug.php?id=42362 (bug for PHP not turning of zlib.output_compression when there is empty output)
Comment 1 Brion Vibber 2009-02-17 21:33:09 UTC
I think I've seen problems when the Content-encoding on the 304 doesn't match the cached data before; can you double-check that behavior is still consistent in this behavior mode?
Comment 2 Edward Z. Yang 2009-02-17 22:28:02 UTC
No problems on Firefox, using this test script:

<?php

if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
    ini_set('zlib.output_compression', 0);
    header('HTTP/1.1 304 Not Modified');
    header('Last-Modified: Tue, 17 Feb 2009 22:18:25 GMT');
} else {
    header('Cache-Control=private, s-maxage=0, max-age=0, must-revalidate');
    header('Last-Modified: Tue, 17 Feb 2009 22:18:25 GMT');
    var_dump($_SERVER);
    ?><a href="">asdf</a><?php
}
Comment 3 Edward Z. Yang 2009-02-18 06:57:21 UTC
By request of Brion on IRC, it works fine on IE/Mac. :-)
Comment 4 Edward Z. Yang 2009-02-19 01:11:58 UTC
Created attachment 5829 [details]
Fixes bug

Fix minor typo in patch
Comment 5 Edward Z. Yang 2009-03-15 05:35:11 UTC
Some further research has found it is possible to tickle this bug in Firefox without SSL, but much more difficult.
Comment 6 Brion Vibber 2009-03-18 21:27:13 UTC
Applied in r48540

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links