Hi,

I'm working on a problem where mod_perl doesn't seem to accept range
requests documented here:

    http://www.gossamer-threads.com/lists/modperl/dev/104360

Working with 2.2.22, my issue seems to be the mod_perl sendfile
implementation uess ap_send_fd, and ap_send_fd does not create an EOS
bucket, so in byterange_filter.c:

/*
* 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);
} 

we don't handle range requests, and so my mod_perl handler does not work
with range requests.

My question is should ap_send_fd be inserting an eos bucket? i.e.

alex@alex ~/httpd-2.2.22 $ diff -u server/protocol.c.orig server/protocol.c
--- server/protocol.c.orig      2012-01-24 12:02:19.000000000 -0800
+++ server/protocol.c   2012-05-24 18:24:57.914018451 -0700
@@ -1386,6 +1386,8 @@
     bb = apr_brigade_create(r->pool, c->bucket_alloc);
     b = apr_bucket_file_create(fd, offset, len, r->pool, c->bucket_alloc);
     APR_BRIGADE_INSERT_TAIL(bb, b);
+    b = apr_bucket_eos_create(c->bucket_alloc);
+    APR_BRIGADE_INSERT_TAIL(bb, b);
 
     rv = ap_pass_brigade(r->output_filters, bb);
     if (rv != APR_SUCCESS) {
alex@alex ~/httpd-2.2.22 $ 

which does "fix" the problem for me (i.e. range requests work), but I
have no idea the implications behind this and the warning in the comment
about arbitrary amounts of memory. =)

Thanks for any help/guidance you can provide.

Cheers,

Alex

Reply via email to