questions about http variables: flags and no_cacheable

Maxim Dounin mdounin at
Fri Apr 16 03:16:35 MSD 2010


On Thu, Apr 15, 2010 at 10:41:37PM +0200, Manlio Perillo wrote:

> In my ngx_http_gateway module
> I'm implementing support for script_name and path_info variables, and I
> would like to ask some questions.
> * some variables have the ``NGX_HTTP_VAR_NOCACHEABLE`` flag set, however
>   the get_handler set ``v->no_cacheable = 0``.
>   What is the effect of setting ``v->no_cacheable = 0`` ?

There is no effect, it will be set to 1 anyway once flag is here.

Though this way it's consistent with cacheable variables and 
NGX_HTTP_VAR_NOCACHEABLE flag can be removed safely (and 
no_cacheable will be still initialized).

Note well that right now it's actually not needed at all as 
indexed variables are allocated using ngx_pcalloc() (and 
non-indexed variables don't use no_cacheable).  But there was a 
timeframe when it was indeed required.

> * what is the purpose of the NGX_HTTP_VAR_NOHASH flag?

These variables can only be used via index, not by name.  It's 
small optimization which may be used when you know that variable 
isn't needed in ssi and/or perl.

Maxim Dounin

More information about the nginx-devel mailing list