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 23:10:32 GMT
On Wed, 16 Aug 2000, Greg Stein wrote:

> On Wed, Aug 16, 2000 at 03:31:56PM -0700, wrote:
> > 
> > > 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
> Eek. Sorry, I wasn't clear enough. I meant to imply the file was
> zero-length. When the filebucket->read() is called, it will create a
> zero-length heap bucket for the file (non-) contents.
> > 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.
> I think it is just as easy for a filter to create a zero-length bucket as it
> is for the content generator. For example:
>     ap_bucket * foo(const char *s)
>     {
>         apr_ssize_t n;
>         b = ap_bucket_transient_create(s, strlen(s), &n);
> 	return b;
>     }
> We can either make all filter writers check every boundary case, or we can
> assist a bit.
> Now: I'm not saying it is *legal* to pass zero content-length brigades. I
> agree that that isn't a great idea, but I'm not willing to say they are
> definitely legal or definitely illegal. If we have some simple tests to help
> out when it occurs. Great.

I strongly disagree.  We are asking filter writers to just not pass
unchecked data down the filter.  Are we going to ask every filter writer
to check for the 0 length brigade case when doing their processing?

They only real way to protect against this case, is to have the
pass_brigade function check for 0 length brigades.  Or, just declare it as
an undefined operation, and expect filter writers to be smart.


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

View raw message