[wp-svn] [2579] trunk/wp-blog-header.php: Possible fix for http://mosquito.wordpress.org/view.php?id=1275

Dougal Campbell dougal at gunters.org
Thu May 5 13:41:46 GMT 2005


m at wordpress.org wrote:
> Revision
>     2579
> Author
>     matt
> Date
>     2005-05-03 04:32:40 +0000 (Tue, 03 May 2005)
> 
> 
>       Log Message
> 
> Possible fix for http://mosquito.wordpress.org/view.php?id=1275
> 
> 
>       Modified Files
> 
>     * trunk/wp-blog-header.php <#trunkwpblogheaderphp>
> 
> 
>       Diff
> 
> 
>       trunk/wp-blog-header.php (2578 => 2579)
> 
> --- trunk/wp-blog-header.php	2005-05-01 19:21:42 UTC (rev 2578)
> +++ trunk/wp-blog-header.php	2005-05-03 04:32:40 UTC (rev 2579)
> @@ -134,7 +134,7 @@
>  	else $client_etag = false;
>  
>  	if ( $client_last_modified && $client_etag ) {
> -		if ( (strtotime($client_last_modified) <= strtotime($wp_last_modified)) || ($client_etag == $wp_etag) ) {
> +		if ( (strtotime($client_last_modified) >= strtotime($wp_last_modified)) || ($client_etag == $wp_etag) ) {
>  			if ( preg_match('/cgi/',php_sapi_name()) ) {
>  				 header('Status: 304 Not Modified');
>  				 echo "\r\n\r\n";

This logic still isn't complete. It only handles the case where both the 
If-Modified-Since *and* the If-None-Match (ETag) headers are present. 
But the spec allows for a case where only one (either one) of the 
headers is present.

If only one of them is present, then it must satisfy its condition in 
order to return a 304: either If-Modified-Since is >= the web content's 
modify date, OR the If-None-Match is equal to what the server thinks it 
should be.

If both are present, then both conditions must be true (which is all 
we're checking right now).

We need to put back in support for the case where only one of the 
headers are present, or we'll be missing some 304 opportunities, and 
wasting bandwidth.


-- 
Dougal Campbell <dougal at gunters.org>
http://dougal.gunters.org/



More information about the wp-svn mailing list