* Further fix to Special:Export etc; instead of trying to suppress those
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 20 Feb 2007 04:46:07 +0000 (04:46 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 20 Feb 2007 04:46:07 +0000 (04:46 +0000)
  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
includes/OutputHandler.php

index e9051f9..619a373 100644 (file)
@@ -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:' );
-                       }
                }
        }
 }
index d25ae0d..9272b19 100644 (file)
@@ -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' ) ) {