Commit d39f516f authored by Justin Erenkrantz's avatar Justin Erenkrantz
Browse files

Fix mod_deflate corruption when using multiple input buckets. We should

only clear *_out when we are the beginning or avail_out == 0.

Justin was tracking this down before he went to WWDC and didn't finish
before he left.  A (virtual) beer goes to Asada who filed this PR with
the right patch!

PR: 9014
Submitted by:	kaz@asada.sytes.net (ASADA Kazuhisa)
Reviewed by:	Justin Erenkrantz


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95055 13f79535-47bb-0310-9956-ffa450edef68
parent 8c9369a4
Loading
Loading
Loading
Loading
+3 −0
Changes for CHANGES: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
Changes with Apache 2.0.37
  *) Fix mod_deflate corruption when using multiple buckets.  PR 9014.
     [Asada Kazuhisa <kaz@asada.sytes.net>]
  *) Performance enhancements for access logger when using
     default timestamp formatting  [Brian Pane]
+4 −2
Changes for modules/filters/mod_deflate.c: 4 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -327,6 +327,10 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
        apr_table_unset(r->headers_out, "Content-Length");
    }
    
    /* initialize deflate output buffer */
    ctx->stream.next_out = ctx->buffer;
    ctx->stream.avail_out = c->bufferSize;

    APR_BRIGADE_FOREACH(e, bb) {
        const char *data;
        apr_bucket *b;
@@ -436,8 +440,6 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
                                                      * but we'll just have to
                                                      * trust zlib */
        ctx->stream.avail_in = len;
        ctx->stream.next_out = ctx->buffer;
        ctx->stream.avail_out = c->bufferSize;

        while (ctx->stream.avail_in != 0) {
            if (ctx->stream.avail_out == 0) {