Accept cookies for analytics, social media, and advertising, or learn more and adjust your preferences. These cookies are on by default for visitors outside the UK and EEA. Privacy Notice.
ngx_http_variable_value_t
¶The structure containing the details of a variable’s value.
len:28
¶The length of the data
parameter (a 28bit number)
valid:1
¶A boolean to determine whether or not a cached value is valid
no_cacheable:1
¶A boolean to determine whether or not the value is cachable
not_found:1
¶A boolean stating whether or not the requested variable was found
data
¶The value of the variable
ngx_http_variable_t
¶A structure to hold details about a configuration variable
(*ngx_http_get_variable_pt)
(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data)¶A callback to execute when retrieving a value of variable
(*ngx_http_set_variable_pt)
(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data)¶A callback to execute when setting a value of a variable
data
¶A pointer to data for use with the get/set callback functions
ngx_http_add_variable
(ngx_conf_t *cf, ngx_str_t *name, ngx_uint_t flags)¶Adds a variable to a configuration. This should be called from the pre-configuration hook of ngx_http_module_t
Flag | Description |
---|---|
NGX_HTTP_VAR_CHANGEABLE |
Enables the setting of the variable in the configuration file |
NGX_HTTP_VAR_NOCACHEABLE |
The variable should not be cached |
NGX_HTTP_VAR_NOHASH |
An optimistaition which removes the ability to use ngx_http_get_variable() on a variable |
Parameters: |
|
---|---|
Returns: | A pointer to a newly created variable |
ngx_http_get_variable_index
(ngx_conf_t *cf, ngx_str_t *name)¶Get the index of variable based on its name
Parameters: |
|
---|---|
Returns: | The index ID of the variable or |
ngx_http_get_indexed_variable
(ngx_http_request_t *r, ngx_uint_t index)¶Get the current value for a variable
Parameters: |
|
---|---|
Returns: | A pointer to the structure containing the variable |
ngx_http_get_flushed_variable
(ngx_http_request_t *r, ngx_uint_t index)¶Flush the cache of a variable and get a new value for it
Parameters: |
|
---|---|
Returns: | A pointer to the structure containing the variable |
ngx_http_get_variable
(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key)¶Gets a variable based on a hash lookup of the variable name. Does not work on variables that were initialized NGX_HTTP_VAR_NOHASH
flag enabled.
The hash can be generated using ngx_hash_strlow()
. For example:
key = ngx_hash_strlow(var.data, var.data, var.len);
vv = ngx_http_get_variable(r, &var, key);
Parameters: |
|
---|---|
Returns: | A pointer to the structure containing the variable |