Welcome! Log In Create A New Profile

Advanced

Re: question about ngx_http_named_location

Vladimir Shebordaev
August 29, 2012 02:44PM
2012/8/29 Anatoli Marinov <toli@webforge.bg>:
> "Must" is not a good reason.
> Is there a case that requires this behavior.
> In my use case I use internal redirects from location A to location @B. In
> location @B I try to read an exported variable which is actually located in

Well, module contexts are dynamic, they are created by appropriate
handlers and are destoryed when the request is terminated. An internal
redirect handled as a different request of special kind, that is why
the module contexts are (re)initialized, i.e. zeroed out as if they
were just allocated in ngx_http_init_request().

> module context and the module set this variable in location A but in @B all
> previous contexts are missing and I lost all previously set states and
> variables.

Basically, it looks like bad design, the redirect is a request on its own.

>
> Why internal redirects should erase module contexts? I think module context
> should be managed only from its module and should be attached to request
> while the request exists. Module context is the only one storage
> functionality per request and external modules depends from it. They expect
> to read exactly what was written there before.
>
> On 08/29/2012 03:47 PM, Vladimir Shebordaev wrote:
>>
>> Hi!
>>
>> 2012/8/29 Anatoli Marinov<toli@webforge.bg>:
>>
>>>
>>> Hello Mates,
>>> I am wondering why in ngx_http_named_location is used a segment of code
>>> that
>>> resets all modules contexts. I mean the line ngx_memzero(r->ctx,
>>> sizeof(void
>>> *) * ngx_http_max_module);.
>>>
>>> My opinion is that the module context should not be touched outside of
>>> the
>>> certain module. Is there a special reason for this patch? Is there a case
>>> which requires it?
>>>
>>>
>>
>> I guess, this is due to that the named location is an internal
>> redirect, so the module contexts must be reset.
>>
>>
>>>
>>> Thanks in advance
>>> Anatoli Marinov
>>>
>>>
>>>
>>

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

question about ngx_http_named_location

toli 1409 August 29, 2012 07:44AM

Re: question about ngx_http_named_location

Vladimir Shebordaev 661 August 29, 2012 08:50AM

Re: question about ngx_http_named_location

toli 889 August 29, 2012 09:04AM

Re: question about ngx_http_named_location

Vladimir Shebordaev 753 August 29, 2012 02:44PM

Re: question about ngx_http_named_location

VBart 1143 August 29, 2012 02:56PM

Re: question about ngx_http_named_location

Maxim Dounin 646 August 31, 2012 02:54PM

Re: question about ngx_http_named_location

agentzh 789 August 31, 2012 06:34PM



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

Online Users

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