Changeset 56395
- Timestamp:
- 08/13/2023 10:29:04 AM (14 months ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp.php
r56362 r56395 506 506 507 507 $wp_last_modified .= ' GMT'; 508 509 $wp_etag = '"' . md5( $wp_last_modified ) . '"'; 508 $wp_etag = '"' . md5( $wp_last_modified ) . '"'; 509 510 510 $headers['Last-Modified'] = $wp_last_modified; 511 511 $headers['ETag'] = $wp_etag; … … 515 515 $client_etag = wp_unslash( $_SERVER['HTTP_IF_NONE_MATCH'] ); 516 516 } else { 517 $client_etag = false; 518 } 519 520 $client_last_modified = empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ? '' : trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); 517 $client_etag = ''; 518 } 519 520 if ( isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) { 521 $client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); 522 } else { 523 $client_last_modified = ''; 524 } 525 521 526 // If string is empty, return 0. If not, attempt to parse into a timestamp. 522 527 $client_modified_timestamp = $client_last_modified ? strtotime( $client_last_modified ) : 0; 523 528 524 // Make a timestamp for our most recent modification. .529 // Make a timestamp for our most recent modification. 525 530 $wp_modified_timestamp = strtotime( $wp_last_modified ); 526 531 527 if ( ( $client_last_modified && $client_etag ) ?528 ( ( $client_modified_timestamp >= $wp_modified_timestamp ) && ( $client_etag === $wp_etag ) ) :529 532 if ( ( $client_last_modified && $client_etag ) 533 ? ( ( $client_modified_timestamp >= $wp_modified_timestamp ) && ( $client_etag === $wp_etag ) ) 534 : ( ( $client_modified_timestamp >= $wp_modified_timestamp ) || ( $client_etag === $wp_etag ) ) 530 535 ) { 531 536 $status = 304; -
trunk/src/wp-includes/ms-files.php
r55988 r56395 55 55 } 56 56 57 $last_modified = gmdate( 'D, d M Y H:i:s', filemtime( $file ) ); 58 $etag = '"' . md5( $last_modified ) . '"'; 59 header( "Last-Modified: $last_modified GMT" ); 60 header( 'ETag: ' . $etag ); 57 $wp_last_modified = gmdate( 'D, d M Y H:i:s', filemtime( $file ) ); 58 $wp_etag = '"' . md5( $wp_last_modified ) . '"'; 59 60 header( "Last-Modified: $wp_last_modified GMT" ); 61 header( 'ETag: ' . $wp_etag ); 61 62 header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', time() + 100000000 ) . ' GMT' ); 62 63 63 64 // Support for conditional GET - use stripslashes() to avoid formatting.php dependency. 64 $client_etag = isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ? stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) : false; 65 66 if ( ! isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ){67 $ _SERVER['HTTP_IF_MODIFIED_SINCE'] = false;65 if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) ) { 66 $client_etag = stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ); 67 } else { 68 $client_etag = ''; 68 69 } 69 70 70 $client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); 71 if ( isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) { 72 $client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ); 73 } else { 74 $client_last_modified = ''; 75 } 76 71 77 // If string is empty, return 0. If not, attempt to parse into a timestamp. 72 78 $client_modified_timestamp = $client_last_modified ? strtotime( $client_last_modified ) : 0; 73 79 74 // Make a timestamp for our most recent modification. ..75 $ modified_timestamp = strtotime( $last_modified );80 // Make a timestamp for our most recent modification. 81 $wp_modified_timestamp = strtotime( $wp_last_modified ); 76 82 77 83 if ( ( $client_last_modified && $client_etag ) 78 ? ( ( $client_modified_timestamp >= $ modified_timestamp ) && ( $client_etag == $etag ) )79 : ( ( $client_modified_timestamp >= $ modified_timestamp ) || ( $client_etag == $etag ) )80 84 ? ( ( $client_modified_timestamp >= $wp_modified_timestamp ) && ( $client_etag === $wp_etag ) ) 85 : ( ( $client_modified_timestamp >= $wp_modified_timestamp ) || ( $client_etag === $wp_etag ) ) 86 ) { 81 87 status_header( 304 ); 82 88 exit;
Note: See TracChangeset
for help on using the changeset viewer.