aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_core_module.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2011-09-27 11:13:00 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2011-09-27 11:13:00 +0000
commit77ca973d119d999946e62553b88425cfcdc0de6a (patch)
tree972b35c631a11f73bfbf9f23f174a99f97b69506 /src/http/ngx_http_core_module.c
parentad5ef15e087983d1981a62d04f5fce6d9974f65c (diff)
downloadnginx-77ca973d119d999946e62553b88425cfcdc0de6a.tar.gz
nginx-77ca973d119d999946e62553b88425cfcdc0de6a.zip
Fix for "return 202" not discarding body.
Big POST (not fully preread) to a location / { return 202; } resulted in incorrect behaviour due to "return" code path not calling ngx_http_discard_request_body(). The same applies to all "return" used with 2xx/3xx codes except 201 and 204, and to all "return ... text" uses. Fix is to add ngx_http_discard_request_body() call to ngx_http_send_response() function where it looks appropriate. Discard body call from emtpy gif module removed as it's now redundant. Reported by Pyry Hakulinen, see http://mailman.nginx.org/pipermail/nginx/2011-August/028503.html
Diffstat (limited to 'src/http/ngx_http_core_module.c')
-rw-r--r--src/http/ngx_http_core_module.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index d51dc23d1..ae9d8479d 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1784,6 +1784,10 @@ ngx_http_send_response(ngx_http_request_t *r, ngx_uint_t status,
ngx_buf_t *b;
ngx_chain_t out;
+ if (ngx_http_discard_request_body(r) != NGX_OK) {
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ }
+
r->headers_out.status = status;
if (status == NGX_HTTP_NO_CONTENT) {