From: Ruediger Pluem Date: Thu, 20 Jul 2006 14:11:48 +0000 (+0000) Subject: * In preparation of the changes of the inflate out filter: X-Git-Tag: 2.3.0~2239 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23649ed1718aa71a7c98327046edc54a6f6470c5;p=thirdparty%2Fapache%2Fhttpd.git * In preparation of the changes of the inflate out filter: - rename flush_zlib_buffer to flush_libz_buffer (this name seems better) - add a parameter to tell flush_libz_buffer whether it should deflate or inflate as this function should be also used for the inflate out filter. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@423940 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/filters/mod_deflate.c b/modules/filters/mod_deflate.c index be55010a75d..2c22bb55747 100644 --- a/modules/filters/mod_deflate.c +++ b/modules/filters/mod_deflate.c @@ -214,9 +214,9 @@ typedef struct deflate_ctx_t apr_bucket_brigade *bb, *proc_bb; } deflate_ctx; -static int flush_zlib_buffer(deflate_ctx *ctx, deflate_filter_config *c, +static int flush_libz_buffer(deflate_ctx *ctx, deflate_filter_config *c, struct apr_bucket_alloc_t *bucket_alloc, - int flush) + int (*libz_func)(z_streamp, int), int flush) { int zRC; int done = 0; @@ -238,7 +238,7 @@ static int flush_zlib_buffer(deflate_ctx *ctx, deflate_filter_config *c, if (done) break; - zRC = deflate(&ctx->stream, flush); + zRC = libz_func(&ctx->stream, flush); if (deflate_len == 0 && zRC == Z_BUF_ERROR) zRC = Z_OK; @@ -450,7 +450,7 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, ctx->stream.avail_in = 0; /* should be zero already anyway */ /* flush the remaining data from the zlib buffers */ - flush_zlib_buffer(ctx, c, f->c->bucket_alloc, Z_FINISH); + flush_libz_buffer(ctx, c, f->c->bucket_alloc, deflate, Z_FINISH); buf = apr_palloc(r->pool, 8); putLong((unsigned char *)&buf[0], ctx->crc); @@ -505,7 +505,8 @@ static apr_status_t deflate_out_filter(ap_filter_t *f, apr_status_t rv; /* flush the remaining data from the zlib buffers */ - zRC = flush_zlib_buffer(ctx, c, f->c->bucket_alloc, Z_SYNC_FLUSH); + zRC = flush_libz_buffer(ctx, c, f->c->bucket_alloc, deflate, + Z_SYNC_FLUSH); if (zRC != Z_OK) { /* * Things screwed up. It is likely that we never return into