Mercurial > hg > nginx
changeset 4856:43b7b9572fe1 stable-1.2
Merge of r4828: "include" with wildcards in map and types blocks.
The "include" directive should be able to include multiple files if
given a filename mask. Fixed this to work for "include" directives
inside the "map" or "types" blocks. The "include" directive inside
the "geo" block is still not fixed.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 24 Sep 2012 19:05:02 +0000 |
parents | f66d0a6d7fdd |
children | 880dedfa4008 |
files | src/core/ngx_conf_file.c src/core/ngx_conf_file.h src/http/modules/ngx_http_map_module.c src/http/ngx_http_core_module.c |
diffstat | 4 files changed, 7 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/ngx_conf_file.c Mon Sep 24 19:02:16 2012 +0000 +++ b/src/core/ngx_conf_file.c Mon Sep 24 19:05:02 2012 +0000 @@ -12,7 +12,6 @@ static ngx_int_t ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last); static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf); -static char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); static ngx_int_t ngx_conf_test_full_name(ngx_str_t *name); static void ngx_conf_flush_files(ngx_cycle_t *cycle); @@ -731,7 +730,7 @@ } -static char * +char * ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { char *rv;
--- a/src/core/ngx_conf_file.h Mon Sep 24 19:02:16 2012 +0000 +++ b/src/core/ngx_conf_file.h Mon Sep 24 19:05:02 2012 +0000 @@ -317,6 +317,7 @@ char *ngx_conf_param(ngx_conf_t *cf); char *ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename); +char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); ngx_int_t ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name,
--- a/src/http/modules/ngx_http_map_module.c Mon Sep 24 19:02:16 2012 +0000 +++ b/src/http/modules/ngx_http_map_module.c Mon Sep 24 19:05:02 2012 +0000 @@ -369,7 +369,7 @@ ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) { ngx_int_t rc, index; - ngx_str_t *value, file, name; + ngx_str_t *value, name; ngx_uint_t i, key; ngx_http_map_conf_ctx_t *ctx; ngx_http_variable_value_t *var, **vp; @@ -391,15 +391,7 @@ } if (ngx_strcmp(value[0].data, "include") == 0) { - file = value[1]; - - if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) { - return NGX_CONF_ERROR; - } - - ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data); - - return ngx_conf_parse(cf, &file); + return ngx_conf_include(cf, dummy, conf); } if (value[1].data[0] == '$') {
--- a/src/http/ngx_http_core_module.c Mon Sep 24 19:02:16 2012 +0000 +++ b/src/http/ngx_http_core_module.c Mon Sep 24 19:05:02 2012 +0000 @@ -3193,7 +3193,7 @@ { ngx_http_core_loc_conf_t *clcf = conf; - ngx_str_t *value, *content_type, *old, file; + ngx_str_t *value, *content_type, *old; ngx_uint_t i, n, hash; ngx_hash_key_t *type; @@ -3206,15 +3206,8 @@ " in \"include\" directive"); return NGX_CONF_ERROR; } - file = value[1]; - - if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) { - return NGX_CONF_ERROR; - } - - ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data); - - return ngx_conf_parse(cf, &file); + + return ngx_conf_include(cf, dummy, conf); } content_type = ngx_palloc(cf->pool, sizeof(ngx_str_t));