Welcome! Log In Create A New Profile

Advanced

[nginx] Sub filter: fixed subrequests handling.

Maxim Dounin
May 27, 2014 08:40AM
details: http://hg.nginx.org/nginx/rev/9e9c1310d17c
branches:
changeset: 5710:9e9c1310d17c
user: Maxim Dounin <mdounin@mdounin.ru>
date: Tue May 27 16:37:35 2014 +0400
description:
Sub filter: fixed subrequests handling.

In particular, properly output partial match at the end of a subrequest
response (much like we do at the end of a response), and reset/set the
last_in_chain flag as appropriate.

Reported by KAWAHARA Masashi.

diffstat:

src/http/modules/ngx_http_sub_filter_module.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)

diffs (39 lines):

diff --git a/src/http/modules/ngx_http_sub_filter_module.c b/src/http/modules/ngx_http_sub_filter_module.c
--- a/src/http/modules/ngx_http_sub_filter_module.c
+++ b/src/http/modules/ngx_http_sub_filter_module.c
@@ -305,6 +305,7 @@ ngx_http_sub_body_filter(ngx_http_reques
b->last = ctx->copy_end;
b->shadow = NULL;
b->last_buf = 0;
+ b->last_in_chain = 0;
b->recycled = 0;

if (b->in_file) {
@@ -374,7 +375,9 @@ ngx_http_sub_body_filter(ngx_http_reques
continue;
}

- if (ctx->buf->last_buf && ctx->looked.len) {
+ if (ctx->looked.len
+ && (ctx->buf->last_buf || ctx->buf->last_in_chain))
+ {
cl = ngx_chain_get_free_buf(r->pool, &ctx->free);
if (cl == NULL) {
return NGX_ERROR;
@@ -394,7 +397,7 @@ ngx_http_sub_body_filter(ngx_http_reques
ctx->looked.len = 0;
}

- if (ctx->buf->last_buf || ctx->buf->flush
+ if (ctx->buf->last_buf || ctx->buf->flush || ctx->buf->sync
|| ngx_buf_in_memory(ctx->buf))
{
if (b == NULL) {
@@ -414,6 +417,7 @@ ngx_http_sub_body_filter(ngx_http_reques
}

b->last_buf = ctx->buf->last_buf;
+ b->last_in_chain = ctx->buf->last_in_chain;
b->flush = ctx->buf->flush;
b->shadow = ctx->buf;


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

[nginx] Sub filter: fixed subrequests handling.

Maxim Dounin 785 May 27, 2014 08:40AM



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

Online Users

Guests: 172
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