From 091119605abe794aa508c76b7e5199517fc256e3 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 13 Oct 2011 18:03:02 +0200 Subject: [PATCH] [ticket/10278] Also timeout when receiving data over a slow connection. PHPBB3-10278 --- phpBB/includes/functions_admin.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index bcd477d855..513b7a68b2 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3140,6 +3140,7 @@ 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 = ''; @@ -3167,7 +3168,7 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port $stream_meta_data = stream_get_meta_data($fsock); - if (!empty($stream_meta_data['timed_out'])) + if (!empty($stream_meta_data['timed_out']) || time() >= $timer_stop) { $errstr = $user->lang['FSOCK_TIMEOUT']; return false;