comparison src/core/ngx_conf_file.c @ 682:5cb5db9975ba NGINX_1_3_4

nginx 1.3.4 *) Change: the "ipv6only" parameter is now turned on by default for listening IPv6 sockets. *) Feature: the Clang compiler support. *) Bugfix: extra listening sockets might be created. Thanks to Roman Odaisky. *) Bugfix: nginx/Windows might hog CPU if a worker process failed to start. Thanks to Ricardo Villalobos Guevara. *) Bugfix: the "proxy_pass_header", "fastcgi_pass_header", "scgi_pass_header", "uwsgi_pass_header", "proxy_hide_header", "fastcgi_hide_header", "scgi_hide_header", and "uwsgi_hide_header" directives might be inherited incorrectly.
author Igor Sysoev <http://sysoev.ru>
date Tue, 31 Jul 2012 00:00:00 +0400
parents f41d4b305d22
children 2e8a942c8872
comparison
equal deleted inserted replaced
681:625501f84a6b 682:5cb5db9975ba
280 static ngx_int_t 280 static ngx_int_t
281 ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last) 281 ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last)
282 { 282 {
283 char *rv; 283 char *rv;
284 void *conf, **confp; 284 void *conf, **confp;
285 ngx_uint_t i, multi; 285 ngx_uint_t i, found;
286 ngx_str_t *name; 286 ngx_str_t *name;
287 ngx_command_t *cmd; 287 ngx_command_t *cmd;
288 288
289 name = cf->args->elts; 289 name = cf->args->elts;
290 290
291 multi = 0; 291 found = 0;
292 292
293 for (i = 0; ngx_modules[i]; i++) { 293 for (i = 0; ngx_modules[i]; i++) {
294
295 /* look up the directive in the appropriate modules */
296
297 if (ngx_modules[i]->type != NGX_CONF_MODULE
298 && ngx_modules[i]->type != cf->module_type)
299 {
300 continue;
301 }
302 294
303 cmd = ngx_modules[i]->commands; 295 cmd = ngx_modules[i]->commands;
304 if (cmd == NULL) { 296 if (cmd == NULL) {
305 continue; 297 continue;
306 } 298 }
313 305
314 if (ngx_strcmp(name->data, cmd->name.data) != 0) { 306 if (ngx_strcmp(name->data, cmd->name.data) != 0) {
315 continue; 307 continue;
316 } 308 }
317 309
310 found = 1;
311
312 if (ngx_modules[i]->type != NGX_CONF_MODULE
313 && ngx_modules[i]->type != cf->module_type)
314 {
315 continue;
316 }
318 317
319 /* is the directive's location right ? */ 318 /* is the directive's location right ? */
320 319
321 if (!(cmd->type & cf->cmd_type)) { 320 if (!(cmd->type & cf->cmd_type)) {
322 if (cmd->type & NGX_CONF_MULTI) { 321 continue;
323 multi = 1;
324 continue;
325 }
326
327 goto not_allowed;
328 } 322 }
329 323
330 if (!(cmd->type & NGX_CONF_BLOCK) && last != NGX_OK) { 324 if (!(cmd->type & NGX_CONF_BLOCK) && last != NGX_OK) {
331 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 325 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
332 "directive \"%s\" is not terminated by \";\"", 326 "directive \"%s\" is not terminated by \";\"",
406 400
407 return NGX_ERROR; 401 return NGX_ERROR;
408 } 402 }
409 } 403 }
410 404
411 if (multi == 0) { 405 if (found) {
412 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 406 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
413 "unknown directive \"%s\"", name->data); 407 "\"%s\" directive is not allowed here", name->data);
414 408
415 return NGX_ERROR; 409 return NGX_ERROR;
416 } 410 }
417 411
418 not_allowed:
419
420 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 412 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
421 "\"%s\" directive is not allowed here", name->data); 413 "unknown directive \"%s\"", name->data);
414
422 return NGX_ERROR; 415 return NGX_ERROR;
423 416
424 invalid: 417 invalid:
425 418
426 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 419 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1446 1439
1447 return NGX_CONF_OK; 1440 return NGX_CONF_OK;
1448 } 1441 }
1449 1442
1450 1443
1444 #if 0
1445
1451 char * 1446 char *
1452 ngx_conf_unsupported(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 1447 ngx_conf_unsupported(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1453 { 1448 {
1454 return "unsupported on this platform"; 1449 return "unsupported on this platform";
1455 } 1450 }
1451
1452 #endif
1456 1453
1457 1454
1458 char * 1455 char *
1459 ngx_conf_deprecated(ngx_conf_t *cf, void *post, void *data) 1456 ngx_conf_deprecated(ngx_conf_t *cf, void *post, void *data)
1460 { 1457 {