Mercurial > hg > nginx
comparison src/http/modules/ngx_http_empty_gif_module.c @ 4148:18f1cb12c6d7
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
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 27 Sep 2011 11:13:00 +0000 |
parents | c0113b6648de |
children | d620f497c50f |
comparison
equal
deleted
inserted
replaced
4147:7f64de1cc2c0 | 4148:18f1cb12c6d7 |
---|---|
109 | 109 |
110 | 110 |
111 static ngx_int_t | 111 static ngx_int_t |
112 ngx_http_empty_gif_handler(ngx_http_request_t *r) | 112 ngx_http_empty_gif_handler(ngx_http_request_t *r) |
113 { | 113 { |
114 ngx_int_t rc; | |
115 ngx_http_complex_value_t cv; | 114 ngx_http_complex_value_t cv; |
116 | 115 |
117 if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) { | 116 if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) { |
118 return NGX_HTTP_NOT_ALLOWED; | 117 return NGX_HTTP_NOT_ALLOWED; |
119 } | |
120 | |
121 rc = ngx_http_discard_request_body(r); | |
122 | |
123 if (rc != NGX_OK) { | |
124 return rc; | |
125 } | 118 } |
126 | 119 |
127 ngx_memzero(&cv, sizeof(ngx_http_complex_value_t)); | 120 ngx_memzero(&cv, sizeof(ngx_http_complex_value_t)); |
128 | 121 |
129 cv.value.len = sizeof(ngx_empty_gif); | 122 cv.value.len = sizeof(ngx_empty_gif); |