aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/http/modules/ngx_http_gunzip_filter_module.c10
-rw-r--r--src/http/modules/ngx_http_gzip_filter_module.c10
2 files changed, 16 insertions, 4 deletions
diff --git a/src/http/modules/ngx_http_gunzip_filter_module.c b/src/http/modules/ngx_http_gunzip_filter_module.c
index 70ec0aace..c1341f562 100644
--- a/src/http/modules/ngx_http_gunzip_filter_module.c
+++ b/src/http/modules/ngx_http_gunzip_filter_module.c
@@ -175,6 +175,7 @@ static ngx_int_t
ngx_http_gunzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
{
int rc;
+ ngx_uint_t flush;
ngx_chain_t *cl;
ngx_http_gunzip_ctx_t *ctx;
@@ -199,7 +200,7 @@ ngx_http_gunzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
}
}
- if (ctx->nomem || in == NULL) {
+ if (ctx->nomem) {
/* flush busy buffers */
@@ -212,6 +213,10 @@ ngx_http_gunzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
ngx_chain_update_chains(r->pool, &ctx->free, &ctx->busy, &cl,
(ngx_buf_tag_t) &ngx_http_gunzip_filter_module);
ctx->nomem = 0;
+ flush = 0;
+
+ } else {
+ flush = ctx->busy ? 1 : 0;
}
for ( ;; ) {
@@ -258,7 +263,7 @@ ngx_http_gunzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
/* rc == NGX_AGAIN */
}
- if (ctx->out == NULL) {
+ if (ctx->out == NULL && !flush) {
return ctx->busy ? NGX_AGAIN : NGX_OK;
}
@@ -276,6 +281,7 @@ ngx_http_gunzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
"gunzip out: %p", ctx->out);
ctx->nomem = 0;
+ flush = 0;
if (ctx->done) {
return rc;
diff --git a/src/http/modules/ngx_http_gzip_filter_module.c b/src/http/modules/ngx_http_gzip_filter_module.c
index c57a4a3c7..f941e6397 100644
--- a/src/http/modules/ngx_http_gzip_filter_module.c
+++ b/src/http/modules/ngx_http_gzip_filter_module.c
@@ -316,6 +316,7 @@ static ngx_int_t
ngx_http_gzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
{
int rc;
+ ngx_uint_t flush;
ngx_chain_t *cl;
ngx_http_gzip_ctx_t *ctx;
@@ -372,7 +373,7 @@ ngx_http_gzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
r->connection->buffered |= NGX_HTTP_GZIP_BUFFERED;
}
- if (ctx->nomem || in == NULL) {
+ if (ctx->nomem) {
/* flush busy buffers */
@@ -385,6 +386,10 @@ ngx_http_gzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
ngx_chain_update_chains(r->pool, &ctx->free, &ctx->busy, &cl,
(ngx_buf_tag_t) &ngx_http_gzip_filter_module);
ctx->nomem = 0;
+ flush = 0;
+
+ } else {
+ flush = ctx->busy ? 1 : 0;
}
for ( ;; ) {
@@ -432,7 +437,7 @@ ngx_http_gzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
/* rc == NGX_AGAIN */
}
- if (ctx->out == NULL) {
+ if (ctx->out == NULL && !flush) {
ngx_http_gzip_filter_free_copy_buf(r, ctx);
return ctx->busy ? NGX_AGAIN : NGX_OK;
@@ -457,6 +462,7 @@ ngx_http_gzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
ctx->last_out = &ctx->out;
ctx->nomem = 0;
+ flush = 0;
if (ctx->done) {
return rc;