Klaus Demo nginx / da4ffd8
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
4 changed file(s) with 7 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
1111
1212 static ngx_int_t ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last);
1313 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);
1514 static ngx_int_t ngx_conf_test_full_name(ngx_str_t *name);
1615 static void ngx_conf_flush_files(ngx_cycle_t *cycle);
1716
730729 }
731730
732731
733 static char *
732 char *
734733 ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
735734 {
736735 char *rv;
316316
317317 char *ngx_conf_param(ngx_conf_t *cf);
318318 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);
319320
320321
321322 ngx_int_t ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name,
368368 ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
369369 {
370370 ngx_int_t rc, index;
371 ngx_str_t *value, file, name;
371 ngx_str_t *value, name;
372372 ngx_uint_t i, key;
373373 ngx_http_map_conf_ctx_t *ctx;
374374 ngx_http_variable_value_t *var, **vp;
390390 }
391391
392392 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);
402394 }
403395
404396 if (value[1].data[0] == '$') {
32353235 {
32363236 ngx_http_core_loc_conf_t *clcf = conf;
32373237
3238 ngx_str_t *value, *content_type, *old, file;
3238 ngx_str_t *value, *content_type, *old;
32393239 ngx_uint_t i, n, hash;
32403240 ngx_hash_key_t *type;
32413241
32483248 " in \"include\" directive");
32493249 return NGX_CONF_ERROR;
32503250 }
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);
32603253 }
32613254
32623255 content_type = ngx_palloc(cf->pool, sizeof(ngx_str_t));