Commit f1fccc93 authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Merge r1619483 from trunk:

mod_deflate: follow up to r1619444.

Fix counting of inflated bytes in deflate_in_filter() when asked to flush, since
we now count bytes per inflate() call everywhere, we can't count all the produced
bytes there.

We still need to include all the produced bytes in the brigade.

Submitted by: ylavic
Reviewed/backported by: jim


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1735771 13f79535-47bb-0310-9956-ffa450edef68
parent 3eef1b58
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -112,12 +112,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
  [ start all new proposals below, under PATCHES PROPOSED. ]

  *) mod_deflate: follow up to r1619444 (and to r1619383). (backported in r1669555)
                  Fix counting of inflated bytes in deflate_in_filter() when
                  asked to flush
     trunk patch: http://svn.apache.org/r1619483
     2.4.x patch: trunk works
     +1: ylavic, icing, trawick

PATCHES PROPOSED TO BACKPORT FROM TRUNK:
  [ New proposals should be added at the end of the list ]
+8 −7
Original line number Diff line number Diff line
@@ -1254,7 +1254,10 @@ static apr_status_t deflate_in_filter(ap_filter_t *f,

            if (APR_BUCKET_IS_FLUSH(bkt)) {
                apr_bucket *tmp_b;

                ctx->inflate_total += ctx->stream.avail_out;
                zRC = inflate(&(ctx->stream), Z_SYNC_FLUSH);
                ctx->inflate_total -= ctx->stream.avail_out;
                if (zRC != Z_OK) {
                    inflateEnd(&ctx->stream);
                    ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(01391)
@@ -1263,10 +1266,6 @@ static apr_status_t deflate_in_filter(ap_filter_t *f,
                    return APR_EGENERAL;
                }
 
                ctx->stream.next_out = ctx->buffer;
                len = c->bufferSize - ctx->stream.avail_out;
 
                ctx->inflate_total += len;
                if (inflate_limit && ctx->inflate_total > inflate_limit) { 
                    inflateEnd(&ctx->stream);
                    ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(02647)
@@ -1286,10 +1285,13 @@ static apr_status_t deflate_in_filter(ap_filter_t *f,
                    return APR_EINVAL;
                }

                len = c->bufferSize - ctx->stream.avail_out;
                ctx->crc = crc32(ctx->crc, (const Bytef *)ctx->buffer, len);
                tmp_b = apr_bucket_heap_create((char *)ctx->buffer, len,
                                                NULL, f->c->bucket_alloc);
                APR_BRIGADE_INSERT_TAIL(ctx->proc_bb, tmp_b);

                ctx->stream.next_out = ctx->buffer;
                ctx->stream.avail_out = c->bufferSize;

                /* Flush everything so far in the returning brigade, but continue
@@ -1350,9 +1352,9 @@ static apr_status_t deflate_in_filter(ap_filter_t *f,
                        ctx->stream.avail_out = c->bufferSize;
                    }

                    len = ctx->stream.avail_out;
                    ctx->inflate_total += ctx->stream.avail_out;
                    zRC = inflate(&ctx->stream, Z_NO_FLUSH);

                    ctx->inflate_total -= ctx->stream.avail_out;
                    if (zRC != Z_OK && zRC != Z_STREAM_END) {
                        inflateEnd(&ctx->stream);
                        ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(01392)
@@ -1361,7 +1363,6 @@ static apr_status_t deflate_in_filter(ap_filter_t *f,
                        return APR_EGENERAL;
                    }

                    ctx->inflate_total += len - ctx->stream.avail_out;
                    if (inflate_limit && ctx->inflate_total > inflate_limit) { 
                        inflateEnd(&ctx->stream);
                        ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(02648)