diff options
Diffstat (limited to 'it_url.class')
-rw-r--r-- | it_url.class | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/it_url.class b/it_url.class index 8af61ae..0679727 100644 --- a/it_url.class +++ b/it_url.class @@ -100,6 +100,8 @@ static function _postprocess($data, $p) * @param $p['filemtime'] Add HTTP header to only fetch when newer than this, otherwise return true instead of data * @param $p['accept_encoding'] Contents of the "Accept-Encoding: " header. Enables decoding of the response. Set to null to disable, "" (default) for all supported encodings. * @param $p['protocols'] Array of protocols to accept, defaults to ['http', 'https'], @see curl_opts for other values + * @param $p['user'] Username for basic HTTP authentication + * @param $p['pass'] Password for basic HTTP authentication * * Problem handling * @param $p['retries'] Number of retries if download fails, default 1 @@ -314,8 +316,6 @@ function request($p=array()) curl_setopt($curl, CURLOPT_URL, $url->url); } - - # FIXME 2025-01 NG just use CURLOPT_MAXFILESIZE if we have curl 8.4 $content = ""; if ($p['maxlength'] && !$p['writefunction']) { @@ -339,7 +339,7 @@ function request($p=array()) $body = $origbody = $p['maxlength'] && $got ? $content : $got; $this->curlinfo = curl_getinfo($curl); - EDC('curlinfo', $this->curlinfo); + EDC('curlinfo', $this->curlinfo, substr($got, 0, 2048)); if ($body !== false || curl_errno($curl) == 23) { @@ -710,8 +710,8 @@ static function get_cache($p = array()) $isnight = date('H') >= 1 && date('H')*3600 + date('i')*60 < $p['cleanbefore']; if (time() - @filemtime($p['cachedir'] . "/cleaned") > ($isnight ? 80000 : 2*80000)) { - it::file_put($p['cachedir'] . "/cleaned", ""); # touch could have permission problems - $maxagemin = intval($p['maxage']/60); + $maxagemin = round($p['maxage']/60, 2); + it::file_put($p['cachedir'] . "/cleaned", "$maxagemin\n"); exec("nohup bash -c 'cd {$p['cachedir']} && for i in [0-9a-f][0-9a-f]; do sleep 20; ionice -c 3 find \$i -mmin +$maxagemin -type f -delete; done' </dev/null >/dev/null 2>&1 &"); } |