Fixed logic error in Conditional GET when neither If-Modified-Since nor If-None-Match were set.

git-svn-id: http://svn.automattic.com/wordpress/trunk@352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
emc3 2003-08-29 02:49:54 +00:00
parent d4ad0a06ca
commit 576af607c4
3 changed files with 13 additions and 12 deletions

View File

@ -22,8 +22,8 @@ $slast = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
$setag = $_SERVER['HTTP_IF_NONE_MATCH'];
// send it in a Last-Modified header
header("Last-Modified: " . $clast);
header("Etag: " . $cetag);
header("Last-Modified: " . $clast, true);
header("Etag: " . $cetag, true);
// compare it to aggregator's If-Modified-Since and If-None-Match headers
// if they match, send a 304 and die
@ -31,7 +31,8 @@ header("Etag: " . $cetag);
// This logic says that if only one header is provided, just use that one,
// but if both headers exist, they *both* must match up with the locally
// generated values.
if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){
//if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){
if (($slast && $setag)?(($slast == $clast) && ($setag == $cetag)):(($slast == $clast) || ($setag == $cetag))) {
header("HTTP/1.1 304 Not Modified");
echo "\r\n\r\n";
exit;

View File

@ -2,7 +2,7 @@
In every template you do, you got to copy them before the CaféLog 'loop' */
$blog = 1; // enter your blog's ID
$doing_rss=1;
header('Content-type: text/xml');
header('Content-type: text/xml',true);
include('blog.header.php');
// Handle Conditional GET
@ -22,8 +22,8 @@ $slast = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
$setag = $_SERVER['HTTP_IF_NONE_MATCH'];
// send it in a Last-Modified header
header("Last-Modified: " . $clast);
header("Etag: " . $cetag);
header("Last-Modified: " . $clast, true);
header("Etag: " . $cetag, true);
// compare it to aggregator's If-Modified-Since and If-None-Match headers
// if they match, send a 304 and die
@ -31,13 +31,13 @@ header("Etag: " . $cetag);
// This logic says that if only one header is provided, just use that one,
// but if both headers exist, they *both* must match up with the locally
// generated values.
if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){
//if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){
if (($slast && $setag)?(($slast == $clast) && ($setag == $cetag)):(($slast == $clast) || ($setag == $cetag))) {
header("HTTP/1.1 304 Not Modified");
echo "\r\n\r\n";
exit;
}
if (!isset($rss_language)) { $rss_language = 'en'; }
if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_length = 0; }

View File

@ -23,8 +23,8 @@ $slast = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
$setag = $_SERVER['HTTP_IF_NONE_MATCH'];
// send it in a Last-Modified header
header("Last-Modified: " . $clast);
header("Etag: " . $cetag);
header("Last-Modified: " . $clast, true);
header("Etag: " . $cetag, true);
// compare it to aggregator's If-Modified-Since and If-None-Match headers
// if they match, send a 304 and die
@ -32,13 +32,13 @@ header("Etag: " . $cetag);
// This logic says that if only one header is provided, just use that one,
// but if both headers exist, they *both* must match up with the locally
// generated values.
if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){
//if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){
if (($slast && $setag)?(($slast == $clast) && ($setag == $cetag)):(($slast == $clast) || ($setag == $cetag))) {
header("HTTP/1.1 304 Not Modified");
echo "\r\n\r\n";
exit;
}
if (!isset($rss_language)) { $rss_language = 'en'; }
if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_length = 0; }