From 9d5144517adef8400dc65b00aa04266e74259cbe Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 13 Jun 2006 20:22:08 +0000 Subject: [PATCH] Cancel output buffering in StreamFile; when used inside gzip buffering this could cause funny timeout behavior as the Content-Length was wrong. --- RELEASE-NOTES | 2 ++ includes/StreamFile.php | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0d2f9f2d35..0b003da7f9 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -487,6 +487,8 @@ Some default configuration options have changed: * (bug 5932) Introduce {{PAGESINNAMESPACE}} magic word * Disable $wgAllowExternalImages by default. * (bug 2700) Nice things like link completion and signatures now work in tags. +* Cancel output buffering in StreamFile; when used inside gzip buffering this + could cause funny timeout behavior as the Content-Length was wrong. == Compatibility == diff --git a/includes/StreamFile.php b/includes/StreamFile.php index ce7650a674..4b659deac2 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -16,6 +16,14 @@ does not.

header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s', $stat['mtime'] ) . ' GMT' ); + // Cancel output buffering and gzipping if set + while( $status = ob_get_status() ) { + ob_end_clean(); + if( $status['name'] == 'ob_gzhandler' ) { + header( 'Content-Encoding: identity' ); + } + } + if ( !empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) { $modsince = preg_replace( '/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); $sinceTime = strtotime( $modsince ); -- 2.20.1