]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Backport from HEAD:
authorJoe Orton <jorton@apache.org>
Mon, 7 Jun 2004 10:31:52 +0000 (10:31 +0000)
committerJoe Orton <jorton@apache.org>
Mon, 7 Jun 2004 10:31:52 +0000 (10:31 +0000)
  * 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

CHANGES
STATUS
modules/filters/mod_deflate.c

diff --git a/CHANGES b/CHANGES
index d05b0ddfa2dd0bdbeab7aa71ab1608ea6682d270..12de40922c58ab1e4964ecd29a407b6b80039ef7 100644 (file)
--- 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 d142685a881fc5a524800b177694b8e0bf6b9cdf..5676354241eafb1e11f647296d7942bf1054871c 100644 (file)
--- 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
index d9fef4f98a0ebbd0566cfaffb8848355d94a0a04..0bb478cb7a3757506487de6c61085b6d3ea61e03 100644 (file)
@@ -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);