Skip to content

Commit

Permalink
Addition filter: set last_in_chain flag when clearing last_buf.
Browse files Browse the repository at this point in the history
When the last_buf flag is cleared for add_after_body to append more data from a
subrequest, other filters may still have buffered data, which should be flushed
at this point.  For example, the sub_filter may have a partial match buffered,
which will only be flushed after the subrequest is done, ending up with
interleaved data in output.

Setting last_in_chain instead of last_buf flushes the data and fixes the order
of output buffers.
  • Loading branch information
arut committed Oct 3, 2016
1 parent f3bbd1c commit 967ebbe
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/http/modules/ngx_http_addition_filter_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ ngx_http_addition_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
for (cl = in; cl; cl = cl->next) {
if (cl->buf->last_buf) {
cl->buf->last_buf = 0;
cl->buf->last_in_chain = 1;
cl->buf->sync = 1;
last = 1;
}
Expand Down

0 comments on commit 967ebbe

Please sign in to comment.