]> git.kaiwu.me - nginx.git/commitdiff
Request body: only read body in main request (ticket #330).
authorMaxim Dounin <mdounin@mdounin.ru>
Tue, 16 Apr 2013 10:14:59 +0000 (10:14 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Tue, 16 Apr 2013 10:14:59 +0000 (10:14 +0000)
Before 1.3.9 an attempt to read body in a subrequest only caused problems
if body wasn't already read or discarded in a main request.  Starting with
1.3.9 it might also cause problems if body was discarded by a main request
before subrequest start.

Fix is to just ignore attempts to read request body in a subrequest, which
looks like right thing to do anyway.

src/http/ngx_http_request_body.c

index 4e7b30257788b5efdaababf3a1a0c5dadb3707b0..2c612311d0a65b6e3fab06d2c21822edf98b6247 100644 (file)
@@ -49,7 +49,7 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
     }
 #endif
 
-    if (r->request_body || r->discard_body) {
+    if (r != r->main || r->request_body || r->discard_body) {
         post_handler(r);
         return NGX_OK;
     }