Mercurial > hg > nginx
diff src/http/modules/ngx_http_gzip_filter.c @ 327:e0f3f238db09
nginx-0.0.3-2004-04-26-17:40:01 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 26 Apr 2004 13:40:01 +0000 |
parents | 8733703a37f3 |
children | d4241d7787fe |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_gzip_filter.c +++ b/src/http/modules/ngx_http_gzip_filter.c @@ -591,15 +591,15 @@ static int ngx_http_gzip_body_filter(ngx ctx->in_hunk, ctx->in_hunk->pos); -#if 0 - if (!ctx->redo) { + if (ctx->zstream.next_in) { ctx->in_hunk->pos = ctx->zstream.next_in; - ctx->out_hunk->last = ctx->zstream.next_out; + + if (ctx->zstream.avail_in == 0) { + ctx->zstream.next_in = NULL; + } } -#else - ctx->in_hunk->pos = ctx->zstream.next_in; + ctx->out_hunk->last = ctx->zstream.next_out; -#endif if (ctx->zstream.avail_out == 0) { ngx_alloc_link_and_set_hunk(cl, ctx->out_hunk, r->pool, @@ -626,9 +626,7 @@ static int ngx_http_gzip_body_filter(ngx break; } - if (ctx->flush == Z_FINISH) { - - /* rc == Z_STREAM_END */ + if (rc == Z_STREAM_END) { ctx->zin = ctx->zstream.total_in; ctx->zout = 10 + ctx->zstream.total_out + 8; @@ -642,8 +640,6 @@ static int ngx_http_gzip_body_filter(ngx ngx_pfree(r->pool, ctx->preallocated); - ctx->flush = Z_NO_FLUSH; - ngx_alloc_link_and_set_hunk(cl, ctx->out_hunk, r->pool, ngx_http_gzip_error(ctx)); *ctx->last_out = cl; @@ -716,12 +712,6 @@ static int ngx_http_gzip_body_filter(ngx return last; } -#if 0 - if (ctx->out == NULL && last != NGX_NONE) { - return last; - } -#endif - last = ngx_http_next_body_filter(r, ctx->out); if (last == NGX_ERROR) { @@ -731,6 +721,10 @@ static int ngx_http_gzip_body_filter(ngx ngx_chain_update_chains(&ctx->free, &ctx->busy, &ctx->out, (ngx_hunk_tag_t) &ngx_http_gzip_filter_module); ctx->last_out = &ctx->out; + + if (ctx->done) { + return last; + } } }