Implement Curl::setStop() for stopping requests early

Use Curl::setStop() to stop requests early without downloading
the full response.
This commit is contained in:
Zach Borboa
2021-09-15 05:49:25 -04:00
parent 6146e764f6
commit a4f4223b98
5 changed files with 161 additions and 0 deletions
+3
View File
@@ -263,6 +263,9 @@ if ($test === 'http_basic_auth') {
readfile($unsafe_file_path);
exit;
} elseif ($test === 'download_file_size') {
if (isset($_GET['http_response_code'])) {
http_response_code((int) $_GET['http_response_code']);
}
$bytes = isset($_GET['bytes']) ? $_GET['bytes'] : 1234;
$str = str_repeat('.', (int) $bytes);
header('Content-Type: application/octet-stream');