apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@covalent.net>
Subject Re: apr_bucket_simple_split
Date Sun, 26 Aug 2001 23:48:48 GMT

> > >  {
> > >      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
--------------------------------------------------------------

Mime
View raw message