(blocking or not).
apr_brigade_partition would do reading multiple times and that's
not really what we want (so I think).
This may speed up POST requests that were waiting for all of the
data to arrive before returning anything in blocking mode.
Reviewed by: Greg Stein, Ryan Bloom
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91322
13f79535-47bb-0310-9956-
ffa450edef68
apr_bucket *e;
apr_bucket_brigade *newbb;
- if (mode == APR_NONBLOCK_READ) {
- e = APR_BRIGADE_FIRST(ctx->b);
- rv = apr_bucket_read(e, &str, &len, mode);
+ e = APR_BRIGADE_FIRST(ctx->b);
+ if ((rv = apr_bucket_read(e, &str, &len, mode) != APR_SUCCESS)) {
+ return rv;
+ }
- if (len < *readbytes)
- *readbytes = len;
+ /* We can only return at most what the user asked for. */
+ if (len < *readbytes) {
+ *readbytes = len;
}
apr_brigade_partition(ctx->b, *readbytes, &e);