summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Schneider2024-04-29 12:36:50 +0200
committerChristian Schneider2024-04-29 12:36:50 +0200
commitc3cf4d435f0d7d2a43ee3707addf6e9794df0774 (patch)
tree3f9d930a9b9418e6372912ef185426855f0775ea
parent4c0f5a738aaa5897cc36062d9555b2edbf5142f5 (diff)
downloaditools-c3cf4d435f0d7d2a43ee3707addf6e9794df0774.tar.gz
itools-c3cf4d435f0d7d2a43ee3707addf6e9794df0774.tar.bz2
itools-c3cf4d435f0d7d2a43ee3707addf6e9794df0774.zip
Also cache 404 in assoc case to keep previous behaviour, server errors >= 500 are not cached
-rw-r--r--it_url.class2
1 files changed, 1 insertions, 1 deletions
diff --git a/it_url.class b/it_url.class
index d9e4869..a94975d 100644
--- a/it_url.class
+++ b/it_url.class
@@ -616,7 +616,7 @@ static function get_cache($p = array())
EDC('getcache', "new", $filemtime, $p['url'], $path);
$url = new it_url;
$data = $url->_get($p + ['checkonly' => true, 'filemtime' => EDC('nocache') ? null : $filemtime]);
- if ($p['assoc'] ? ($data['status'] == 304 || $data['data']) : $data)
+ if ($p['assoc'] ? ($data['status'] < 500 || $data['data']) : $data)
{
$success = true;
$isnewfile = it_url::_atomicwrite($path, $p['assoc'] ? ($data['status'] === 304 ? true : it::json_encode($data)) : $data); # $data === true means not modified (no new data fetched) and instructs _atomicwrite to just touch the file