Welcome! Log In Create A New Profile

Advanced

[PATCH] resetting write event handler in ngx_http_named_location

agentzh
May 02, 2012 11:06AM
Hello!

drdrxp has found a hanging problem when using ngx_eval in a named
location which is internal redirected to at content phase:

https://github.com/agentzh/nginx-eval-module/pull/1

And we've found it is related to an issue in ngx_http_named_location
which could affect a wide range of different nginx modules. This issue
still exists in nginx 1.2.0.

Below is a patch (for nginx 1.0.15) to fix it by resetting
r->write_event_handler to ngx_http_core_run_phases, just as in
ngx_http_internal_redirect. The patch is needed because when
ngx_http_named_location is called from within the content phase,
r->write_event_handler is reset to ngx_http_request_empty_handler in
ngx_http_core_content_phase, or other content handlers may override it
to other things too.

Hopefully this issue can be fixed in the official core.

Thanks!
-agentzh

--- nginx-1.0.15/src/http/ngx_http_core_module.c 2012-03-05
21:03:39.000000000 +0800
+++ nginx-1.0.15-patched/src/http/ngx_http_core_module.c
2012-05-02 21:57:40.624937882 +0800
@@ -2567,6 +2567,8 @@

r->phase_handler = cmcf->phase_engine.location_rewrite_index;

+ r->write_event_handler = ngx_http_core_run_phases;
+
ngx_http_core_run_phases(r);

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

[PATCH] resetting write event handler in ngx_http_named_location Attachments

agentzh 960 May 02, 2012 11:06AM

Re: [PATCH] resetting write event handler in ngx_http_named_location

Maxim Dounin 432 May 04, 2012 07:36AM



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

Online Users

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