From 986b0670a393b79e3e18d90f59b1381a62935c13 Mon Sep 17 00:00:00 2001 From: Christian A. Weber Date: Fri, 17 Aug 2018 17:46:22 +0200 Subject: $p['totaltimeout'] supports fractions of seconds, fix path in error message of _waitforlockedfile() --- it_url.class | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/it_url.class b/it_url.class index 6b2593c..c7c3ed5 100644 --- a/it_url.class +++ b/it_url.class @@ -212,7 +212,7 @@ static function curl_opts($p=array()) return $add + [ CURLOPT_HEADER => false, CURLOPT_RETURNTRANSFER => true, - CURLOPT_TIMEOUT => $p['totaltimeout'], + CURLOPT_TIMEOUT_MS => $p['totaltimeout'] * 1000, # use _MS to support fractions of seconds CURLOPT_LOW_SPEED_LIMIT => 5, CURLOPT_LOW_SPEED_TIME => $p['timeout'], CURLOPT_FOLLOWLOCATION => $p['followlocation'], @@ -298,7 +298,7 @@ function request($p=array()) * @param $p parameter array with the following keys (same as it_url::get) * @param $p['urls']: array of urls to get * @param $p['timeout']: timeout per read in seconds, defaults to 5. (TODO: fractions allowed?) - * @param $p['totaltimeout']: timeout for the whole function call + * @param $p['totaltimeout']: timeout for the whole function call (fractions allowed) * @param $p['headers']: optional array of HTTP headers to send * @return array of contents (or false for errors like timesou) of resulting page using same * keys as the urls input array, considering redirects, excluding headers @@ -625,7 +625,7 @@ static function _waitforlockedfile($path, $p) } if ($lockedbyother) - it::error((array)$p['it_error'] + ['title' => ($passes < $maxpasses ? "error getting url" : "timeout") . " in it_url::get_cache(): url={$p['url']}, passes=$passes, maxpasses=$maxpasses, path={$p['path']}"]); + it::error((array)$p['it_error'] + ['title' => ($passes < $maxpasses ? "error getting url" : "timeout") . " in it_url::get_cache(): url={$p['url']}, passes=$passes, maxpasses=$maxpasses, path=$path"]); return !$lockedbyother && file_exists($path); } -- cgit v1.2.3