Commit 770fbfd6 authored by Joe Orton's avatar Joe Orton
Browse files

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
parent 41f59653
Loading
Loading
Loading
Loading
+3 −0
Changes for CHANGES: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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]
+1 −6
Changes for STATUS: 1 added line, 6 removed lines.
Original line number Diff line number Diff line
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
+9 −2
Changes for modules/filters/mod_deflate.c: 9 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -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);