diff options
Diffstat (limited to 'phpBB/includes/functions_admin.php')
| -rw-r--r-- | phpBB/includes/functions_admin.php | 13 | 
1 files changed, 12 insertions, 1 deletions
| diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index f7e19f3e7d..513b7a68b2 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3130,7 +3130,7 @@ function get_database_size()  /**  * Retrieve contents from remotely stored file  */ -function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 10) +function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 6)  {  	global $user; @@ -3140,6 +3140,9 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port  		@fputs($fsock, "HOST: $host\r\n");  		@fputs($fsock, "Connection: close\r\n\r\n"); +		$timer_stop = time() + $timeout; +		stream_set_timeout($fsock, $timeout); +  		$file_info = '';  		$get_info = false; @@ -3162,6 +3165,14 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port  					return false;  				}  			} + +			$stream_meta_data = stream_get_meta_data($fsock); + +			if (!empty($stream_meta_data['timed_out']) || time() >= $timer_stop) +			{ +				$errstr = $user->lang['FSOCK_TIMEOUT']; +				return false; +			}  		}  		@fclose($fsock);  	} | 
