Fix #86: Add default timeout of 30 seconds

This commit is contained in:
Zach Borboa
2015-02-08 23:13:25 +07:00
parent dc4e45fd12
commit bbdba6d907
4 changed files with 68 additions and 0 deletions
+14
View File
@@ -145,6 +145,20 @@ if ($test == 'http_basic_auth') {
header('ETag: ' . md5_file($unsafe_file_path));
readfile($unsafe_file_path);
exit;
} elseif ($test === 'timeout') {
$unsafe_seconds = $_GET['seconds'];
$start = time();
while (true) {
echo '.';
ob_flush();
flush();
sleep(1);
$elapsed = time() - $start;
if ($elapsed >= $unsafe_seconds) {
break;
}
}
exit;
} elseif ($test === 'error_message') {
if (function_exists('http_response_code')) {
http_response_code(401);