mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
BUG/MINOR: arg: fix error reporting for add-header/set-header sample fetch arguments
The 'add-header %[samples]' parsing errors associated to http-request and http-response are displayed with the wrong keyword. Configuration entry: http-request set-header mon-header %[res.hdr(user-agent)] Original error message: [WARNING] 323/150920 (16559) : parsing [haproxy.conf:36] : 'log-format' : sample fetch <res.hdr ... After commit error message: [WARNING] 323/150929 (16580) : parsing [haproxy.conf:36] : 'http-request' : sample fetch <res.hdr ...
This commit is contained in:
parent
4a04dc368d
commit
1c0054fe83
@ -54,7 +54,8 @@ enum {
|
||||
ARGC_STK, /* sticking rule */
|
||||
ARGC_TRK, /* tracking rule */
|
||||
ARGC_LOG, /* log-format */
|
||||
ARGC_HDR, /* add-header */
|
||||
ARGC_HRQ, /* http-request */
|
||||
ARGC_HRS, /* http-response */
|
||||
ARGC_UIF, /* unique-id-format */
|
||||
};
|
||||
|
||||
|
@ -168,6 +168,10 @@ static inline const char *fmt_directive(const struct proxy *curproxy)
|
||||
{
|
||||
if (curproxy->conf.args.ctx == ARGC_UIF)
|
||||
return "unique-id-format";
|
||||
else if (curproxy->conf.args.ctx == ARGC_HRQ)
|
||||
return "http-request";
|
||||
else if (curproxy->conf.args.ctx == ARGC_HRS)
|
||||
return "http-response";
|
||||
else
|
||||
return "log-format";
|
||||
}
|
||||
|
@ -8465,7 +8465,7 @@ struct http_req_rule *parse_http_req_cond(const char **args, const char *file, i
|
||||
rule->arg.hdr_add.name_len = strlen(rule->arg.hdr_add.name);
|
||||
LIST_INIT(&rule->arg.hdr_add.fmt);
|
||||
|
||||
proxy->conf.args.ctx = ARGC_HDR;
|
||||
proxy->conf.args.ctx = ARGC_HRQ;
|
||||
parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.hdr_add.fmt, 0,
|
||||
(proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR);
|
||||
cur_arg += 2;
|
||||
@ -8633,7 +8633,7 @@ struct http_res_rule *parse_http_res_cond(const char **args, const char *file, i
|
||||
rule->arg.hdr_add.name_len = strlen(rule->arg.hdr_add.name);
|
||||
LIST_INIT(&rule->arg.hdr_add.fmt);
|
||||
|
||||
proxy->conf.args.ctx = ARGC_HDR;
|
||||
proxy->conf.args.ctx = ARGC_HRS;
|
||||
parse_logformat_string(args[cur_arg + 1], proxy, &rule->arg.hdr_add.fmt, 0,
|
||||
(proxy->cap & PR_CAP_BE) ? SMP_VAL_BE_HRS_HDR : SMP_VAL_FE_HRS_HDR);
|
||||
cur_arg += 2;
|
||||
|
@ -839,7 +839,8 @@ int smp_resolve_args(struct proxy *p)
|
||||
case ARGC_STK:where = "in stick rule in"; break;
|
||||
case ARGC_TRK: where = "in tracking rule in"; break;
|
||||
case ARGC_LOG: where = "in log-format string in"; break;
|
||||
case ARGC_HDR: where = "in HTTP header format string in"; break;
|
||||
case ARGC_HRQ: where = "in http-request header format string in"; break;
|
||||
case ARGC_HRS: where = "in http-response header format string in"; break;
|
||||
case ARGC_UIF: where = "in unique-id-format string in"; break;
|
||||
case ARGC_ACL: ctx = "ACL keyword"; break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user