From 74278a8e9ec26beac39a56d0a34396e713345dad Mon Sep 17 00:00:00 2001 From: chaizhenhua Date: Tue, 9 Apr 2013 10:31:16 +0800 Subject: [PATCH] Nginx Improved response body filter, issue #56 might be fixed --- nginx/modsecurity/ngx_http_modsecurity.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nginx/modsecurity/ngx_http_modsecurity.c b/nginx/modsecurity/ngx_http_modsecurity.c index a3b34afb98..18b17266dd 100644 --- a/nginx/modsecurity/ngx_http_modsecurity.c +++ b/nginx/modsecurity/ngx_http_modsecurity.c @@ -1162,15 +1162,21 @@ ngx_http_modsecurity_body_filter(ngx_http_request_t *r, ngx_chain_t *in) ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "modSecurity: body filter"); if (in == NULL) { + /* waiting for more buffer */ + r->buffered |= NGX_HTTP_SSI_BUFFERED; return NGX_AGAIN; } rc = move_chain_to_brigade(in, ctx->brigade, r->pool, 0); if (rc != NGX_OK) { + /* waiting for more buffer */ + r->buffered |= NGX_HTTP_SSI_BUFFERED; return rc; } /* last buf has been saved */ + r->buffered &= ~NGX_HTTP_SSI_BUFFERED; + ctx->complete = 1; modsecSetResponseBrigade(ctx->req, ctx->brigade);