perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Krohn <a...@gt.net>
Subject Re: unable to handle range requests with handler
Date Fri, 25 May 2012 15:27:06 GMT
Hi Joe,

> Largely depends on how httpd implements SSI I think- if they
> use sendfile then the bucket isn't there for good reason.
> Have you considered driving the output filter chain yourself,
> that way *you* can put an EOS bucket on the first brigade you
> build and pass to ap_pass_brigade.  That'd be the way I'd
> go rather than hoping httpd includes your patch (essentially
> implement ap_send_fd in perl).

I don't think Apache uses ap_send_fd at all (verified by a grep), and
mentioned here:

    http://www.gossamer-threads.com/lists/apache/dev/64653#64653

Also, I was certainly thrown off by docs that suggested with apache 2,
it "just worked", i.e.:

    http://perl.apache.org/docs/2.0/user/porting/compat.html#C____r_E_gt_set_byterange___

and a few mailing lists posts. Once I sort this out, will put a doc
patch back to make it clear. =)

Would it be worth implementing the ap_send_fd code in xs/Apache2/RequestIO/Apache2__RequestIO.h
with the eos bucket there? I think it would be really nice if range
requests "just worked" out of the box. =)

If patching mod_perl/apache doesn't make sense (and it may not, still
not 100% about implications of having the eos bucket in ap_send_fd /
requestio sendfile, or the reason for the check for it in range requests),
can you provide a pointer on how to do this with filters?

i.e. can I do something like:

sub handler {
    my $r = shift;
    $r->sendfile('/tmp/video.mp4');
    $r->add_output_filter(\&add_eos);
    return Apache2::Const::OK;
}

sub add_eos {
    my ($f, $bb) = @_;
    my $ba = $bb->bucket_alloc;
    my $b = APR::Bucket::eos_create($ba);
    $bb->insert_tail($b);
    my $rv = $f->next->pass_brigade($bb);
    return $rv unless $rv == APR::Const::SUCCESS;
    return Apache2::Const::OK;
}

Well, I can't as it doesn't work, but am I on the right track? =)

Cheers,

Alex


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message