[PATCH] clear modules' contexts in ngx_http_named_location
Maxim Dounin
mdounin at mdounin.ru
Sat Oct 15 21:42:31 UTC 2011
Hello!
On Thu, Oct 13, 2011 at 03:10:25PM +0800, agentzh wrote:
> Hello!
>
> Here attaches a patch for the nginx 1.1.5 core to fix a long standing
> bug in the ngx_http_named_location function.
>
> I think we should clear out all the modules' contexts there just as in
> ngx_http_internal_redirect, or we'll observe weird issues due to
> left-over obsolete module contexts from the original request before
> the jump. Here is a bad case in action:
> http://www.ruby-forum.com/topic/2765027
>
> Regards,
> -agentzh
>
> --- nginx-1.1.5/src/http/ngx_http_core_module.c 2011-09-27
> 19:14:02.000000000 +0800
> +++ nginx-1.1.5-patched/src/http/ngx_http_core_module.c 2011-10-13
> 15:02:24.414550532 +0800
> @@ -2542,6 +2542,9 @@
> r->content_handler = NULL;
> r->loc_conf = (*clcfp)->loc_conf;
>
> + /* clear the modules contexts */
> + ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module);
> +
> ngx_http_update_location_config(r);
>
> cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
Committed, thanks.
Maxim Dounin
More information about the nginx-devel
mailing list