]> git.kaiwu.me - nginx.git/commitdiff
Request body: fixed discard of chunked request body.
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 26 Nov 2012 17:59:30 +0000 (17:59 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 26 Nov 2012 17:59:30 +0000 (17:59 +0000)
Even if there is no preread data, make sure to always call
ngx_http_discard_request_body_filter() in case of chunked request
body to initialize r->headers_in.content_length_n for later use.

src/http/ngx_http_request_body.c

index 931694ebe6d0511055723df40c74220045046d59..90da110054ad6a13f5a688ea9c4f9c25359d5fe8 100644 (file)
@@ -459,7 +459,7 @@ ngx_http_discard_request_body(ngx_http_request_t *r)
 
     size = r->header_in->last - r->header_in->pos;
 
-    if (size) {
+    if (size || r->headers_in.chunked) {
         rc = ngx_http_discard_request_body_filter(r, r->header_in);
 
         if (rc != NGX_OK) {