diff options
-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"); } |