From 62ef8829fb90819acab746ea06f73417a1a14edc Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 20 Feb 2007 04:46:07 +0000 Subject: [PATCH] * Further fix to Special:Export etc; instead of trying to suppress those Content-Encoding and Content-Length headers, just don't send them in the first place! * Suppress Content-Length from wfOutputHandler if $wgDisableOutputCompression set * Fix typo that caused $wgDisableOutputCompression to *enable* instead of *disable* compression ;) --- includes/GlobalFunctions.php | 11 ++++++----- includes/OutputHandler.php | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index e9051f9e92..619a3731f3 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1114,6 +1114,12 @@ function wfHttpError( $code, $label, $desc ) { * @parameter bool $resetGzipEncoding */ function wfResetOutputBuffers( $resetGzipEncoding=true ) { + if( $resetGzipEncoding ) { + // Suppress Content-Encoding and Content-Length + // headers from 1.10+s wfOutputHandler + global $wgDisableOutputCompression; + $wgDisableOutputCompression = true; + } while( $status = ob_get_status() ) { if( $status['type'] == 0 /* PHP_OUTPUT_HANDLER_INTERNAL */ ) { // Probably from zlib.output_compression or other @@ -1134,11 +1140,6 @@ function wfResetOutputBuffers( $resetGzipEncoding=true ) { // so we can start fresh. header( 'Content-Encoding:' ); } - if( $status['name'] == 'wfOutputHandler' ) { - // And the custom handler in 1.10+ adds a Content-Length - header( 'Content-Encoding:' ); - header( 'Content-Length:' ); - } } } } diff --git a/includes/OutputHandler.php b/includes/OutputHandler.php index d25ae0d406..9272b19bc5 100644 --- a/includes/OutputHandler.php +++ b/includes/OutputHandler.php @@ -6,8 +6,8 @@ function wfOutputHandler( $s ) { global $wgDisableOutputCompression; $s = wfMangleFlashPolicy( $s ); - if ( !ini_get( 'zlib.output_compression' ) ) { - if ( $wgDisableOutputCompression || !defined( 'MW_NO_OUTPUT_COMPRESSION' ) ) { + if ( !$wgDisableOutputCompression && !ini_get( 'zlib.output_compression' ) ) { + if ( !defined( 'MW_NO_OUTPUT_COMPRESSION' ) ) { $s = wfGzipHandler( $s ); } if ( !ini_get( 'output_handler' ) ) { -- 2.20.1