Make WordPress Core

Changeset 2600


Ignore:
Timestamp:
05/13/2005 09:07:21 PM (21 years ago)
Author:
matt
Message:

​http://mosquito.wordpress.org/view.php?id=1323 - Hat tip: Dougal

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-blog-header.php

    r2584 r2600  
    129129
    130130        // Support for Conditional GET
    131         if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) $client_last_modified = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
    132         else $client_last_modified = false;
    133131        if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) $client_etag = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']);
    134132        else $client_etag = false;
    135133
     134        $client_last_modified = trim( $_SERVER['HTTP_IF_MODIFIED_SINCE']);
     135        // If string is empty, return 0. If not, attempt to parse into a timestamp
     136        $client_modified_timestamp = $client_last_modified ? strtotime($client_last_modified) : 0;
     137
     138        // Make a timestamp for our most recent modification...
     139        $wp_modified_timestamp = strtotime($wp_last_modified);
     140
    136141        if ( ($client_last_modified && $client_etag) ?
    137                 ((strtotime($client_last_modified) >= strtotime($wp_last_modified)) && ($client_etag == $wp_etag)) :
    138                 ((strtotime($client_last_modified) >= strtotime($wp_last_modified)) || ($client_etag == $wp_etag)) ) {
     142                (($client_modified_timestamp >= $wp_modified_timestamp) && ($client_etag == $wp_etag)) :
     143                (($client_modified_timestamp >= $wp_modified_timestamp) || ($client_etag == $wp_etag)) ) {
    139144                if ( preg_match('/cgi/',php_sapi_name()) ) {
    140145                        header('Status: 304 Not Modified');
Note: See TracChangeset for help on using the changeset viewer.