Index: wp-admin/includes/class-wp-upgrader.php =================================================================== --- wp-admin/includes/class-wp-upgrader.php (revision 18877) +++ wp-admin/includes/class-wp-upgrader.php (working copy) @@ -1239,8 +1239,7 @@ } function flush_output() { - wp_ob_end_flush_all(); - flush(); + wp_ob_end_flush_all(true); } } Index: wp-admin/includes/misc.php =================================================================== --- wp-admin/includes/misc.php (revision 18877) +++ wp-admin/includes/misc.php (working copy) @@ -271,8 +271,7 @@ $message = $message->get_error_message(); } echo "
$message
\n"; - wp_ob_end_flush_all(); - flush(); + wp_ob_end_flush_all(true); } function wp_doc_link_parse( $content ) { Index: wp-includes/functions.php =================================================================== --- wp-includes/functions.php (revision 18877) +++ wp-includes/functions.php (working copy) @@ -3274,13 +3274,48 @@ * Flush all output buffers for PHP 5.2. * * Make sure all output buffers are flushed before our singletons our destroyed. - * + * Only use $disable_compression for pages that need to be updated continuously, like updating the core, + * or installing plugins, etc. + * @param bool $disable_compression Turn off zlib / gzip compression, attempt to defeat chunking. + * @return void * @since 2.2.0 */ -function wp_ob_end_flush_all() { - $levels = ob_get_level(); - for ($i=0; $i<$levels; $i++) - ob_end_flush(); +function wp_ob_end_flush_all($disable_compression = false) { + + // Clean the output buffer + while ( @ob_get_flush() ); + + if ( $disable_compression ) { + /** + * Turn off compression - make sure to flush the buffer BEFORE + * turning off compression, see comment from Sam Yong + * @link http://php.net/manual/en/function.ob-end-clean.php + */ + if ( !headers_sent() && ini_get('zlib.output_handler') ) { + ini_set('zlib.output_handler', ''); + ini_set('zlib.output_compression', 0); + } + + // Tell apache to send an uncompressed non-chunked response + if ( function_exists('apache_setenv') ) { + + /** + * Turn off mod_deflate + * @link http://httpd.apache.org/docs/2.2/env.html#no-gzip + */ + apache_setenv( 'no-gzip', '1' ); + } + + // Turn off any default output handlers + ini_set('output_handler', ''); + ini_set('output_buffering', false); + ini_set('implicit_flush', true); + + // Pad the output by a 4K block just to make sure that whatever apache/php + // considers a "chunk" is sent + echo str_repeat(chr(0), 4096); + flush(); + } } /**