summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2015-11-16 13:59:53 +0100
committerUrban Müller2015-11-16 13:59:53 +0100
commit4179279e4bb7e654ba44924821a2fdd62e1e1846 (patch)
treec5932cece59f866fcc4cf253f3760a0c41d14812
parent8007fdcdd2ac074b6e0fc5076e160d83dde8d6a3 (diff)
downloaditools-4179279e4bb7e654ba44924821a2fdd62e1e1846.tar.gz
itools-4179279e4bb7e654ba44924821a2fdd62e1e1846.tar.bz2
itools-4179279e4bb7e654ba44924821a2fdd62e1e1846.zip
make c= optional for far future expire
-rw-r--r--itjs.class5
1 files changed, 3 insertions, 2 deletions
diff --git a/itjs.class b/itjs.class
index e69696a..92a1c58 100644
--- a/itjs.class
+++ b/itjs.class
@@ -217,7 +217,8 @@ function crcurl($url, $p = array())
return it::match('#', $url) ? U(trim($url, "#")) : U($url, array('c' => self::checksum(array($fn), array('short_expire' => $short_expire))));
}
-static function far_future_headers()
+# $p['nocrc'] means no $_REQUEST['c'] is needed for far future expire
+static function far_future_headers($p = [])
{
$crc = $_REQUEST['c'] ?: $_REQUEST['s'];
if ($crc != "-" && !$_SERVER['HTTP_CACHE_CONTROL'] && $_SERVER['HTTP_IF_NONE_MATCH'] && !it::is_devel() && !$_REQUEST['retry'])
@@ -231,7 +232,7 @@ static function far_future_headers()
if (it::is_live() && !$_REQUEST['retry'])
{
- $keeptime = $crc == "-" ? 0 : ($crc ? 30*86400 : 900); # long expire if checksum present
+ $keeptime = $crc == "-" ? 0 : ($crc || $p['nocrc'] ? 30*86400 : 900); # long expire if checksum present
header("Cache-Control: max-age=$keeptime, private"); # proxies should not cache since contents of same url can differ between browsers
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $keeptime). " GMT");
}