From: Joe Orton Date: Mon, 7 Jun 2004 10:31:52 +0000 (+0000) Subject: Backport from HEAD: X-Git-Tag: 2.0.50~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9829336879ed217bd6f40df25f453b53ccc63258;p=thirdparty%2Fapache%2Fhttpd.git Backport from HEAD: * modules/filters/mod_deflate.c (deflate_out_filter): Destroy buckets immediately after they are used so that memory consumption is not proportional to the size of the response. PR: 29318 Reviewed by: Jeff Trawick, Andr�� Malo git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@103868 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index d05b0ddfa2d..12de40922c5 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,9 @@ Changes with Apache 2.0.50 (trusted) client certificate subject DN which exceeds 6K in length. [Joe Orton] + *) mod_deflate: Fix memory consumption (which was proportional to the + response size). PR 29318. [Joe Orton] + *) mod_ssl: Log the errors returned on failure to load or initialize a crypto accelerator engine. [Joe Orton] diff --git a/STATUS b/STATUS index d142685a881..5676354241e 100644 --- a/STATUS +++ b/STATUS @@ -1,5 +1,5 @@ APACHE 2.0 STATUS: -*-text-*- -Last modified at [$Date: 2004/06/07 10:18:36 $] +Last modified at [$Date: 2004/06/07 10:31:51 $] Release: @@ -72,11 +72,6 @@ PATCHES TO BACKPORT FROM 2.1 [ please place file names and revisions from HEAD here, so it is easy to identify exactly what the proposed changes are! ] - *) mod_deflate: Fix memory consumption proportional to response size. - http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/filters/mod_deflate.c?r1=1.48&r2=1.49 - PR: 29318 - +1: jorton, trawick, nd - *) mod_ssl: Remove some unused functions (after CAN-2004-0488 fix is applied) http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/ssl/ssl_util.c?r1=1.46&r2=1.47 +1: jorton, nd diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index d9fef4f98a0..0bb478cb7a3 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -415,13 +415,15 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, ctx->stream.avail_out = c->bufferSize; } - APR_BRIGADE_FOREACH(e, bb) { + while (!APR_BRIGADE_EMPTY(bb)) + { const char *data; apr_bucket *b; apr_size_t len; - int done = 0; + e = APR_BRIGADE_FIRST(bb); + if (APR_BUCKET_IS_EOS(e)) { char *buf; unsigned int deflate_len; @@ -508,6 +510,9 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, if (APR_BUCKET_IS_FLUSH(e)) { apr_bucket *bkt; apr_status_t rv; + + apr_bucket_delete(e); + if (ctx->stream.avail_in > 0) { zRC = deflate(&(ctx->stream), Z_SYNC_FLUSH); if (zRC != Z_OK) { @@ -567,6 +572,8 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, if (zRC != Z_OK) return APR_EGENERAL; } + + apr_bucket_delete(e); } apr_brigade_cleanup(bb);