On Fri, 8 Jun 2001, Greg Stein wrote:

> > read on the (former) PIPE/SOCKET buckets was going to fail, it would have
> > failed earlier in the call to apr_brigade_length().  Right?
>
> Good point. (and let's also clarify to ourselves that we're just talking
> about the bytrange filter's use of partition; other partition users will
> still need to be wary of error return values)

Absolutely.  No doubt about it.

> However... (and you knew that was coming :-)

;-]

> Not if the PIPE has a known length, but simply hasn't read the data yet
> (dunno if PIPE can support this; if not, then just say there is another
> bucket that does).

They do not... neither to SOCKET buckets.  The general rule has always
been that any bucket that is of pre-defined length will be either a
"shared" bucket or a "simple" bucket, meaning that they can be split
without being read by simply adjusting the start/length values.  The only
buckets that do not support this are buckets of indeterminate length (ie,
length == -1).  But I guess that could change later (don't currently see
how, but let's just say that somebody figures out a need for such a
beast).  In that case, you're right, this would be necessary.  So for
future-proofness, we'll just say that it could happen.  Fair enough.


> [ note: apr_brigade_partition() does not properly handle *failure* in a
>   split operation; it assumes anything but ENOTIMPL is success ]

The old version did, but the patched version doesn't:

-            if (apr_bucket_split(e, point) != APR_ENOTIMPL)
-                return APR_BUCKET_NEXT(e);
+            if ((rv = apr_bucket_split(e, point)) != APR_ENOTIMPL) {
+                *after_point = APR_BUCKET_NEXT(e);
+                return rv;
+            }

While success and non-ENOTIMPL failure are handled by the same case, the
actual rv is returned.  So if that's APR_EOF or something, it will get
passed back.  *after_point is set anyway as a side effect, but that
doesn't matter.  Good?


> In fact, I am going to be changing mod_dav's interface to the back-end
> repository to use bucket brigades(*). Let's say that a database backend
> inserts a bucket that will read a BLOB out of a database. It knows the
> length is N bytes, but it certainly doesn't want to read all that into
> memory right away. So when it *does* read, it could fail (e.g. the database
> connection timed out).

Good example!


--Cliff


--------------------------------------------------------------
   Cliff Woolley
   [EMAIL PROTECTED]
   Charlottesville, VA


Reply via email to