From: Ryan Bloom Date: Fri, 10 Aug 2001 18:35:08 +0000 (+0000) Subject: This should fix the remaining problems with POST. Basically, we X-Git-Tag: 2.0.24~128 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a2cab6eda258e0b9707d95d81bc1e268e79b23e8;p=apache This should fix the remaining problems with POST. Basically, we 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 --- diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 397a269ed0..f178fa4eb3 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -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;