PL
apps/winzik / tests / fixtures / download-server.php · commit 6576d6f
<?php// The test server of FileDownload (php -S ... tests/fixtures/download-server.php): /redir sends to /file.bin,// which comes slowly, in 20 parts of 50 000 bytes (its progress can be seen), its length said first.$path = parse_url((string)($_SERVER['REQUEST_URI'] ?? '/'), PHP_URL_PATH);if ($path === '/redir') {    header('Location: /file.bin', true, 302);    return true;}if ($path === '/file.bin') {    header('Content-Type: application/octet-stream');    header('Content-Length: ' . (20 * 50000));    for ($i = 0; $i < 20; $i++) {        echo str_repeat(chr(65 + $i), 50000);        flush();        usleep(30000);    }    return true;}http_response_code(404);return true;