summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-02-13 11:14:26 -0500
committerjim-p <jimp@pfsense.org>2011-02-13 11:14:26 -0500
commitd164643a3560174bf1caabef4649b5b2a382b8ff (patch)
treefa249a162684a799c94654a23433cb61c1a9b5aa /etc
parentb43b7613919b6e3c7ab0059704177993fde59894 (diff)
downloadpfsense-d164643a3560174bf1caabef4649b5b2a382b8ff.zip
pfsense-d164643a3560174bf1caabef4649b5b2a382b8ff.tar.gz
Make update check a little more robust. Timeout after a few seconds, and if we get a non-200 http code, ignore the response.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/pfsense-utils.inc6
1 files changed, 3 insertions, 3 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 0cdaa85..699e603 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -1429,7 +1429,7 @@ function get_freebsd_version() {
return $version[0];
}
-function download_file_with_progress_bar($url_file, $destination_file, $readbody = 'read_body') {
+function download_file_with_progress_bar($url_file, $destination_file, $readbody = 'read_body', $connect_timeout=60, $timeout=0) {
global $ch, $fout, $file_size, $downloaded;
$file_size = 1;
$downloaded = 1;
@@ -1449,8 +1449,8 @@ function download_file_with_progress_bar($url_file, $destination_file, $readbody
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_WRITEFUNCTION, $readbody);
curl_setopt($ch, CURLOPT_NOPROGRESS, '1');
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, '60');
- curl_setopt($ch, CURLOPT_TIMEOUT, 0);
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $connect_timeout);
+ curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
OpenPOWER on IntegriCloud