]> granicus.if.org Git - apache/commitdiff
We should only be doing one socket read under any circumstances
authorJustin Erenkrantz <jerenkrantz@apache.org>
Sat, 6 Oct 2001 00:47:06 +0000 (00:47 +0000)
committerJustin Erenkrantz <jerenkrantz@apache.org>
Sat, 6 Oct 2001 00:47:06 +0000 (00:47 +0000)
(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

server/core.c

index 10139a7721de49964468048f58d8bcdd91024bb9..aa4b5a876464acea66781b4edea151e7622e810b 100644 (file)
@@ -2853,12 +2853,14 @@ static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mod
         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);