ap_http_filter seems to assume it will receive an empty brigade from its caller. The problem is around lines 1028 - 1035 in http_protocol.c:
rv = ap_get_brigade(f->next, b, mode, block, readbytes);
if (rv != APR_SUCCESS) { return rv; }
/* How many bytes did we just read? */ apr_brigade_length(b, 0, &totalread);
totalread is only accurate in this context if b was empty to begin with. Is this is a bug in ap_http_filter?
I think that assumptions is valid for all filters and is correct by (an undocumented) design.
If I understand things correctly, If you want to re-use some older bbs (e.g. from previous invocations or if you have an underrun and ask for more during the same invocation), you should create a new bb, pass it to ap_get_brigade() and then merge with the previous one.
Here is a snippet from t/filter/TestFilter/in_bbs_underrun.pm, though I rip the data off, rather than merge.
# fetch and consume bucket brigades untill we have at least SIZE
# bytes to work with
do {
my $tbb = APR::Brigade->new($filter->r->pool, $ba);
my $rv = $filter->next->get_brigade($tbb, $mode, $block, $readbytes);
($data, $seen_eos) = flatten_bb($tbb);
$tbb->destroy;
$buffer .= $data;
} while (!$seen_eos && length($buffer) < SIZE);it should be pretty much the same in C.
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
