From: Justin Erenkrantz Date: Wed, 29 May 2002 06:40:23 +0000 (+0000) Subject: Implement flushing support for mod_deflate. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6b419c62f46ded7ac4123b614fcecd987ef9ab0d;p=apache 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 --- diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index 7f17d0611c..001af661fa 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -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; }