summaryrefslogtreecommitdiff
path: root/it_url.class
diff options
context:
space:
mode:
authorChristian A. Weber2018-08-17 17:46:22 +0200
committerChristian A. Weber2018-08-17 17:46:22 +0200
commit986b0670a393b79e3e18d90f59b1381a62935c13 (patch)
tree1eae19acb57b279ac73484c3f38c8a5a8fe963ef /it_url.class
parent6df69a1c2ce720a9a7e8c92fcd3665c2b8c86a3d (diff)
downloaditools-986b0670a393b79e3e18d90f59b1381a62935c13.tar.gz
itools-986b0670a393b79e3e18d90f59b1381a62935c13.tar.bz2
itools-986b0670a393b79e3e18d90f59b1381a62935c13.zip
$p['totaltimeout'] supports fractions of seconds, fix path in error message of _waitforlockedfile()
Diffstat (limited to 'it_url.class')
-rw-r--r--it_url.class6
1 files 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);
}