From 5154894e093b2c3652f5f35fb32b9fd75486ddd4 Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Tue, 1 Jun 2004 13:06:10 +0000 Subject: [PATCH] * modules/filters/mod_deflate.c (deflate_out_filter): Destroy buckets immediately after are used so that memory consumption is not proportional to the size of the response. PR: 29318 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103810 13f79535-47bb-0310-9956-ffa450edef68 --- modules/filters/mod_deflate.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index 07464fe6d5..e63ba18c4c 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -420,16 +420,15 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, ctx->stream.avail_out = c->bufferSize; } - for (e = APR_BRIGADE_FIRST(bb); - e != APR_BRIGADE_SENTINEL(bb); - e = APR_BUCKET_NEXT(e)) + 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; @@ -516,6 +515,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) { @@ -575,6 +577,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); -- 2.50.1