summaryrefslogtreecommitdiffstats
path: root/modules/filters
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2004-06-01 15:06:10 +0200
committerJoe Orton <jorton@apache.org>2004-06-01 15:06:10 +0200
commit5154894e093b2c3652f5f35fb32b9fd75486ddd4 (patch)
treeb4ebd477d4e118501b6318a771feeb91251bce95 /modules/filters
parentFix bug in mod_deflate that unconditionally sent deflate'd output even when (diff)
downloadapache2-5154894e093b2c3652f5f35fb32b9fd75486ddd4.tar.xz
apache2-5154894e093b2c3652f5f35fb32b9fd75486ddd4.zip
* 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
Diffstat (limited to 'modules/filters')
-rw-r--r--modules/filters/mod_deflate.c12
1 files 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);