Revert 60864: "Use wfClientAcceptsGzip() in wfGzipHandler." Causes PHP Notice: Undefined index: HTTP_ACCEPT_ENCODING in GlobalFunctions.php on line 1175

This commit is contained in:
Siebrand Mazeland 2010-01-09 19:14:43 +00:00
parent 29e47fa366
commit 7c27e42fb8
3 changed files with 24 additions and 22 deletions

View file

@ -19,7 +19,6 @@ Those wishing to use the latest code instead of a branch release can obtain
it from source control: http://www.mediawiki.org/wiki/Download_from_SVN it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
=== Configuration changes in 1.16 === === Configuration changes in 1.16 ===
* (bug 18222) $wgMinimalPasswordLength default is now 1 * (bug 18222) $wgMinimalPasswordLength default is now 1
* $wgSessionHandler can be used to configure session.save_handler * $wgSessionHandler can be used to configure session.save_handler
* $wgLocalFileRepo/$wgForeignFileRepos now have a 'fileMode' parameter to * $wgLocalFileRepo/$wgForeignFileRepos now have a 'fileMode' parameter to
@ -694,8 +693,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
* (bug 2658) Don't attempt to set the TZ environment variable. * (bug 2658) Don't attempt to set the TZ environment variable.
* (bug 9794) User rights log entries for foreign user now links to the foreign * (bug 9794) User rights log entries for foreign user now links to the foreign
user's page if possible user's page if possible
* (bug 22034) Use wfClientAcceptsGzip() in wfGzipHandler instead of
reimplementing it.
== API changes in 1.16 == == API changes in 1.16 ==

View file

@ -1168,6 +1168,7 @@ function wfNumLink( $offset, $limit, $title, $query = '' ) {
*/ */
function wfClientAcceptsGzip() { function wfClientAcceptsGzip() {
global $wgUseGzip; global $wgUseGzip;
if( $wgUseGzip ) {
# FIXME: we may want to blacklist some broken browsers # FIXME: we may want to blacklist some broken browsers
$m = array(); $m = array();
if( preg_match( if( preg_match(
@ -1178,6 +1179,7 @@ function wfClientAcceptsGzip() {
wfDebug( " accepts gzip\n" ); wfDebug( " accepts gzip\n" );
return true; return true;
} }
}
return false; return false;
} }

View file

@ -74,10 +74,13 @@ function wfGzipHandler( $s ) {
return $s; return $s;
} }
if( wfClientAcceptsGzip() ) { if( isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) {
$tokens = preg_split( '/[,; ]/', $_SERVER['HTTP_ACCEPT_ENCODING'] );
if ( in_array( 'gzip', $tokens ) ) {
header( 'Content-Encoding: gzip' ); header( 'Content-Encoding: gzip' );
$s = gzencode( $s, 6 ); $s = gzencode( $s, 6 );
} }
}
// Set vary header if it hasn't been set already // Set vary header if it hasn't been set already
$headers = headers_list(); $headers = headers_list();