mirror of https://github.com/nginx/nginx
Geo: the "volatile" parameter.
Similar to map's volatile parameter, creates a non-cacheable geo variable.
This commit is contained in:
parent
71f8eb52b7
commit
ac72ca60c7
|
|
@ -63,6 +63,7 @@ typedef struct {
|
||||||
unsigned allow_binary_include:1;
|
unsigned allow_binary_include:1;
|
||||||
unsigned binary_include:1;
|
unsigned binary_include:1;
|
||||||
unsigned proxy_recursive:1;
|
unsigned proxy_recursive:1;
|
||||||
|
unsigned no_cacheable:1;
|
||||||
} ngx_http_geo_conf_ctx_t;
|
} ngx_http_geo_conf_ctx_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -463,6 +464,7 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
+ sizeof(ngx_http_variable_value_t)
|
+ sizeof(ngx_http_variable_value_t)
|
||||||
+ 0x10000 * sizeof(ngx_http_geo_range_t *);
|
+ 0x10000 * sizeof(ngx_http_geo_range_t *);
|
||||||
ctx.allow_binary_include = 1;
|
ctx.allow_binary_include = 1;
|
||||||
|
ctx.no_cacheable = 0;
|
||||||
|
|
||||||
save = *cf;
|
save = *cf;
|
||||||
cf->pool = pool;
|
cf->pool = pool;
|
||||||
|
|
@ -478,6 +480,10 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctx.no_cacheable) {
|
||||||
|
var->flags |= NGX_HTTP_VAR_NOCACHEABLE;
|
||||||
|
}
|
||||||
|
|
||||||
geo->proxies = ctx.proxies;
|
geo->proxies = ctx.proxies;
|
||||||
geo->proxy_recursive = ctx.proxy_recursive;
|
geo->proxy_recursive = ctx.proxy_recursive;
|
||||||
|
|
||||||
|
|
@ -623,6 +629,12 @@ ngx_http_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
|
||||||
rv = NGX_CONF_OK;
|
rv = NGX_CONF_OK;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (ngx_strcmp(value[0].data, "volatile") == 0) {
|
||||||
|
ctx->no_cacheable = 1;
|
||||||
|
rv = NGX_CONF_OK;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cf->args->nelts != 2) {
|
if (cf->args->nelts != 2) {
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ typedef struct {
|
||||||
unsigned outside_entries:1;
|
unsigned outside_entries:1;
|
||||||
unsigned allow_binary_include:1;
|
unsigned allow_binary_include:1;
|
||||||
unsigned binary_include:1;
|
unsigned binary_include:1;
|
||||||
|
unsigned no_cacheable:1;
|
||||||
} ngx_stream_geo_conf_ctx_t;
|
} ngx_stream_geo_conf_ctx_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -433,6 +434,7 @@ ngx_stream_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
+ sizeof(ngx_stream_variable_value_t)
|
+ sizeof(ngx_stream_variable_value_t)
|
||||||
+ 0x10000 * sizeof(ngx_stream_geo_range_t *);
|
+ 0x10000 * sizeof(ngx_stream_geo_range_t *);
|
||||||
ctx.allow_binary_include = 1;
|
ctx.allow_binary_include = 1;
|
||||||
|
ctx.no_cacheable = 0;
|
||||||
|
|
||||||
save = *cf;
|
save = *cf;
|
||||||
cf->pool = pool;
|
cf->pool = pool;
|
||||||
|
|
@ -448,6 +450,10 @@ ngx_stream_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ctx.no_cacheable) {
|
||||||
|
var->flags |= NGX_STREAM_VAR_NOCACHEABLE;
|
||||||
|
}
|
||||||
|
|
||||||
if (ctx.ranges) {
|
if (ctx.ranges) {
|
||||||
|
|
||||||
if (ctx.high.low && !ctx.binary_include) {
|
if (ctx.high.low && !ctx.binary_include) {
|
||||||
|
|
@ -583,6 +589,12 @@ ngx_stream_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
|
||||||
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (ngx_strcmp(value[0].data, "volatile") == 0) {
|
||||||
|
ctx->no_cacheable = 1;
|
||||||
|
rv = NGX_CONF_OK;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cf->args->nelts != 2) {
|
if (cf->args->nelts != 2) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue