[nginx] Slice filter: never run subrequests when main request is...

Roman Arutyunyan arut at nginx.com
Tue Dec 8 14:41:33 UTC 2015


details:   http://hg.nginx.org/nginx/rev/bc9ea464e354
branches:  
changeset: 6321:bc9ea464e354
user:      Roman Arutyunyan <arut at nginx.com>
date:      Tue Dec 08 17:39:56 2015 +0300
description:
Slice filter: never run subrequests when main request is buffered.

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.

diffstat:

 src/http/modules/ngx_http_slice_filter_module.c |  4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diffs (14 lines):

diff -r a6902a941279 -r bc9ea464e354 src/http/modules/ngx_http_slice_filter_module.c
--- a/src/http/modules/ngx_http_slice_filter_module.c	Tue Dec 08 16:59:43 2015 +0300
+++ b/src/http/modules/ngx_http_slice_filter_module.c	Tue Dec 08 17:39:56 2015 +0300
@@ -239,6 +239,10 @@ ngx_http_slice_body_filter(ngx_http_requ
         return rc;
     }
 
+    if (r->buffered) {
+        return rc;
+    }
+
     if (ngx_http_subrequest(r, &r->uri, &r->args, &sr, NULL, 0) != NGX_OK) {
         return NGX_ERROR;
     }



More information about the nginx-devel mailing list