r60864 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60863‎ | r60864 | r60865 >
Date:18:10, 9 January 2010
Author:siebrand
Status:reverted (Comments)
Tags:
Comment:
(bug 22034) Use wfClientAcceptsGzip() in wfGzipHandler. Patch by Platonides.

wfGzipHandler should use wfClientAcceptsGzip() instead of reimplementing it. Patch does this and removes the $wgUseGzip check on wfClientAcceptsGzip() since HTMLFileCache (the only wfClientAcceptsGzip() user) already checked that before calling it. This way $wgUseGzip stays applying only for file cache, and $wgDisableOutputCompression for output handler.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/OutputHandler.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -1168,17 +1168,15 @@
11691169 */
11701170 function wfClientAcceptsGzip() {
11711171 global $wgUseGzip;
1172 - if( $wgUseGzip ) {
1173 - # FIXME: we may want to blacklist some broken browsers
1174 - $m = array();
1175 - if( preg_match(
1176 - '/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/',
1177 - $_SERVER['HTTP_ACCEPT_ENCODING'],
1178 - $m ) ) {
1179 - if( isset( $m[2] ) && ( $m[1] == 'q' ) && ( $m[2] == 0 ) ) return false;
1180 - wfDebug( " accepts gzip\n" );
1181 - return true;
1182 - }
 1172+ # FIXME: we may want to blacklist some broken browsers
 1173+ $m = array();
 1174+ if( preg_match(
 1175+ '/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/',
 1176+ $_SERVER['HTTP_ACCEPT_ENCODING'],
 1177+ $m ) ) {
 1178+ if( isset( $m[2] ) && ( $m[1] == 'q' ) && ( $m[2] == 0 ) ) return false;
 1179+ wfDebug( " accepts gzip\n" );
 1180+ return true;
11831181 }
11841182 return false;
11851183 }
Index: trunk/phase3/includes/OutputHandler.php
@@ -74,12 +74,9 @@
7575 return $s;
7676 }
7777
78 - if( isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) {
79 - $tokens = preg_split( '/[,; ]/', $_SERVER['HTTP_ACCEPT_ENCODING'] );
80 - if ( in_array( 'gzip', $tokens ) ) {
81 - header( 'Content-Encoding: gzip' );
82 - $s = gzencode( $s, 6 );
83 - }
 78+ if( wfClientAcceptsGzip() ) {
 79+ header( 'Content-Encoding: gzip' );
 80+ $s = gzencode( $s, 6 );
8481 }
8582
8683 // Set vary header if it hasn't been set already
Index: trunk/phase3/RELEASE-NOTES
@@ -19,6 +19,7 @@
2020 it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
2121
2222 === Configuration changes in 1.16 ===
 23+
2324 * (bug 18222) $wgMinimalPasswordLength default is now 1
2425 * $wgSessionHandler can be used to configure session.save_handler
2526 * $wgLocalFileRepo/$wgForeignFileRepos now have a 'fileMode' parameter to
@@ -81,12 +82,12 @@
8283 similarly to the category namespace.
8384 * $wgEnableSorbs renamed to $wgDnsBlacklistUrls ($wgEnableSorbs kept for
8485 backward compatibility)
85 -* $wgUploadNavigationUrl now also affects images inline images that do not
86 - exist. In that case the URL will get (?|&)wpDestFile=<filename> appended to
 86+* $wgUploadNavigationUrl now also affects images inline images that do not
 87+ exist. In that case the URL will get (?|&)wpDestFile=<filename> appended to
8788 it as appropriate.
8889 * If $wgLocaltimezone is null, use the server's timezone as the default for
8990 signatures. This was always the behaviour documented in DefaultSettings.php
90 - but has not been the actual behaviour for some time: instead, UTC was used
 91+ but has not been the actual behaviour for some time: instead, UTC was used
9192 by default.
9293
9394
@@ -659,10 +660,10 @@
660661 only displayed to the users that have "editinterface" right
661662 * (bug 21740) Attempting to protect a page that doesn't exist (salting) returns
662663 "unknown error"
663 -* (bug 18762) both redirects and links get fixed one after another if
 664+* (bug 18762) both redirects and links get fixed one after another if
664665 redirects-only switch is not present
665666 * (bug 20159) thumbnails rerendered if older that $wgThumbnailEpoch
666 -* Fixed a bug which in some situations causes the job queue to grow forever,
 667+* Fixed a bug which in some situations causes the job queue to grow forever,
667668 due to an infinite loop of job requeues.
668669 * (bug 21523) File that can have multiple pages (djvu, pdf, ...) no longer have
669670 the page selector when they have only one page
@@ -693,6 +694,8 @@
694695 * (bug 2658) Don't attempt to set the TZ environment variable.
695696 * (bug 9794) User rights log entries for foreign user now links to the foreign
696697 user's page if possible
 698+* (bug 22034) Use wfClientAcceptsGzip() in wfGzipHandler instead of
 699+ reimplementing it.
697700
698701 == API changes in 1.16 ==
699702
@@ -763,8 +766,8 @@
764767 * (bug 21441) meta=userinfo&uiprop=options no longer returns default options
765768 for logged-in users under certain circumstances
766769 * (bug 21945) Add chomp control in YAML
767 -* Expand the thumburl to an absolute url to make it consistent with url and
768 - descriptionurl
 770+* Expand the thumburl to an absolute url to make it consistent with url and
 771+ descriptionurl
769772 * (bug 20233) ApiLogin::execute() doesn't handle LoginForm :: RESET_PASS
770773
771774 === Languages updated in 1.16 ===

Follow-up revisions

RevisionCommit summaryAuthorDate
r61054(bug 22034) use wfClientAcceptsGzip() in wfGzipHandler instead of reimplement...platonides16:35, 14 January 2010

Comments

#Comment by Tim Starling (talk | contribs)   06:30, 21 January 2010

Self-reverted in r60871.

Status & tagging log