fix: added some timeout safeguards for curl calls (#5743)

This commit is contained in:
Neil Lathwood
2017-02-03 14:12:42 +00:00
committed by Tony Murray
parent 5733fb27fa
commit a19b2614dc
3 changed files with 7 additions and 0 deletions

View File

@@ -1093,6 +1093,9 @@ function version_info($remote = true)
curl_setopt($api, CURLOPT_USERAGENT, 'LibreNMS');
curl_setopt($api, CURLOPT_URL, $config['github_api'].'commits/master');
curl_setopt($api, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($api, CURLOPT_TIMEOUT, 5);
curl_setopt($api, CURLOPT_TIMEOUT_MS, 5000);
curl_setopt($api, CURLOPT_CONNECTTIMEOUT, 5);
$output['github'] = json_decode(curl_exec($api), true);
}
list($local_sha, $local_date) = explode('|', rtrim(`git show --pretty='%H|%ct' -s HEAD`));