Welcome! Log In Create A New Profile

Advanced

[nginx] Sub filter: restored ngx_http_set_ctx() at the proper place.

Sergey Kandaurov
April 18, 2017 01:42PM
details: http://hg.nginx.org/nginx/rev/201038680680
branches:
changeset: 6984:201038680680
user: Sergey Kandaurov <pluknet@nginx.com>
date: Tue Apr 18 19:55:23 2017 +0300
description:
Sub filter: restored ngx_http_set_ctx() at the proper place.

Previously, ngx_http_sub_header_filter() could fail with a partially
initialized context, later accessed in ngx_http_sub_body_filter()
if called from the perl content handler.

The issue had appeared in 2c045e5b8291 (1.9.4).

A better fix would be to handle ngx_http_send_header() errors in
the perl module, though this doesn't seem to be easy enough.

diffstat:

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

diffs (21 lines):

diff -r 3518287d995e -r 201038680680 src/http/modules/ngx_http_sub_filter_module.c
--- a/src/http/modules/ngx_http_sub_filter_module.c Tue Apr 18 16:08:46 2017 +0300
+++ b/src/http/modules/ngx_http_sub_filter_module.c Tue Apr 18 19:55:23 2017 +0300
@@ -248,8 +248,6 @@ ngx_http_sub_header_filter(ngx_http_requ
ctx->matches->nelts);
}

- ngx_http_set_ctx(r, ctx, ngx_http_sub_filter_module);
-
ctx->saved.data = ngx_pnalloc(r->pool, ctx->tables->max_match_len - 1);
if (ctx->saved.data == NULL) {
return NGX_ERROR;
@@ -260,6 +258,8 @@ ngx_http_sub_header_filter(ngx_http_requ
return NGX_ERROR;
}

+ ngx_http_set_ctx(r, ctx, ngx_http_sub_filter_module);
+
ctx->offset = ctx->tables->min_match_len - 1;
ctx->last_out = &ctx->out;

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

[nginx] Sub filter: restored ngx_http_set_ctx() at the proper place.

Sergey Kandaurov 414 April 18, 2017 01:42PM



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

Online Users

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