From: Ryan Bloom Date: Sat, 14 Oct 2000 06:21:38 +0000 (+0000) Subject: My last patch had most of the code to insert the eos bucket, but it was X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29c98036d19594cc2033b5a6305abfb47b0cc2dc;p=apache My last patch had most of the code to insert the eos bucket, but it was missing some major pieces that I only found after the commit. This patch fixes the problem, and makes sure that request bodies are always ended with an EOS bucket. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86588 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index fe2f9be262..9f9aab4e30 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -889,9 +889,15 @@ apr_status_t http_filter(ap_filter_t *f, ap_bucket_brigade *b, apr_ssize_t lengt } } + e = AP_BRIGADE_FIRST(b); + if (f->c->remain == 0 && e->type == ap_eos_type()) { + bb = ap_brigade_split(b, AP_BUCKET_NEXT(e)); + ctx->b = bb; + return APR_SUCCESS; + } + if (f->c->remain) { int total = 0; - e = AP_BRIGADE_FIRST(b); len = length; while (e != AP_BRIGADE_SENTINEL(b)) { const char *ignore; @@ -907,15 +913,15 @@ apr_status_t http_filter(ap_filter_t *f, ap_bucket_brigade *b, apr_ssize_t lengt } if (e != AP_BRIGADE_SENTINEL(b)) { ap_bucket *eos_bucket; - if (total >= length) { + if (total > length) { ap_bucket_split(e, len); total = length; } bb = ap_brigade_split(b, AP_BUCKET_NEXT(e)); ctx->b = bb; - if (f->c->remain == 0) { + if (f->c->remain == total) { eos_bucket = ap_bucket_create_eos(); - AP_BUCKET_INSERT_AFTER(e, eos_bucket); + AP_BRIGADE_INSERT_HEAD(bb, eos_bucket); } f->c->remain -= total; return APR_SUCCESS;