summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2026-07-15 17:08:33 +0200
committerUrban Müller2026-07-15 17:08:33 +0200
commit131f00a9af7a3a1e13bf5cf0be54ac15a97cd2f1 (patch)
tree144c40a25c2eefc6dc7f0c807d201a4dc3facfca
parent5e9d2abb85ac03197ad53aa35b64a4d73f144a0a (diff)
downloaditools-master.tar.gz
itools-master.tar.bz2
itools-master.zip
provide headers even in error case (with ugly api), eliminate obsolete "safety"HEADmaster
-rw-r--r--it_url.class7
1 files changed, 3 insertions, 4 deletions
diff --git a/it_url.class b/it_url.class
index 8ebe1e5..3fbb86a 100644
--- a/it_url.class
+++ b/it_url.class
@@ -727,9 +727,8 @@ static function get_cache($p = array())
if (EDC('getcachelog'))
it::log('debug', 'getcachelog', $p['id'], $p['url'], !$isnewfile ? "" : "fetched=" . mb_substr(is_string($data) ? $data : "(assoc)", 0, 400));
- ### EDC('getcache', $success, $path); # too verbose
return $p['returnheaders'] || $p['returncachemiss']
- ? ($success ? [$path, $headers, (bool)$isnewfile] : null)
+ ? [$success ? $path : false, $headers, (bool)$isnewfile]
: ($success ? $path : false);
}
@@ -741,7 +740,7 @@ static function get_cache($p = array())
*/
static function get_cache_contents($p)
{
- [$fn, $dummy, $cachemiss] = self::get_cache($p + ['returncachemiss' => true]);
+ [$fn, $headers, $cachemiss] = self::get_cache($p + ['returncachemiss' => true]);
if ($fn)
{
$result = it::file_get_contents($fn);
@@ -755,7 +754,7 @@ static function get_cache_contents($p)
$result = self::_postprocess($result, $p);
}
else
- $result = it::error((array)$p['it_error'] + ['title' => $p['safety'] === 0 ? false : "failed getting " . static::absolute($p['url']), 'body' => $p + ['fn' => $fn, 'dummy' => $dummy, 'cachemiss' => $cachemiss]]);
+ $result = it::error((array)$p['it_error'] + ['title' => "failed getting " . static::absolute($p['url']), 'body' => $p + ['fn' => $fn, 'headers' => $headers, 'cachemiss' => $cachemiss]]);
return $result;
}