Return-Path: Delivered-To: apmail-new-httpd-archive@apache.org Received: (qmail 83209 invoked by uid 500); 16 Aug 2000 23:06:27 -0000 Mailing-List: contact new-httpd-help@apache.org; run by ezmlm Precedence: bulk X-No-Archive: yes Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list new-httpd@apache.org Received: (qmail 83197 invoked from network); 16 Aug 2000 23:06:27 -0000 X-Authentication-Warning: koj.rkbloom.net: rbb owned process doing -bs Date: Wed, 16 Aug 2000 16:10:32 -0700 (PDT) From: rbb@covalent.net X-Sender: rbb@koj.rkbloom.net To: new-httpd@apache.org Subject: Re: [PATCH] chunking filter. In-Reply-To: <20000816155305.A17689@lyra.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N On Wed, 16 Aug 2000, Greg Stein wrote: > On Wed, Aug 16, 2000 at 03:31:56PM -0700, rbb@covalent.net 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 _______________________________________________________________________________ Ryan Bloom rbb@apache.org 406 29th St. San Francisco, CA 94131 -------------------------------------------------------------------------------