diff options
author | Urban Müller | 2015-11-16 13:59:53 +0100 |
---|---|---|
committer | Urban Müller | 2015-11-16 13:59:53 +0100 |
commit | 4179279e4bb7e654ba44924821a2fdd62e1e1846 (patch) | |
tree | c5932cece59f866fcc4cf253f3760a0c41d14812 /itjs.class | |
parent | 8007fdcdd2ac074b6e0fc5076e160d83dde8d6a3 (diff) | |
download | itools-4179279e4bb7e654ba44924821a2fdd62e1e1846.tar.gz itools-4179279e4bb7e654ba44924821a2fdd62e1e1846.tar.bz2 itools-4179279e4bb7e654ba44924821a2fdd62e1e1846.zip |
make c= optional for far future expire
Diffstat (limited to 'itjs.class')
-rw-r--r-- | itjs.class | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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"); } |