aboutsummaryrefslogtreecommitdiffstats
path: root/rss
diff options
context:
space:
mode:
authorChad Little <clittle@users.sourceforge.net>2002-11-21 07:54:38 +0000
committerChad Little <clittle@users.sourceforge.net>2002-11-21 07:54:38 +0000
commite4c42a919fa9b6076afeb1f77fd0f1783421bad1 (patch)
tree61e8c264e477df9f29cffc2cf93b632fc4390520 /rss
parentdf2e7ea03b96ea00f765a3c6d7bf61d456689e37 (diff)
downloadphpicalendar-e4c42a919fa9b6076afeb1f77fd0f1783421bad1.tar.gz
phpicalendar-e4c42a919fa9b6076afeb1f77fd0f1783421bad1.tar.bz2
phpicalendar-e4c42a919fa9b6076afeb1f77fd0f1783421bad1.zip
HTTP Conditional GET patch applied.
Diffstat (limited to 'rss')
-rw-r--r--rss/rss.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/rss/rss.php b/rss/rss.php
index 4ae73f0..9bdd284 100644
--- a/rss/rss.php
+++ b/rss/rss.php
@@ -13,6 +13,22 @@ $rssview = $HTTP_GET_VARS['rssview'];
$cal_displayname = str_replace("32", " ", $cal);
$events_week = 0;
+// calculate a value for Last Modified and ETag
+$filemod = filemtime("../calendars/$cal.ics");
+$filemodtime = date("r", $filemod);
+
+//send relevant headers
+header ("Last-Modified: $filemodtime");
+header ("ETag:\"$filemodtime\"");
+
+// checks the user agents headers to see if they kept track of our
+// stuff, if so be nice and send back a 304 and exit.
+
+if ( ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $filemodtime) || ($_SERVER['HTTP_IF_NONE_MATCH'] == $filemodtime))
+{
+ header ("HTTP/1.1 304 Not Modified");
+ exit;
+}
if ($rssview == "day") {
$theview = $day_lang;
@@ -156,7 +172,7 @@ $rss .= '</channel>'."\n";
$rss .= '</rss>'."\n";
header ("Content-Type: text/xml");
-echo "$rss";
+echo "$rss";
?>

© 2014-2024 Faster IT GmbH | imprint | privacy policy