[nginx] Slice filter: fetch slices in cloned subrequests.

Roman Arutyunyan arut at nginx.com
Fri Feb 10 13:58:38 UTC 2017


details:   http://hg.nginx.org/nginx/rev/d16ba0ea3434
branches:  
changeset: 6907:d16ba0ea3434
user:      Roman Arutyunyan <arut at nginx.com>
date:      Fri Feb 10 16:33:12 2017 +0300
description:
Slice filter: fetch slices in cloned subrequests.

Previously, slice subrequest location was selected based on request URI.
If request is then redirected to a new location, its context array is cleared,
making the slice module loose current slice range information.  This lead to
broken output.  Now subrequests with the NGX_HTTP_SUBREQUEST_CLONE flag are
created for slices.  Such subrequests stay in the same location as the parent
request and keep the right slice context.

diffstat:

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

diffs (15 lines):

diff -r 1aeaae6e9446 -r d16ba0ea3434 src/http/modules/ngx_http_slice_filter_module.c
--- a/src/http/modules/ngx_http_slice_filter_module.c	Fri Feb 10 15:13:41 2017 +0300
+++ b/src/http/modules/ngx_http_slice_filter_module.c	Fri Feb 10 16:33:12 2017 +0300
@@ -244,7 +244,10 @@ ngx_http_slice_body_filter(ngx_http_requ
         return rc;
     }
 
-    if (ngx_http_subrequest(r, &r->uri, &r->args, &sr, NULL, 0) != NGX_OK) {
+    if (ngx_http_subrequest(r, &r->uri, &r->args, &sr, NULL,
+                            NGX_HTTP_SUBREQUEST_CLONE)
+        != NGX_OK)
+    {
         return NGX_ERROR;
     }
 


More information about the nginx-devel mailing list