Hi, I am trying to migrate the following mod perl 1 code to mod perl 2 for a range request:
$r->headers_out->set('Accept-Ranges' => 'bytes'); my $range_request = $r->set_byterange; unless ((my $status = $r->meets_conditions) == OK) { return $status; } if ($range_request) { while( my($offset, $length) = $r->each_byterange) { seek $fh, $offset, 0; $r->send_fd($fh, $length); #TO DO: migrate to mod2 }
Reading up the documentation for mod perl 2: The functions $r->set_byterange and $r->each_byterange aren't in the Apache 2.0 API, and therefore don't exist in mod_perl 2.0. The byterange serving functionality is now implemented in the ap_byterange_filter, which is a part of the core http module, meaning that it's automatically taking care of serving the requested ranges off the normal complete response. There is no need to configure it. It's executed only if the appropriate request headers are set. These headers aren't listed here, since there are several combinations of them, including the older ones which are still supported. For a complete info on these see modules/http/http_protocol.c. sendfile accepts the following arguments: $filename $offset $length Is there a sequence of headers I am suppose to send out for it to interpret it as 206 partial download request? Thanks a bunch for any replies!
In reply to mod2 equivalence for ($r->set_byterange and each_byterange) by gcw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |