Return-Path: Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 15885 invoked by uid 500); 26 Aug 2001 23:52:22 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 15874 invoked from network); 26 Aug 2001 23:52:21 -0000 Content-Type: text/plain; charset="iso-8859-1" From: Ryan Bloom Reply-To: rbb@covalent.net Organization: Covalent Technologies To: "William A. Rowe, Jr." , "Greg Stein" , Subject: Re: apr_bucket_simple_split Date: Sun, 26 Aug 2001 16:48:48 -0700 X-Mailer: KMail [version 1.2] References: <20010826020022.E2111@lyra.org> <076701c12e4c$78411d50$95c0b0d0@roweclan.net> In-Reply-To: <076701c12e4c$78411d50$95c0b0d0@roweclan.net> MIME-Version: 1.0 Message-Id: <0108261648480A.23573@koj.rkbloom.net> Content-Transfer-Encoding: 8bit X-Spam-Rating: 64.125.133.20 1.6.2 0/1000/N > > > { > > > apr_bucket *b; > > > apr_status_t rv; > > > > > > - if (point < 0 || point > a->length) { > > > + if ((point > a->length) || (a->length == (apr_size_t)(-1))) { > > > return APR_EINVAL; > > > } > > > > > > > > > Why check to see if a->length is -1? That's a waste of time. If > > > a->length is -1, the bucket type should have never registered a split > > > function in the first place. > > > > Untrue. Please explain why a PIPE bucket cannot be split at byte 100? > > Sure, it doesn't know its length, but it can easily read in 100 bytes, > > give you that, and leave itself as the second part of the split. > > I agree here, we can split an unknown length pipe bucket at known point. > I'd suggest that we really want a constant, APR_BUCKET_UNKNOWN_LEN (which > needs to map to MAX_SIZE_T or MAX_OFF_T, see below). But I'm not certain > that the apr_bucket_split_simple() should learn how to do this, sounds like > a job for apr_bucket_split_indeterminate() or something. No, it is not possible to split a bucket with an unknown length. I have explained this at great length, many times. Bucket split is a non-destructive operation, but splitting a bucket without a length changes the make-up of the brigade. Instead of having two buckets of the same type, you can end up having mutliple heap buckets, and one pipe bucket. Yes, I agree that splitting a PIPE or SOCKET bucket is easy in the simple case. Mt problem is the non-trivial case. What do you do when there is an error, or when you can't read enough data from the bucket? How many times do you try to read? It is best to leave these decisions to the filter that is doing the splitting. Ryan ______________________________________________________________ Ryan Bloom rbb@apache.org Covalent Technologies rbb@covalent.net --------------------------------------------------------------