Fixed the "include" directive.
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.
Ruslan Ermilov
8 years ago
11 | 11 |
|
12 | 12 |
static ngx_int_t ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last);
|
13 | 13 |
static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf);
|
14 | |
static char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
15 | 14 |
static ngx_int_t ngx_conf_test_full_name(ngx_str_t *name);
|
16 | 15 |
static void ngx_conf_flush_files(ngx_cycle_t *cycle);
|
17 | 16 |
|
|
730 | 729 |
}
|
731 | 730 |
|
732 | 731 |
|
733 | |
static char *
|
|
732 |
char *
|
734 | 733 |
ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
735 | 734 |
{
|
736 | 735 |
char *rv;
|
316 | 316 |
|
317 | 317 |
char *ngx_conf_param(ngx_conf_t *cf);
|
318 | 318 |
char *ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename);
|
|
319 |
char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
319 | 320 |
|
320 | 321 |
|
321 | 322 |
ngx_int_t ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name,
|
368 | 368 |
ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
|
369 | 369 |
{
|
370 | 370 |
ngx_int_t rc, index;
|
371 | |
ngx_str_t *value, file, name;
|
|
371 |
ngx_str_t *value, name;
|
372 | 372 |
ngx_uint_t i, key;
|
373 | 373 |
ngx_http_map_conf_ctx_t *ctx;
|
374 | 374 |
ngx_http_variable_value_t *var, **vp;
|
|
390 | 390 |
}
|
391 | 391 |
|
392 | 392 |
if (ngx_strcmp(value[0].data, "include") == 0) {
|
393 | |
file = value[1];
|
394 | |
|
395 | |
if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) {
|
396 | |
return NGX_CONF_ERROR;
|
397 | |
}
|
398 | |
|
399 | |
ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
|
400 | |
|
401 | |
return ngx_conf_parse(cf, &file);
|
|
393 |
return ngx_conf_include(cf, dummy, conf);
|
402 | 394 |
}
|
403 | 395 |
|
404 | 396 |
if (value[1].data[0] == '$') {
|
3235 | 3235 |
{
|
3236 | 3236 |
ngx_http_core_loc_conf_t *clcf = conf;
|
3237 | 3237 |
|
3238 | |
ngx_str_t *value, *content_type, *old, file;
|
|
3238 |
ngx_str_t *value, *content_type, *old;
|
3239 | 3239 |
ngx_uint_t i, n, hash;
|
3240 | 3240 |
ngx_hash_key_t *type;
|
3241 | 3241 |
|
|
3248 | 3248 |
" in \"include\" directive");
|
3249 | 3249 |
return NGX_CONF_ERROR;
|
3250 | 3250 |
}
|
3251 | |
file = value[1];
|
3252 | |
|
3253 | |
if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) {
|
3254 | |
return NGX_CONF_ERROR;
|
3255 | |
}
|
3256 | |
|
3257 | |
ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
|
3258 | |
|
3259 | |
return ngx_conf_parse(cf, &file);
|
|
3251 |
|
|
3252 |
return ngx_conf_include(cf, dummy, conf);
|
3260 | 3253 |
}
|
3261 | 3254 |
|
3262 | 3255 |
content_type = ngx_palloc(cf->pool, sizeof(ngx_str_t));
|