mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
[BUG] cfgparser/stats: fix error message
Fix the error message by unification and goto, previously we had two independent lists of supported keywords and were raporting 'stats' instead of a wrong keyword. Code: stats wrong-keyword stats Before: [ALERT] 005/163032 (27175) : parsing [haproxy.cfg:248] : unknown stats parameter 'stats' (expects 'hide-version', 'uri', 'realm', 'auth' or 'enable'). [ALERT] 005/163032 (27175) : parsing [haproxy.cfg:249] : 'stats' expects 'uri', 'realm', 'auth', 'scope' or 'enable', 'hide-version', 'show-node', 'show-desc', 'show-legends'. After: [ALERT] 005/162841 (22710) : parsing [haproxy.cfg:248]: unknown stats parameter 'wrong-keyword', expects 'uri', 'realm', 'auth', 'scope', 'enable', 'hide-version', 'show-node', 'show-desc' or 'show-legends'. [ALERT] 005/162841 (22710) : parsing [haproxy.cfg:249]: missing keyword in 'stats', expects 'uri', 'realm', 'auth', 'scope', 'enable', 'hide-version', 'show-node', 'show-desc' or 'show-legends'.
This commit is contained in:
parent
c0f0c8605b
commit
260a3bb17b
@ -1978,10 +1978,8 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||||||
if (curproxy != &defproxy && curproxy->uri_auth == defproxy.uri_auth)
|
if (curproxy != &defproxy && curproxy->uri_auth == defproxy.uri_auth)
|
||||||
curproxy->uri_auth = NULL; /* we must detach from the default config */
|
curproxy->uri_auth = NULL; /* we must detach from the default config */
|
||||||
|
|
||||||
if (*(args[1]) == 0) {
|
if (!*args[1]) {
|
||||||
Alert("parsing [%s:%d] : '%s' expects 'uri', 'realm', 'auth', 'scope' or 'enable', 'hide-version', 'show-node', 'show-desc', 'show-legends'.\n", file, linenum, args[0]);
|
goto stats_error_parsing;
|
||||||
err_code |= ERR_ALERT | ERR_FATAL;
|
|
||||||
goto out;
|
|
||||||
} else if (!strcmp(args[1], "uri")) {
|
} else if (!strcmp(args[1], "uri")) {
|
||||||
if (*(args[2]) == 0) {
|
if (*(args[2]) == 0) {
|
||||||
Alert("parsing [%s:%d] : 'uri' needs an URI prefix.\n", file, linenum);
|
Alert("parsing [%s:%d] : 'uri' needs an URI prefix.\n", file, linenum);
|
||||||
@ -2110,8 +2108,9 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||||||
free(desc);
|
free(desc);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Alert("parsing [%s:%d] : unknown stats parameter '%s' (expects 'hide-version', 'uri', 'realm', 'auth' or 'enable').\n",
|
stats_error_parsing:
|
||||||
file, linenum, args[0]);
|
Alert("parsing [%s:%d]: %s '%s', expects 'uri', 'realm', 'auth', 'scope', 'enable', 'hide-version', 'show-node', 'show-desc' or 'show-legends'.\n",
|
||||||
|
file, linenum, *args[1]?"unknown stats parameter":"missing keyword in", args[*args[1]?1:0]);
|
||||||
err_code |= ERR_ALERT | ERR_FATAL;
|
err_code |= ERR_ALERT | ERR_FATAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user