Thank you for your reply, I will try to answer your questions.
> > I got following for the first bucket in this brigade just when I got it:
> > APR_BUCKET_IS_FILE -> 1
>
> OK, a static file.
>
> > There are two buckets sized 18567 and 0.
>
> FILE + EOS.
>
> > > > 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?
>
> So how exactly did you read that last bucket, and what exactly
> did the read function return? Perhaps you could put your demo
> source code up where we can look at it.
Source code is at
http://www.volny.cz/jeword/a/mod_txt.c
Some of you might not see this code for the first time :)
The problematic traversal starts at line 222.
> > LAST (size 0):
> > APR_BUCKET_IS_METADATA -> 1
> > APR_BUCKET_IS_EOS -> 1
> >
> > LAST->PREV (size 8000)
> > APR_BUCKET_IS_HEAP -> 1
>
> I'd guess that's *after* reading it? What does it look like before?
Before reading:
LAST (size 0):
APR_BUCKET_IS_METADATA -> 1
APR_BUCKET_IS_EOS -> 1
LAST->PREV (size 8000):
APR_BUCKET_IS_FILE -> 1
LAST->PREV->PREV (size 100):
APR_BUCKET_IS_FILE -> 1
LAST->PREV->PREV->PREV (size 100):
APR_BUCKET_IS_FILE -> 1
LAST->PREV->PREV->PREV->PREV (size 100):
APR_BUCKET_IS_FILE -> 1
The brigade stays truncated.
Thank to all for their effort, I look forward to the explanation
Vlastimil Pavicek, CTU Prague