mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix: added some timeout safeguards for curl calls (#5743)
This commit is contained in:
committed by
Tony Murray
parent
5733fb27fa
commit
a19b2614dc
@ -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`));
|
||||
|
@ -1499,6 +1499,7 @@ function oxidized_reload_nodes()
|
||||
$ch = curl_init($oxidized_reload_url);
|
||||
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 5000);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 1);
|
||||
|
@ -513,6 +513,9 @@ function location_to_latlng($device)
|
||||
$curl_init = curl_init($api_url);
|
||||
set_curl_proxy($curl_init);
|
||||
curl_setopt($curl_init, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl_init, CURLOPT_TIMEOUT, 2);
|
||||
curl_setopt($curl_init, CURLOPT_TIMEOUT_MS, 2000);
|
||||
curl_setopt($curl_init, CURLOPT_CONNECTTIMEOUT, 5);
|
||||
$data = json_decode(curl_exec($curl_init), true);
|
||||
// Parse the data from the specific Geocode services.
|
||||
switch ($config['geoloc']['engine']) {
|
||||
|
Reference in New Issue
Block a user