From: Ruediger Pluem <rpluem@apache.org>
Date: Sun, 9 Dec 2007 22:03:10 +0000 (+0000)
Subject: * Do not split the brigade if the flush bucket is the last bucket in the brigade.
X-Git-Tag: 2.3.0~1159
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=826016b3fdb138d69ea73ffde7aa4faea3b2e5d2;p=apache

* Do not split the brigade if the flush bucket is the last bucket in the brigade.

PR: 23567
Submitted by: Stefan Fritsch <sf sfritsch.de>
Reviewed by: rpluem


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

diff --git a/CHANGES b/CHANGES
index 1b08894473..d54bf10e23 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@
 Changes with Apache 2.3.0
 [ When backported to 2.2.x, remove entry from this file ]
 
+  *) core: Lower memory consumption in case that flush buckets are passed thru
+     the chunk filter as last bucket of a brigade. PR 23567.
+     [Stefan Fritsch <sf sfritsch.de>]
+
   *) mod_proxy: Keep connections to the backend persistent in the HTTPS case.
      [Ruediger Pluem]
 
diff --git a/modules/http/chunk_filter.c b/modules/http/chunk_filter.c
index 2c94b3cae5..b680185b80 100644
--- a/modules/http/chunk_filter.c
+++ b/modules/http/chunk_filter.c
@@ -85,7 +85,9 @@ apr_status_t ap_http_chunk_filter(ap_filter_t *f, apr_bucket_brigade *b)
             }
             if (APR_BUCKET_IS_FLUSH(e)) {
                 flush = e;
-                more = apr_brigade_split(b, APR_BUCKET_NEXT(e));
+                if (e != APR_BRIGADE_LAST(b)) {
+                    more = apr_brigade_split(b, APR_BUCKET_NEXT(e));
+                }
                 break;
             }
             else if (e->length == (apr_size_t)-1) {