aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2011-10-14 02:47:45 +0200
committerNils Adermann <naderman@naderman.de>2011-10-14 02:47:45 +0200
commitdda1e13126ae81aff19114e168f134a6077ed549 (patch)
tree7684312c2fdf48de10ab5ac6e43576430e620e01 /phpBB/includes
parentMerge remote-tracking branch 'igorw/ticket/10307' into develop-olympus (diff)
parent[ticket/10278] Show VERSIONCHECK_FAIL instead of FSOCK_TIMEOUT. (diff)
downloadphpbb-dda1e13126ae81aff19114e168f134a6077ed549.tar.gz
phpbb-dda1e13126ae81aff19114e168f134a6077ed549.tar.bz2
phpbb-dda1e13126ae81aff19114e168f134a6077ed549.zip
Merge remote-tracking branch 'github-bantu/ticket/10278' into develop-olympus
* github-bantu/ticket/10278: [ticket/10278] Show VERSIONCHECK_FAIL instead of FSOCK_TIMEOUT. [ticket/10278] Also timeout when receiving data over a slow connection. [ticket/10278] Decrease default timeout of get_remote_file() to 6 seconds. [ticket/10278] Return with a timeout error when fread() or fgets() time out. [ticket/10278] Also set timeout on stream in get_remote_file().
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_update.php2
-rw-r--r--phpBB/includes/functions_admin.php13
2 files changed, 13 insertions, 2 deletions
diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php
index 931fa53165..7e3d1a1024 100644
--- a/phpBB/includes/acp/acp_update.php
+++ b/phpBB/includes/acp/acp_update.php
@@ -37,7 +37,7 @@ class acp_update
$errstr = '';
$errno = 0;
- $info = obtain_latest_version_info(request_var('versioncheck_force', false), true);
+ $info = obtain_latest_version_info(request_var('versioncheck_force', false));
if ($info === false)
{
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);
}