[PATCH] resetting write event handler in ngx_http_named_location
Maxim Dounin
mdounin at mdounin.ru
Fri May 4 11:35:39 UTC 2012
Hello!
On Wed, May 02, 2012 at 11:04:08PM +0800, agentzh wrote:
> 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;
Committed, thanks.
Maxim Dounin
More information about the nginx-devel
mailing list