perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Krohn <>
Subject unable to handle range requests with handler
Date Thu, 24 May 2012 23:16:03 GMT

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/
    <Location /perl/>
        SetHandler perl-script
        PerlHandler VideoTest
    Alias /static/ /tmp/
    <Directory /tmp/>
        Allow From All

in my httpd.conf, and:

    package VideoTest;

    use Apache2::RequestIO;
    sub handler {
        my $r = shift;
        return Apache2::Const::OK;

in my 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
alex@alex ~ $ curl -s -r 0-1000 http://localhost:8001/perl/video.mp4 | wc -c
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:

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) {
        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?



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message