Do not issue a Last-Modified header when issuing no-cache headers to avoid aggressive (webkit) caching. Serve a blank header when header_remove() is not available (PHP < 5.3). props andy. fixes #22258.

git-svn-id: http://core.svn.wordpress.org/trunk@22283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2012-10-23 15:45:44 +00:00
parent 4ddd44f32a
commit a88114dd92
2 changed files with 6 additions and 1 deletions

View File

@ -381,6 +381,9 @@ class WP {
foreach( (array) $headers as $name => $field_value )
@header("{$name}: {$field_value}");
if ( isset( $headers['Last-Modified'] ) && empty( $headers['Last-Modified'] ) && function_exists( 'header_remove' ) )
header_remove( 'Last-Modified' );
if ( $exit_required )
exit();

View File

@ -902,7 +902,7 @@ function status_header( $header ) {
function wp_get_nocache_headers() {
$headers = array(
'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT',
'Last-Modified' => gmdate( 'D, d M Y H:i:s' ) . ' GMT',
'Last-Modified' => '',
'Cache-Control' => 'no-cache, must-revalidate, max-age=0',
'Pragma' => 'no-cache',
);
@ -926,6 +926,8 @@ function nocache_headers() {
$headers = wp_get_nocache_headers();
foreach( $headers as $name => $field_value )
@header("{$name}: {$field_value}");
if ( empty( $headers['Last-Modified'] ) && function_exists( 'header_remove' ) )
header_remove( 'Last-Modified' );
}
/**