Project

General

Profile

« Previous | Next » 

Revision d164643a

Added by Jim Pingle over 14 years ago

Make update check a little more robust. Timeout after a few seconds, and if we get a non-200 http code, ignore the response.

View differences:

etc/inc/pfsense-utils.inc
1429 1429
	return $version[0];
1430 1430
}
1431 1431

  
1432
function download_file_with_progress_bar($url_file, $destination_file, $readbody = 'read_body') {
1432
function download_file_with_progress_bar($url_file, $destination_file, $readbody = 'read_body', $connect_timeout=60, $timeout=0) {
1433 1433
        global $ch, $fout, $file_size, $downloaded;
1434 1434
        $file_size  = 1;
1435 1435
        $downloaded = 1;
......
1449 1449
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
1450 1450
        curl_setopt($ch, CURLOPT_WRITEFUNCTION, $readbody);
1451 1451
        curl_setopt($ch, CURLOPT_NOPROGRESS, '1');
1452
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, '60');
1453
        curl_setopt($ch, CURLOPT_TIMEOUT, 0);
1452
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $connect_timeout);
1453
        curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
1454 1454

  
1455 1455
        curl_exec($ch);
1456 1456
        $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);

Also available in: Unified diff