* @return string
*/
function wfGzipHandler( $s ) {
- if( !function_exists( 'gzencode' ) || headers_sent() ) {
+ if( !function_exists( 'gzencode' ) ) {
+ wfDebug( __FUNCTION__ . "() skipping compression (gzencode unavaible)\n" );
+ return $s;
+ }
+ if( headers_sent() ) {
+ wfDebug( __FUNCTION__ . "() skipping compression (headers already sent)\n" );
return $s;
}
}
if( wfClientAcceptsGzip() ) {
+ wfDebug( __FUNCTION__ . "() is compressing output\n" );
header( 'Content-Encoding: gzip' );
$s = gzencode( $s, 6 );
}
wfDebug( __METHOD__ . "()\n");
$filename = $this->cachePath();
+
$context->getOutput()->sendCacheControl();
header( "Content-Type: $wgMimeType; charset=UTF-8" );
header( "Content-Language: $wgLanguageCode" );
header( 'Content-Encoding: gzip' );
} else {
/* Send uncompressed */
+ wfDebug( __METHOD__ . " uncompressing cache file and sending it\n" );
readgzfile( $filename );
return;
}