summaryrefslogtreecommitdiffhomepage
path: root/src/http/modules/ngx_http_map_module.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/modules/ngx_http_map_module.c')
-rw-r--r--src/http/modules/ngx_http_map_module.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/http/modules/ngx_http_map_module.c b/src/http/modules/ngx_http_map_module.c
index 32393436b..2fc9be90b 100644
--- a/src/http/modules/ngx_http_map_module.c
+++ b/src/http/modules/ngx_http_map_module.c
@@ -26,7 +26,8 @@ typedef struct {
ngx_http_variable_value_t *default_value;
ngx_conf_t *cf;
- ngx_uint_t hostnames; /* unsigned hostnames:1 */
+ unsigned hostnames:1;
+ unsigned no_cacheable:1;
} ngx_http_map_conf_ctx_t;
@@ -265,6 +266,7 @@ ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
ctx.default_value = NULL;
ctx.cf = &save;
ctx.hostnames = 0;
+ ctx.no_cacheable = 0;
save = *cf;
cf->pool = pool;
@@ -281,6 +283,10 @@ ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
return rv;
}
+ if (ctx.no_cacheable) {
+ var->flags |= NGX_HTTP_VAR_NOCACHEABLE;
+ }
+
map->default_value = ctx.default_value ? ctx.default_value:
&ngx_http_variable_null_value;
@@ -395,6 +401,13 @@ ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
return NGX_CONF_OK;
}
+ if (cf->args->nelts == 1
+ && ngx_strcmp(value[0].data, "volatile") == 0)
+ {
+ ctx->no_cacheable = 1;
+ return NGX_CONF_OK;
+ }
+
if (cf->args->nelts != 2) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid number of the map parameters");