Welcome! Log In Create A New Profile

Advanced

[nginx] Sub filter: fixed incomplete last buffer on partial match.

Maxim Dounin
July 25, 2013 08:00AM
details: http://hg.nginx.org/nginx/rev/2dbc5e38b65d
branches:
changeset: 5287:2dbc5e38b65d
user: Maxim Dounin <mdounin@mdounin.ru>
date: Thu Jul 25 14:54:48 2013 +0400
description:
Sub filter: fixed incomplete last buffer on partial match.

If a pattern was partially matched at a response end, partially matched
string wasn't send. E.g., a response "fo" was truncated to an empty response
if partially mathed by a pattern "foo".

diffstat:

src/http/modules/ngx_http_sub_filter_module.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)

diffs (30 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
@@ -369,6 +369,26 @@ ngx_http_sub_body_filter(ngx_http_reques
continue;
}

+ if (ctx->buf->last_buf && ctx->looked.len) {
+ cl = ngx_chain_get_free_buf(r->pool, &ctx->free);
+ if (cl == NULL) {
+ return NGX_ERROR;
+ }
+
+ b = cl->buf;
+
+ ngx_memzero(b, sizeof(ngx_buf_t));
+
+ b->pos = ctx->looked.data;
+ b->last = b->pos + ctx->looked.len;
+ b->memory = 1;
+
+ *ctx->last_out = cl;
+ ctx->last_out = &cl->next;
+
+ ctx->looked.len = 0;
+ }
+
if (ctx->buf->last_buf || ctx->buf->flush
|| ngx_buf_in_memory(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 incomplete last buffer on partial match.

Maxim Dounin 709 July 25, 2013 08:00AM



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

Online Users

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