mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-10-09 13:35:31 +00:00
Fix #86: Add default timeout of 30 seconds
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user