From 61d20830c3b154e343408c3206a8d01d4756789b Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Tue, 3 Nov 2015 19:15:14 +0100 Subject: dont omit long expire if url was recently redownloaded --- itjs.class | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'itjs.class') diff --git a/itjs.class b/itjs.class index f76620f..32c504b 100644 --- a/itjs.class +++ b/itjs.class @@ -207,14 +207,14 @@ static function checksum($fnlist, $p = array()) return it_cache::get($key) ?: it_cache::put($key, substr(md5(self::filecontents($filenames, false)), 0, 10), array('ttl' => 60)); } -function crcurl($url) +function crcurl($url, $p = []) { if (it::match('^http', $url)) # remote url, must fetch to crc - $fn = it_url::get_cache(array('url' => $url, 'maxage' => 3600)); + list($fn, $short_expire) = array(it_url::get_cache(array('url' => $url, 'maxage' => 3600) + $p), false); else - $fn = ($m = it::match("^//(\w+)(/.*)", $url)) ? "/www/$m[0].search.ch" . $m[1] : $GLOBALS['ULTRAHOME'] . $url; + list($fn, $short_expire) = array(($m = it::match("^//(\w+)(/.*)", $url)) ? "/www/$m[0].search.ch" . $m[1] : $GLOBALS['ULTRAHOME'] . $url, true);; - return it::match('#', $url) ? U(trim($url, "#")) : U($url, array('c' => self::checksum(array($fn)))); + 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() -- cgit v1.2.3