Hi,
apr_brigade_length with readall set to 1 will try to read from a bucket
with length -1 to determine the value.
Currently, if apr_bucket_read with the bucket of length -1 returns other
than APR_SUCCESS, the length returned is undefined.
In case of a socket bucket with a nonblocking socket, the return status
could be EAGAIN and the length is still useful to determine value
available at the moment. A use case, for example, is waiting for a
certain amount of data to be available.
I would propose to return the value up-to-date is better than undefined.
The application can decide whether the value is meaningful with the
returned status. Does this make sense?
Attached is a simple path specifying the length.
Cheers,
Henry
Index: buckets/apr_brigade.c
===================================================================
--- buckets/apr_brigade.c (revision 449343)
+++ buckets/apr_brigade.c (working copy)
@@ -182,6 +182,7 @@
if ((status = apr_bucket_read(bkt, &ignore, &len,
APR_BLOCK_READ)) != APR_SUCCESS) {
+ *length = total;
return status;
}
}