Commit 6b419c62 authored by Justin Erenkrantz's avatar Justin Erenkrantz
Browse files

Implement flushing support for mod_deflate.

(Review of RFC 1952 indicates that this is indeed easily allowable.)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95341 13f79535-47bb-0310-9956-ffa450edef68
parent a0c92a0b
Loading
Loading
Loading
Loading
+16 −6
Changes for modules/filters/mod_deflate.c: 16 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -438,13 +438,23 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
        }

        if (APR_BUCKET_IS_FLUSH(e)) {
            /* XXX FIX: do we need the Content-Size set, or can we stream?
             * we should be able to stream
             */
            apr_bucket *bkt;
            zRC = deflate(&(ctx->stream), Z_SYNC_FLUSH);
            if (zRC != Z_OK) {
                return APR_EGENERAL;
            }

            /* Ignore flush buckets for the moment.. we can't stream as we
             * need the size ;(
             */
            ctx->stream.next_out = ctx->buffer;
            len = c->bufferSize - ctx->stream.avail_out;

            b = apr_bucket_heap_create((char *)ctx->buffer, len,
                                       NULL, f->c->bucket_alloc);
            APR_BRIGADE_INSERT_TAIL(ctx->bb, b);
            ctx->stream.avail_out = c->bufferSize;

            bkt = apr_bucket_flush_create(f->c->bucket_alloc);
            APR_BRIGADE_INSERT_TAIL(ctx->bb, bkt);
            ap_pass_brigade(f->next, ctx->bb);
            continue;
        }