]> git.kaiwu.me - nginx.git/commitdiff
Slice filter: fetch slices in cloned subrequests.
authorRoman Arutyunyan <arut@nginx.com>
Fri, 10 Feb 2017 13:33:12 +0000 (16:33 +0300)
committerRoman Arutyunyan <arut@nginx.com>
Fri, 10 Feb 2017 13:33:12 +0000 (16:33 +0300)
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.

src/http/modules/ngx_http_slice_filter_module.c

index 5e149b4c189adc4c20de8aa5e726b8f71504fb7c..200593959d75d355c4f3c397b399925f4c8f9243 100644 (file)
@@ -244,7 +244,10 @@ ngx_http_slice_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
         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;
     }