Make WordPress Core

Ticket #18525: 18525.4.diff

File 18525.4.diff, 3.0 KB (added by kurtpayne, 13 years ago)

Using an HTML comment with null bytes for padding

  • wp-includes/functions.php

     
    32753275 * Flush all output buffers for PHP 5.2.
    32763276 *
    32773277 * Make sure all output buffers are flushed before our singletons our destroyed.
    3278  *
     3278 * Only use $disable_compression for pages that need to be updated continuously, like updating the core,
     3279 * or installing plugins, etc.
     3280 *
     3281 * Turn off compression - make sure to flush the buffer BEFORE
     3282 * turning off compression, see comment from Sam Yong
     3283 * @link http://php.net/manual/en/function.ob-end-clean.php
     3284 *
     3285 * Turn off mod_deflate
     3286 * @link http://httpd.apache.org/docs/2.2/env.html#no-gzip
     3287 *
     3288 * For a more detailed explanation of this function, see
     3289 * @link http://core.trac.wordpress.org/ticket/18525
     3290 *
     3291 * @param bool $disable_compression Turn off zlib / gzip compression, attempt to defeat chunking.
     3292 * @return void
    32793293 * @since 2.2.0
    32803294 */
    3281 function wp_ob_end_flush_all() {
    3282         $levels = ob_get_level();
    3283         for ($i=0; $i<$levels; $i++)
    3284                 ob_end_flush();
     3295function wp_ob_end_flush_all($disable_compression = false) {
     3296
     3297    // Clean the output buffer
     3298    $levels = ob_get_level();
     3299    for ($i=0; $i<$levels; $i++)
     3300        ob_end_flush();
     3301
     3302    if ( $disable_compression ) {
     3303        if ( !headers_sent() && ini_get('zlib.output_handler') ) {
     3304                ini_set('zlib.output_handler', '');
     3305                ini_set('zlib.output_compression', 0);
     3306        }
     3307
     3308        // Tell apache to send an uncompressed non-chunked response
     3309        if ( function_exists('apache_setenv') ) {
     3310                apache_setenv( 'no-gzip', '1' );
     3311        }
     3312
     3313        // Turn off any default output handlers
     3314        ini_set('output_handler', '');
     3315        ini_set('output_buffering', false);
     3316        ini_set('implicit_flush', true);
     3317
     3318        // Pad the output by a 4K block to ensure that the server / browser
     3319        // considers the output sufficient
     3320        echo '<!--' . str_repeat(chr(0), 4089) . '-->'; // 4096 bytes
     3321        flush();
     3322    }
    32853323}
    32863324
    32873325/**
  • wp-admin/includes/misc.php

    Property changes on: wp-content/plugins
    ___________________________________________________________________
    Added: svn:ignore
       + .hello.php.swp
    
    
     
    271271                        $message = $message->get_error_message();
    272272        }
    273273        echo "<p>$message</p>\n";
    274         wp_ob_end_flush_all();
    275         flush();
     274        wp_ob_end_flush_all(true);
    276275}
    277276
    278277function wp_doc_link_parse( $content ) {
  • wp-admin/includes/class-wp-upgrader.php

     
    12391239        }
    12401240
    12411241        function flush_output() {
    1242                 wp_ob_end_flush_all();
    1243                 flush();
     1242                wp_ob_end_flush_all(true);
    12441243        }
    12451244}
    12461245