Welcome! Log In Create A New Profile

Advanced

[nginx] Do not set last_buf flag in subrequests.

Roman Arutyunyan
October 04, 2016 06:50AM
details: http://hg.nginx.org/nginx/rev/6136a51f9c21
branches:
changeset: 6722:6136a51f9c21
user: Roman Arutyunyan <arut@nginx.com>
date: Mon Oct 03 20:48:51 2016 +0300
description:
Do not set last_buf flag in subrequests.

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.

diffstat:

src/http/modules/ngx_http_mp4_module.c | 2 +-
src/http/modules/ngx_http_range_filter_module.c | 3 ++-
src/http/ngx_http_special_response.c | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r 48bab8b83f4e -r 6136a51f9c21 src/http/modules/ngx_http_mp4_module.c
--- a/src/http/modules/ngx_http_mp4_module.c Mon Oct 03 15:58:30 2016 +0300
+++ b/src/http/modules/ngx_http_mp4_module.c Mon Oct 03 20:48:51 2016 +0300
@@ -1144,7 +1144,7 @@ ngx_http_mp4_read_mdat_atom(ngx_http_mp4
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;

diff -r 48bab8b83f4e -r 6136a51f9c21 src/http/modules/ngx_http_range_filter_module.c
--- a/src/http/modules/ngx_http_range_filter_module.c Mon Oct 03 15:58:30 2016 +0300
+++ b/src/http/modules/ngx_http_range_filter_module.c Mon Oct 03 20:48:51 2016 +0300
@@ -750,7 +750,8 @@ ngx_http_range_singlepart_body(ngx_http_
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;

diff -r 48bab8b83f4e -r 6136a51f9c21 src/http/ngx_http_special_response.c
--- a/src/http/ngx_http_special_response.c Mon Oct 03 15:58:30 2016 +0300
+++ b/src/http/ngx_http_special_response.c Mon Oct 03 20:48:51 2016 +0300
@@ -792,7 +792,7 @@ ngx_http_send_refresh(ngx_http_request_t
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;

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Do not set last_buf flag in subrequests.

Roman Arutyunyan 422 October 04, 2016 06:50AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 140
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready