[nginx] svn commit: r4804 - in branches/stable-1.2: . src/core src/http
mdounin at mdounin.ru
mdounin at mdounin.ru
Mon Aug 6 17:31:33 UTC 2012
Author: mdounin
Date: 2012-08-06 17:31:32 +0000 (Mon, 06 Aug 2012)
New Revision: 4804
URL: http://trac.nginx.org/nginx/changeset/4804/nginx
Log:
Merge of r4769: better diagnostics for directives in wrong context.
Modified:
branches/stable-1.2/
branches/stable-1.2/src/core/ngx_conf_file.c
branches/stable-1.2/src/core/ngx_conf_file.h
branches/stable-1.2/src/http/ngx_http_core_module.c
Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2 2012-08-06 17:20:01 UTC (rev 4803)
+++ branches/stable-1.2 2012-08-06 17:31:32 UTC (rev 4804)
Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4738,4740-4741,4754,4756-4768
+/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4738,4740-4741,4754,4756-4769
\ No newline at end of property
Modified: branches/stable-1.2/src/core/ngx_conf_file.c
===================================================================
--- branches/stable-1.2/src/core/ngx_conf_file.c 2012-08-06 17:20:01 UTC (rev 4803)
+++ branches/stable-1.2/src/core/ngx_conf_file.c 2012-08-06 17:31:32 UTC (rev 4804)
@@ -282,24 +282,16 @@
{
char *rv;
void *conf, **confp;
- ngx_uint_t i, multi;
+ ngx_uint_t i, found;
ngx_str_t *name;
ngx_command_t *cmd;
name = cf->args->elts;
- multi = 0;
+ found = 0;
for (i = 0; ngx_modules[i]; i++) {
- /* look up the directive in the appropriate modules */
-
- if (ngx_modules[i]->type != NGX_CONF_MODULE
- && ngx_modules[i]->type != cf->module_type)
- {
- continue;
- }
-
cmd = ngx_modules[i]->commands;
if (cmd == NULL) {
continue;
@@ -315,16 +307,18 @@
continue;
}
+ found = 1;
+ if (ngx_modules[i]->type != NGX_CONF_MODULE
+ && ngx_modules[i]->type != cf->module_type)
+ {
+ continue;
+ }
+
/* is the directive's location right ? */
if (!(cmd->type & cf->cmd_type)) {
- if (cmd->type & NGX_CONF_MULTI) {
- multi = 1;
- continue;
- }
-
- goto not_allowed;
+ continue;
}
if (!(cmd->type & NGX_CONF_BLOCK) && last != NGX_OK) {
@@ -408,17 +402,16 @@
}
}
- if (multi == 0) {
+ if (found) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "unknown directive \"%s\"", name->data);
+ "\"%s\" directive is not allowed here", name->data);
return NGX_ERROR;
}
-not_allowed:
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "unknown directive \"%s\"", name->data);
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "\"%s\" directive is not allowed here", name->data);
return NGX_ERROR;
invalid:
Modified: branches/stable-1.2/src/core/ngx_conf_file.h
===================================================================
--- branches/stable-1.2/src/core/ngx_conf_file.h 2012-08-06 17:20:01 UTC (rev 4803)
+++ branches/stable-1.2/src/core/ngx_conf_file.h 2012-08-06 17:31:32 UTC (rev 4804)
@@ -45,7 +45,7 @@
#define NGX_CONF_ANY 0x00000400
#define NGX_CONF_1MORE 0x00000800
#define NGX_CONF_2MORE 0x00001000
-#define NGX_CONF_MULTI 0x00002000
+#define NGX_CONF_MULTI 0x00000000 /* compatibility */
#define NGX_DIRECT_CONF 0x00010000
Modified: branches/stable-1.2/src/http/ngx_http_core_module.c
===================================================================
--- branches/stable-1.2/src/http/ngx_http_core_module.c 2012-08-06 17:20:01 UTC (rev 4803)
+++ branches/stable-1.2/src/http/ngx_http_core_module.c 2012-08-06 17:31:32 UTC (rev 4804)
@@ -222,7 +222,7 @@
NULL },
{ ngx_string("server"),
- NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_MULTI|NGX_CONF_NOARGS,
+ NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
ngx_http_core_server,
0,
0,
More information about the nginx-devel
mailing list