]> git.kaiwu.me - nginx.git/commitdiff
Slice filter: never run subrequests when main request is buffered.
authorRoman Arutyunyan <arut@nginx.com>
Tue, 8 Dec 2015 14:39:56 +0000 (17:39 +0300)
committerRoman Arutyunyan <arut@nginx.com>
Tue, 8 Dec 2015 14:39:56 +0000 (17:39 +0300)
With main request buffered, it's possible, that a slice subrequest will send
output before it.  For example, while main request is waiting for aio read to
complete, a slice subrequest can start an aio operation as well.  The order
in which aio callbacks are called is undetermined.

src/http/modules/ngx_http_slice_filter_module.c

index 8cdb9bc6fcb9368e0569087e085ad31a47963702..aa2a0344cbcf6e0dd6f968822ea0c22a63a38c3b 100644 (file)
@@ -239,6 +239,10 @@ ngx_http_slice_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
         return rc;
     }
 
+    if (r->buffered) {
+        return rc;
+    }
+
     if (ngx_http_subrequest(r, &r->uri, &r->args, &sr, NULL, 0) != NGX_OK) {
         return NGX_ERROR;
     }