Ticket #23021: 23021-3.patch

File 23021-3.patch, 2.2 KB (added by azaozz, 5 months ago)
  • wp-includes/class-wp.php

     
    346346                                                || !empty($this->query_vars['attachment_id']) 
    347347                                        ) 
    348348                                ) 
    349                         ) 
     349                        ) { 
    350350                                $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT'; 
    351                         else 
     351                        } else { 
    352352                                $wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT'; 
     353                        } 
    353354                        $wp_etag = '"' . md5($wp_last_modified) . '"'; 
    354355                        $headers['Last-Modified'] = $wp_last_modified; 
    355356                        $headers['ETag'] = $wp_etag; 
    356357 
    357358                        // Support for Conditional GET 
    358                         if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) 
     359                        if ( isset($_SERVER['HTTP_IF_NONE_MATCH']) ) 
    359360                                $client_etag = stripslashes(stripslashes($_SERVER['HTTP_IF_NONE_MATCH'])); 
    360                         else $client_etag = false; 
     361                        else 
     362                                $client_etag = false; 
    361363 
    362364                        $client_last_modified = empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? '' : trim($_SERVER['HTTP_IF_MODIFIED_SINCE']); 
    363365                        // If string is empty, return 0. If not, attempt to parse into a timestamp 
     
    378380 
    379381                if ( ! empty( $status ) ) 
    380382                        status_header( $status ); 
    381                 foreach( (array) $headers as $name => $field_value ) 
     383 
     384                foreach( (array) $headers as $name => $field_value ) { 
    382385                        @header("{$name}: {$field_value}"); 
     386                } 
    383387 
    384                 if ( isset( $headers['Last-Modified'] ) && empty( $headers['Last-Modified'] ) && function_exists( 'header_remove' ) ) 
    385                         @header_remove( 'Last-Modified' ); 
    386  
    387388                if ( $exit_required ) 
    388389                        exit(); 
    389390 
  • wp-includes/functions.php

     
    902902function wp_get_nocache_headers() { 
    903903        $headers = array( 
    904904                'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT', 
    905                 'Last-Modified' => '', 
    906905                'Cache-Control' => 'no-cache, must-revalidate, max-age=0', 
    907906                'Pragma' => 'no-cache', 
    908907        ); 
     
    926925        $headers = wp_get_nocache_headers(); 
    927926        foreach( $headers as $name => $field_value ) 
    928927                @header("{$name}: {$field_value}"); 
    929         if ( empty( $headers['Last-Modified'] ) && function_exists( 'header_remove' ) ) 
    930                 @header_remove( 'Last-Modified' ); 
    931928} 
    932929 
    933930/**