| 1 | Index: wp-includes/functions.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/functions.php (revision 23261) |
|---|
| 4 | +++ wp-includes/functions.php (working copy) |
|---|
| 5 | @@ -902,7 +902,6 @@ |
|---|
| 6 | function wp_get_nocache_headers() { |
|---|
| 7 | $headers = array( |
|---|
| 8 | 'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT', |
|---|
| 9 | - 'Last-Modified' => '', |
|---|
| 10 | 'Cache-Control' => 'no-cache, must-revalidate, max-age=0', |
|---|
| 11 | 'Pragma' => 'no-cache', |
|---|
| 12 | ); |
|---|
| 13 | @@ -910,6 +909,7 @@ |
|---|
| 14 | if ( function_exists('apply_filters') ) { |
|---|
| 15 | $headers = (array) apply_filters('nocache_headers', $headers); |
|---|
| 16 | } |
|---|
| 17 | + $headers['Last-Modified'] = false; |
|---|
| 18 | return $headers; |
|---|
| 19 | } |
|---|
| 20 | |
|---|
| 21 | @@ -924,10 +924,25 @@ |
|---|
| 22 | */ |
|---|
| 23 | function nocache_headers() { |
|---|
| 24 | $headers = wp_get_nocache_headers(); |
|---|
| 25 | + |
|---|
| 26 | + unset( $headers['Last-Modified'] ); |
|---|
| 27 | + |
|---|
| 28 | + // In PHP 5.3+, make sure we are not sending a Last-Modified header. |
|---|
| 29 | + if ( function_exists( 'header_remove' ) ) { |
|---|
| 30 | + @header_remove( 'Last-Modified' ); |
|---|
| 31 | + } else { |
|---|
| 32 | + // In PHP 5.2, send an empty Last-Modified header, but only as a |
|---|
| 33 | + // last resort to override a header already sent. #WP23021 |
|---|
| 34 | + foreach ( headers_list() as $header ) { |
|---|
| 35 | + if ( 0 === stripos( $header, 'Last-Modified' ) ) { |
|---|
| 36 | + $headers['Last-Modified'] = ''; |
|---|
| 37 | + break; |
|---|
| 38 | + } |
|---|
| 39 | + } |
|---|
| 40 | + } |
|---|
| 41 | + |
|---|
| 42 | foreach( $headers as $name => $field_value ) |
|---|
| 43 | @header("{$name}: {$field_value}"); |
|---|
| 44 | - if ( empty( $headers['Last-Modified'] ) && function_exists( 'header_remove' ) ) |
|---|
| 45 | - @header_remove( 'Last-Modified' ); |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | /** |
|---|
| 49 | Index: wp-includes/class-wp.php |
|---|
| 50 | =================================================================== |
|---|
| 51 | --- wp-includes/class-wp.php (revision 23261) |
|---|
| 52 | +++ wp-includes/class-wp.php (working copy) |
|---|
| 53 | @@ -378,12 +378,29 @@ |
|---|
| 54 | |
|---|
| 55 | if ( ! empty( $status ) ) |
|---|
| 56 | status_header( $status ); |
|---|
| 57 | + |
|---|
| 58 | + // If Last-Modified is set to false, assume |
|---|
| 59 | + if ( isset( $headers['Last-Modified'] ) && false === $headers['Last-Modified'] ) { |
|---|
| 60 | + unset( $headers['Last-Modified'] ); |
|---|
| 61 | + |
|---|
| 62 | + // In PHP 5.3+, make sure we are not sending a Last-Modified header. |
|---|
| 63 | + if ( function_exists( 'header_remove' ) ) { |
|---|
| 64 | + @header_remove( 'Last-Modified' ); |
|---|
| 65 | + } else { |
|---|
| 66 | + // In PHP 5.2, send an empty Last-Modified header, but only as a |
|---|
| 67 | + // last resort to override a header already sent. #WP23021 |
|---|
| 68 | + foreach ( headers_list() as $header ) { |
|---|
| 69 | + if ( 0 === stripos( $header, 'Last-Modified' ) ) { |
|---|
| 70 | + $headers['Last-Modified'] = ''; |
|---|
| 71 | + break; |
|---|
| 72 | + } |
|---|
| 73 | + } |
|---|
| 74 | + } |
|---|
| 75 | + } |
|---|
| 76 | + |
|---|
| 77 | foreach( (array) $headers as $name => $field_value ) |
|---|
| 78 | @header("{$name}: {$field_value}"); |
|---|
| 79 | |
|---|
| 80 | - if ( isset( $headers['Last-Modified'] ) && empty( $headers['Last-Modified'] ) && function_exists( 'header_remove' ) ) |
|---|
| 81 | - @header_remove( 'Last-Modified' ); |
|---|
| 82 | - |
|---|
| 83 | if ( $exit_required ) |
|---|
| 84 | exit(); |
|---|
| 85 | |
|---|