httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <n...@webthing.com>
Subject Re: Traversing the bucket brigade from last to first in the output filter
Date Sat, 14 Oct 2006 10:40:21 GMT
On Saturday 14 October 2006 10:23, Vlastimil Pavicek wrote:
> Hello,
>
> at first sorry for a quite longer mail(and for a bad english).
>
> I am a student working on a project including an apache output filter. I
> encountered a strange behavior of a bucket brigade when it is traversed
> from the last bucket (APR_BRIGADE_LAST(..)) to the first one
> (APR_BRIGADE_FIRST(..)) using APR_BUCKET_PREV(..).
>
> For testing purposes I splitted incoming bucket brigade (size 18567) using:

Where does that come from, and what breakdown of individual buckets in there?
Is it by any chance a source (eg pipe or socket) rather than a store?

> b=APR_BRIGADE_FIRST(bb);
> if(apr_bucket_split(b,100)!=APR_SUCCESS) my_error(1);
>
> b=APR_BUCKET_NEXT(b);
> if(apr_bucket_split(b,100)!=APR_SUCCESS) my_error(2);
>
> b=APR_BUCKET_NEXT(b);
> if(apr_bucket_split(b,100)!=APR_SUCCESS) my_error(3);
>
> Then I try to traverse the brigade from the last bucket to the first one:
>
> b=APR_BRIGADE_LAST(bb);

If we hypothesize that your input was a single bucket, then it's
3*100 + LAST.  And what's wrong is the size of LAST at this point.
Is LAST by any chance a Heap bucket?

> while(b!=APR_BRIGADE_SENTINEL(bb)) {
>
>     ..dump the contents of bucket into file to see it's contents
>
>     b=APR_BUCKET_PREV(b);
> }
>
> I got a set of files with the contents of individual buckets.
>
> Then I traverse the brigade from the first bucket to the last one:
>
> b=APR_BRIGADE_FIRST(bb);
> while(b!=APR_BRIGADE_SENTINEL(bb)) {
>
>     ..dump the contents of bucket into file to see it's contents
>
>     b=APR_BUCKET_NEXT(b);
> }
>
> I got an another set files with the contents of individual buckets.

And what happens if you traverse it backwards after going forwards?

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.prenhallprofessional.com/title/0132409674

Mime
View raw message