10 my $name = $query->param('name');
11 my $filesize = stat($name)->size;
14 my $type = $query->param('type');
16 print "Status: 400 Bad Request\r\n";
20 my $rangeEnd = $filesize - 1;
22 # Print HTTP Header, disabling cache.
23 print "Cache-Control: no-cache\n";
24 print "Content-Length: " . $filesize . "\n";
25 print "Content-Type: " . $type . "\n";
29 open FILE
, $name or die;
33 my $break = $filesize / 4;
34 my $string = "corrupt video";
37 while (($n = read FILE
, $data, 1024) != 0) {
41 if ($total >= $filesize) {
45 if ($total >= $break) {
47 $total += length($string);