summaryrefslogtreecommitdiff
path: root/it_url.class
diff options
context:
space:
mode:
authorChristian Schneider2026-07-28 17:04:20 +0200
committerChristian Schneider2026-07-28 17:04:20 +0200
commit9da0ebc85c2c64735acb728fda1e04f30b63c229 (patch)
treee8102e6161da686b3f8b218808a0577e1fcdb3f6 /it_url.class
parentbd037f5ce7605e745ca514578de1944248c93b7f (diff)
downloaditools-9da0ebc85c2c64735acb728fda1e04f30b63c229.tar.gz
itools-9da0ebc85c2c64735acb728fda1e04f30b63c229.tar.bz2
itools-9da0ebc85c2c64735acb728fda1e04f30b63c229.zip
Add option 'unconditional' to suppress If-Modified-Since header when refetching
Diffstat (limited to 'it_url.class')
-rw-r--r--it_url.class3
1 files changed, 2 insertions, 1 deletions
diff --git a/it_url.class b/it_url.class
index fbb4101..6916661 100644
--- a/it_url.class
+++ b/it_url.class
@@ -201,7 +201,7 @@ static function _default_headers($url, $p)
'X-Ultra-Https' => $_SERVER['HTTPS'],
]);
- if (is_int($p['filemtime']))
+ if (!$p['unconditional'] && is_int($p['filemtime']))
$headers['If-Modified-Since'] = gmdate("D, d M Y H:i:s T", $p['filemtime']); # Use GMT as per https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/If-Modified-Since
return $headers;
}
@@ -602,6 +602,7 @@ static function get_cache_filename($p)
* @param $p['safety'] DEPRECATED. see $p['it_error']
* @param $p['it_error'] parameters for it::error(), false means ignore errors, anything else gets passed to it::error() if errors occur
* @param $p['keepfailed'] keep old versions of files if download fails
+ * @param $p['unconditional'] Make request unconditional, i.e. do not send If-Modified-Since header when refetching (Work-around for Windy webcam caching problem)
* @param $p['returnheaders'] Return array($path, $headers) instead of simply $path
* @param $p['postprocess'] UNSUPPORTED, use ::get_cache_contents
* @param $p['lock'] prevent multiple requests to same url from different processes [true]