httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: [PATCH] chunking filter.
Date Wed, 16 Aug 2000 22:31:56 GMT

> Well, I think it is just a bit too easy to create, say, a file bucket and
> then pass that into the filter chain. Some filter in the chain reads the
> contents out (oops! zero length) and passes them down. Or simply some code
> that looks like this:

Reading content out of a FILE bucket does not leave the brigade empty.  It
moves in into another bucket.  This was designed in the meeting.  The only
way for a filter to pass down a zero-length brigade is really for it to
pass an empty bucket brigade.  We are asking filters to take
responsability for not passing stupid things down the stack.

>     void foo(const char *s)
>     {
>         ap_rputs(s, r);
>     }
> And somebody calls foo() with an empty string. I inserted a fix for this
> latter case (in ap_rputs()) to check for zero length strings. But the
> general problem of creating zero-length brigades exists. I think it would be
> prudent to watch out for them. *Especially* if we're computing the length
> anyhow. We may as well handle the case if we see zero-length.

> > > > > *) if the brigade contains EOS, then append the right "termination"
> > > > >    for the chunking. the appending is really that... the termination
> > > > >    must come before the EOS bucket :-)
> > 
> > As is this.> 
> In an updated patch, I presume? Great.

No, in the current patch.  As I said, this is a working patch.  

> I'm not sure on the add_filter changes yet (LIFO vs FIFO seems to simply
> reverse the problem rather than generically solve it).
> The chunking filter patch looks close. The EOS and output-last-chunk needs
> to move from the finalize function to the chunk_filter. Did you do this part
> yet?

This patch works.  There is nothing in the finalize function that should
be moved into the chunk filter.  All the finalize function does is call
end_output_stream, which inserts an EOS bucket.  The current chunk filter
already handles the EOS case.  The only case left to handle, is when there
is an EOS bucket at the end of a brigade that has other data in it.  That
case is handled on my computer.

I am committing in under an hour, I just need to fix a minor bug in
some other code I am working on.


Ryan Bloom               
406 29th St.
San Francisco, CA 94131

View raw message