]> git.kaiwu.me - nginx.git/commitdiff
Do not set last_buf flag in subrequests.
authorRoman Arutyunyan <arut@nginx.com>
Mon, 3 Oct 2016 17:48:51 +0000 (20:48 +0300)
committerRoman Arutyunyan <arut@nginx.com>
Mon, 3 Oct 2016 17:48:51 +0000 (20:48 +0300)
The last_buf flag should only be set in the last buffer of the main request.
Otherwise, several last_buf flags can appear in output.  This can, for example,
break the chunked filter, which will include several final chunks in output.

src/http/modules/ngx_http_mp4_module.c
src/http/modules/ngx_http_range_filter_module.c
src/http/ngx_http_special_response.c

index 16ef83cf0c637210ac343c92dfa686047d14cf7e..2a68bae953d41545a2ba9c23a78b6051d72321f7 100644 (file)
@@ -1144,7 +1144,7 @@ ngx_http_mp4_read_mdat_atom(ngx_http_mp4_file_t *mp4, uint64_t atom_data_size)
     data = &mp4->mdat_data_buf;
     data->file = &mp4->file;
     data->in_file = 1;
-    data->last_buf = 1;
+    data->last_buf = (mp4->request == mp4->request->main) ? 1 : 0;
     data->last_in_chain = 1;
     data->file_last = mp4->offset + atom_data_size;
 
index 57065e1a9e7d3f83512184e3dc66a0b3d70bf5e0..095ef0621b7ad6e1c593184b9f974280047e43f8 100644 (file)
@@ -750,7 +750,8 @@ ngx_http_range_singlepart_body(ngx_http_request_t *r,
                 buf->last -= (size_t) (last - range->end);
             }
 
-            buf->last_buf = 1;
+            buf->last_buf = (r == r->main) ? 1 : 0;
+            buf->last_in_chain = 1;
             *ll = cl;
             cl->next = NULL;
 
index 64e5acd5569976925bb55f8bfedc41d59a97e8e2..7692f801f2c84901e0aa64d2f878425c25355d7d 100644 (file)
@@ -792,7 +792,7 @@ ngx_http_send_refresh(ngx_http_request_t *r)
     b->last = ngx_cpymem(p, ngx_http_msie_refresh_tail,
                          sizeof(ngx_http_msie_refresh_tail) - 1);
 
-    b->last_buf = 1;
+    b->last_buf = (r == r->main) ? 1 : 0;
     b->last_in_chain = 1;
 
     out.buf = b;