#$contents is content of entire file we are asked for, not a part of it!
$r->set_content_length(length($contents));
if((my $status = $r->meets_conditions) eq OK()) {
$r->send_http_header if ($mod_perl::VERSION < 1.99);
}
else {
return $status;
}
return OK() if $r->header_only;
my $range_request = ($mod_perl::VERSION < 1.99) ? $r->set_byterange : 0;
if($range_request) {
while(my($offset, $length) = $r->each_byterange) {
$r->print(substr($contents, $offset, $length));
}
}
#I've also tried adding "return 206;" here. Apache still returns status code 200
else {
$r->print($contents);
}
return OK();
####
HTTP/1.1 200 OK
Date: Fri, 08 Jan 2010 22:06:46 GMT
Server: Apache/1.3.33 (Unix) mod_perl/1.29 PHP/5.2.10
Accept-Ranges: bytes
Last-Modified: Fri, 08 Jan 2010 20:35:02 GMT
Connection: close
Content-Type: text/html
####
HTTP/1.1 206 Partial Content
Date: Fri, 08 Jan 2010 21:25:23 GMT
Server: Apache/1.3.33 (Unix) mod_perl/1.29 PHP/5.2.10
Last-Modified: Thu, 14 Feb 2002 17:33:24 GMT
ETag: "1ea-23908b-3c6bf4e4"
Accept-Ranges: bytes
Content-Length: 147241
Content-Range: bytes 2183522-2330762/2330763
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/html