]> granicus.if.org Git - apache/commitdiff
Cautiously avoiding the scoping issue that was discussed on the list,
authorAaron Bannert <aaron@apache.org>
Tue, 16 Oct 2001 01:04:08 +0000 (01:04 +0000)
committerAaron Bannert <aaron@apache.org>
Tue, 16 Oct 2001 01:04:08 +0000 (01:04 +0000)
I thought these other changes needed to go in; Namely that we don't
need to check if the brigade is empty twice in the loop, just once.
Added a comment for good measure.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91478 13f79535-47bb-0310-9956-ffa450edef68

modules/http/http_protocol.c

index cf1ab764b6d4d27b9f71999dfc79c61d3e87fb39..cb088e5b65f38052687c87b525dbc8130a5e0cc4 100644 (file)
@@ -1370,22 +1370,21 @@ AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, apr_size_t bu
                                                     &core_module);
     apr_bucket_brigade *bb = req_cfg->bb;
 
-    do {
+    /* read until we get a non-empty brigade */
+    while (APR_BRIGADE_EMPTY(bb)) {
         apr_off_t len_read;
-        if (APR_BRIGADE_EMPTY(bb)) {
-            len_read = r->remaining;
-            if (ap_get_brigade(r->input_filters, bb, AP_MODE_BLOCKING,
-                               &len_read) != APR_SUCCESS) {
-                /* if we actually fail here, we want to just return and
-                 * stop trying to read data from the client.
-                 */
-                r->connection->keepalive = -1;
-                apr_brigade_destroy(bb);
-                return -1;
-            }
-            r->remaining -= len_read;
+        len_read = r->remaining;
+        if (ap_get_brigade(r->input_filters, bb, AP_MODE_BLOCKING,
+                           &len_read) != APR_SUCCESS) {
+            /* if we actually fail here, we want to just return and
+             * stop trying to read data from the client.
+             */
+            r->connection->keepalive = -1;
+            apr_brigade_destroy(bb);
+            return -1;
         }
-    } while (APR_BRIGADE_EMPTY(bb));
+        r->remaining -= len_read;
+    } 
 
     b = APR_BRIGADE_FIRST(bb);
     if (APR_BUCKET_IS_EOS(b)) { /* reached eos on previous invocation */