Welcome! Log In Create A New Profile

Advanced

Re: Add new cookie into headers_in

agentzh
January 25, 2011 11:56PM
>
> Sorry, it has nothing to do with ngx_headers_more, it's only related
> to the ngx_http_subrequest() function in the nginx core. My hack was
> not in the ngx_headers_more module, but in ngx_lua and ngx_echo. These
> modules adjust the subrequest struct when issuing a subrequest. My
> current way is not perfectly correct:
>
>    /* XXX work-around a bug in ngx_http_subrequest */
>    if (r->headers_in.headers.last == &r->headers_in.headers.part) {
>        sr->headers_in.headers.last = &sr->headers_in.headers.part;
>    }
>

Another pitfall with ngx_http_subrequest is that subrequests *share*
the whole variable value cache (i.e., r->variables) by default. That
means, if a subrequest modifies a variable, it will also affects the
parent, and vice versa. This often leads to very confusing
side-effects and bad results (which is very similar to how evil global
variables can be ;)). So I explicitly disable this behavior in the
subrequests issued by ngx_lua, ngx_echo, and ngx_srcache :)

Cheers,
-agentzh

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

Add new cookie into headers_in

michalkraus January 24, 2011 10:07AM

Re: Add new cookie into headers_in

Maxim Dounin January 24, 2011 10:40AM

Re: Add new cookie into headers_in

michalkraus January 25, 2011 03:34AM

Re: Add new cookie into headers_in

Maxim Dounin January 25, 2011 07:58AM

Re: Add new cookie into headers_in

agentzh January 25, 2011 11:38PM

Re: Add new cookie into headers_in

agentzh January 25, 2011 11:50PM

Re: Add new cookie into headers_in

agentzh January 25, 2011 11:56PM

Re: Add new cookie into headers_in

michalkraus January 26, 2011 02:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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