Hi,
I'm running into a problem where range request support does not seem to
work as advertised. Luckily, it's easy to reproduce. =)
I'm using apache 2.2.22 and mod_perl 2.0.6, stock installs with:
PerlRequire /home/alex/modperl.pl
<Location /perl/>
SetHandler perl-script
PerlHandler VideoTest
</Location>
Alias /static/ /tmp/
<Directory /tmp/>
Allow From All
</Directory>
in my httpd.conf, and:
package VideoTest;
use Apache2::RequestIO;
sub handler {
my $r = shift;
$r->sendfile('/tmp/video.mp4');
return Apache2::Const::OK;
}
in my modperl.pl file. Place video.mp4 in /tmp, and the problem can be
seen with:
alex@alex ~ $ curl -s -r 0-1000 http://localhost:8001/static/video.mp4 | wc -c
1001
alex@alex ~ $ curl -s -r 0-1000 http://localhost:8001/perl/video.mp4 | wc -c
125569
alex@alex ~ $
So you can see serving via apache I get the 1001 bytes expected, but if
it goes through mod_perl handler, I get the full video.
Very similar problem described here:
http://www.gossamer-threads.com/lists/modperl/modperl/99880#99880
I dug into byterange_filter.c, and sure enough, under mod_perl we are
aborting the range request here:
/*
* Don't attempt to do byte range work if this brigade doesn't
* contain an EOS, or if any of the buckets has an unknown length;
* this avoids the cases where it is expensive to perform
* byteranging (i.e. may require arbitrary amounts of memory).
*/
if (!APR_BUCKET_IS_EOS(e) || clength <= 0) {
ap_remove_output_filter(f);
return ap_pass_brigade(f->next, bb);
}
added debug to confirm under mod_perl, clength was 125569 as expected,
and e was not EOS, so we abort. Removing the !APR_BUCKET_IS_EOS(e) test,
everything "works".
I don't understand the implications of not having an EOS bucket, or how
to set one in mod_perl (Apache::Filter has something on this, but
doesn't sound like the right direction).
Can anyone offer any insight or direction on this?
Thanks!
Alex
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]