]> git.kaiwu.me - nginx.git/commitdiff
Gzip: clearing of c->buffered if all data are flushed.
authorMaxim Dounin <mdounin@mdounin.ru>
Thu, 25 Jul 2013 10:55:32 +0000 (14:55 +0400)
committerMaxim Dounin <mdounin@mdounin.ru>
Thu, 25 Jul 2013 10:55:32 +0000 (14:55 +0400)
This allows to finalize unfinished responses while still sending as
much data as available.

src/http/modules/ngx_http_gzip_filter_module.c

index 35dd07ec4736ac26800cb63b767a6bfc58f3de82..837b0bc98953991689fa25c60f3118b81f9a1580 100644 (file)
@@ -368,6 +368,8 @@ ngx_http_gzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
         if (ngx_chain_add_copy(r->pool, &ctx->in, in) != NGX_OK) {
             goto failed;
         }
+
+        r->connection->buffered |= NGX_HTTP_GZIP_BUFFERED;
     }
 
     if (ctx->nomem) {
@@ -620,8 +622,6 @@ ngx_http_gzip_filter_deflate_start(ngx_http_request_t *r,
         return NGX_ERROR;
     }
 
-    r->connection->buffered |= NGX_HTTP_GZIP_BUFFERED;
-
     ctx->last_out = &ctx->out;
     ctx->crc32 = crc32(0L, Z_NULL, 0);
     ctx->flush = Z_NO_FLUSH;
@@ -854,6 +854,8 @@ ngx_http_gzip_filter_deflate(ngx_http_request_t *r, ngx_http_gzip_ctx_t *ctx)
         *ctx->last_out = cl;
         ctx->last_out = &cl->next;
 
+        r->connection->buffered &= ~NGX_HTTP_GZIP_BUFFERED;
+
         return NGX_OK;
     }