Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Here are headers I'm getting when fetching document served by handler doing the same:#$contents is content of entire file we are asked for, not a p +art 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_byte +range : 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 retur +ns status code 200 else { $r->print($contents); } return OK();
Here what headers same Apache returns when serving a part of some static file: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
So the questions - is it possible to serve partial http requests in mod_perl handlers? If yes, can you give a hint on what module does it (in order to see how it implements it)? The biggest problems I see is forcing apache to return proper status code and accept my Content-Range headers. Thanks in advance for your answers!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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: mod_perl handler inside apache 1.x serving partial content - is this possible? How?
by Anonymous Monk on Jan 12, 2010 at 11:48 UTC | |
|
Re: mod_perl handler inside apache 1.x serving partial content - is this possible? How?
by Anonymous Monk on Jan 12, 2010 at 11:49 UTC |