]> granicus.if.org Git - apache/commitdiff
This should fix the remaining problems with POST. Basically, we
authorRyan Bloom <rbb@apache.org>
Fri, 10 Aug 2001 18:35:08 +0000 (18:35 +0000)
committerRyan Bloom <rbb@apache.org>
Fri, 10 Aug 2001 18:35:08 +0000 (18:35 +0000)
add a new macro, called APR_BRIGADE_NORMALIZE.  This macro searches
all the buckets, and removes any zero length bucket.  They we can
just use APR_BRIGADE_EMPTY to determine if our brigade has any data,
and we can quickly call ap_get_brigade if it doesn't.

Doug, please throw your battery of tests at this to make sure it works.

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

modules/http/http_protocol.c

index 397a269ed0f18f91ab5263372dc2e1657b9397cb..f178fa4eb315e98296bedac078fec5a8aaa95e6b 100644 (file)
@@ -677,9 +677,21 @@ apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode
            ### READBYTES bytes, and we wouldn't have to do any work.
         */
 
+        APR_BRIGADE_NORMALIZE(ctx->b);
+        if (APR_BRIGADE_EMPTY(ctx->b)) {
+            if ((rv = ap_get_brigade(f->next, ctx->b, mode, readbytes)) != APR_SUCCESS) {
+                return rv;
+            }
+        }
+            
         apr_brigade_partition(ctx->b, *readbytes, &e);
         APR_BRIGADE_CONCAT(b, ctx->b);
-        ctx->b = apr_brigade_split(b, e);
+        if (e != APR_BRIGADE_SENTINEL(ctx->b)) {
+            ctx->b = apr_brigade_split(b, e);
+        }
+        else {
+            ctx->b = NULL;
+        }
         apr_brigade_length(b, 1, &total);
         *readbytes -= total;