From: Brion Vibber Date: Wed, 18 Mar 2009 21:26:57 +0000 (+0000) Subject: * (bug 17537) Disable bad zlib.output_compression output on HTTP 304 responses X-Git-Tag: 1.31.0-rc.0~42449 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=ae98c49213a8ecfe36a5cc900bec8b1ab9f48f4c;p=lhc%2Fweb%2Fwiklou.git * (bug 17537) Disable bad zlib.output_compression output on HTTP 304 responses Patch by ezyang - http://bug-attachment.wikimedia.org/attachment.cgi?id=5829 --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0e4bace86b..f201be7568 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -277,6 +277,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 11487) Special:Protectedpages doesn't list protections with pr_expiry IS NULL * (bug 18018) Deleting a file redirect leaves behind a malfunctioning redirect +* (bug 17537) Disable bad zlib.output_compression output on HTTP 304 responses == API changes in 1.15 == * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions diff --git a/includes/AjaxResponse.php b/includes/AjaxResponse.php index de6b3c56a4..26b6f44398 100644 --- a/includes/AjaxResponse.php +++ b/includes/AjaxResponse.php @@ -178,6 +178,7 @@ class AjaxResponse { wfDebug( "$fname: -- client send If-Modified-Since: " . $modsince . "\n", false ); wfDebug( "$fname: -- we might send Last-Modified : $lastmod\n", false ); if( ($ismodsince >= $timestamp ) && $wgUser->validateCache( $ismodsince ) && $ismodsince >= $wgCacheEpoch ) { + ini_set('zlib.output_compression', 0); $this->setResponseCode( "304 Not Modified" ); $this->disable(); $this->mLastModified = $lastmod; diff --git a/includes/OutputPage.php b/includes/OutputPage.php index ce350565ae..7fbd77b443 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -233,6 +233,7 @@ class OutputPage { # Not modified # Give a 304 response code and disable body output wfDebug( __METHOD__ . ": NOT MODIFIED, $info\n", false ); + ini_set('zlib.output_compression', 0); $wgRequest->response()->header( "HTTP/1.1 304 Not Modified" ); $this->sendCacheControl(); $this->disable(); diff --git a/includes/StreamFile.php b/includes/StreamFile.php index 4abd73649b..bdd2a2e5fb 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -48,6 +48,7 @@ function wfStreamFile( $fname, $headers = array() ) { $modsince = preg_replace( '/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); $sinceTime = strtotime( $modsince ); if ( $stat['mtime'] <= $sinceTime ) { + ini_set('zlib.output_compression', 0); header( "HTTP/1.0 304 Not Modified" ); return; }