2016-03-04 12:48:09 +01:00
|
|
|
<?php
|
2016-11-28 21:09:12 +01:00
|
|
|
// Disable Compression
|
2016-10-22 15:21:16 +02:00
|
|
|
@ini_set('zlib.output_compression', 'Off');
|
|
|
|
|
@ini_set('output_buffering', 'Off');
|
|
|
|
|
@ini_set('output_handler', '');
|
|
|
|
|
// Headers
|
2017-09-05 07:46:00 +02:00
|
|
|
header('HTTP/1.1 200 OK');
|
2016-10-22 15:21:16 +02:00
|
|
|
// Download follows...
|
|
|
|
|
header('Content-Description: File Transfer');
|
|
|
|
|
header('Content-Type: application/octet-stream');
|
2017-09-05 07:45:52 +02:00
|
|
|
header('Content-Disposition: attachment; filename=random.dat');
|
2016-10-22 15:21:16 +02:00
|
|
|
header('Content-Transfer-Encoding: binary');
|
|
|
|
|
// Never cache me
|
2017-09-05 07:46:00 +02:00
|
|
|
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
|
|
|
|
|
header('Cache-Control: post-check=0, pre-check=0', false);
|
|
|
|
|
header('Pragma: no-cache');
|
2016-10-22 15:21:16 +02:00
|
|
|
// Generate data
|
2016-12-29 07:49:46 +01:00
|
|
|
$data=openssl_random_pseudo_bytes(1048576);
|
2016-11-28 21:09:12 +01:00
|
|
|
// Deliver chunks of 1048576 bytes
|
2017-09-05 07:45:52 +02:00
|
|
|
$chunks=isset($_GET['ckSize']) ? intval($_GET['ckSize']) : 4;
|
2017-09-05 07:46:00 +02:00
|
|
|
if(empty($chunks)){$chunks = 4;}
|
|
|
|
|
if($chunks>100){$chunks = 100;}
|
|
|
|
|
for($i=0;$i<$chunks;$i++){
|
2016-10-22 15:21:16 +02:00
|
|
|
echo $data;
|
|
|
|
|
flush();
|
2016-03-04 12:48:09 +01:00
|
|
|
}
|
2017-09-05 07:46:00 +02:00
|
|
|
?>
|