mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-04-03 01:51:05 +02:00
BUG/MINOR: tcpcheck: Use tcpcheck context for expressions parsing
When log-format stirngs were parsed in context of a tcpcheck, ARGC_SRV context was used instead of ARGC_TCK. This context is used to report accurrate errors. This patch could be backported to all stable versions.
This commit is contained in:
parent
64e3029e8b
commit
3e8b8aa6aa
@ -2774,7 +2774,7 @@ struct tcpcheck_rule *parse_tcpcheck_connect(char **args, int cur_arg, struct pr
|
||||
if (p != end) {
|
||||
int idx = 0;
|
||||
|
||||
px->conf.args.ctx = ARGC_SRV;
|
||||
px->conf.args.ctx = ARGC_TCK;
|
||||
port_expr = sample_parse_expr((char *[]){args[cur_arg], NULL}, &idx,
|
||||
file, line, errmsg, &px->conf.args, NULL);
|
||||
|
||||
@ -2985,7 +2985,7 @@ struct tcpcheck_rule *parse_tcpcheck_send(char **args, int cur_arg, struct proxy
|
||||
case TCPCHK_SEND_STRING_LF:
|
||||
case TCPCHK_SEND_BINARY_LF:
|
||||
lf_expr_init(&chk->send.fmt);
|
||||
px->conf.args.ctx = ARGC_SRV;
|
||||
px->conf.args.ctx = ARGC_TCK;
|
||||
if (!parse_logformat_string(data, px, &chk->send.fmt, 0, SMP_VAL_BE_CHK_RUL, errmsg)) {
|
||||
memprintf(errmsg, "'%s' invalid log-format string (%s).\n", data, *errmsg);
|
||||
goto error;
|
||||
@ -3126,7 +3126,7 @@ struct tcpcheck_rule *parse_tcpcheck_send_http(char **args, int cur_arg, struct
|
||||
if (uri) {
|
||||
if (chk->send.http.flags & TCPCHK_SND_HTTP_FL_URI_FMT) {
|
||||
lf_expr_init(&chk->send.http.uri_fmt);
|
||||
px->conf.args.ctx = ARGC_SRV;
|
||||
px->conf.args.ctx = ARGC_TCK;
|
||||
if (!parse_logformat_string(uri, px, &chk->send.http.uri_fmt, 0, SMP_VAL_BE_CHK_RUL, errmsg)) {
|
||||
memprintf(errmsg, "'%s' invalid log-format string (%s).\n", uri, *errmsg);
|
||||
goto error;
|
||||
@ -3170,7 +3170,7 @@ struct tcpcheck_rule *parse_tcpcheck_send_http(char **args, int cur_arg, struct
|
||||
if (body) {
|
||||
if (chk->send.http.flags & TCPCHK_SND_HTTP_FL_BODY_FMT) {
|
||||
lf_expr_init(&chk->send.http.body_fmt);
|
||||
px->conf.args.ctx = ARGC_SRV;
|
||||
px->conf.args.ctx = ARGC_TCK;
|
||||
if (!parse_logformat_string(body, px, &chk->send.http.body_fmt, 0, SMP_VAL_BE_CHK_RUL, errmsg)) {
|
||||
memprintf(errmsg, "'%s' invalid log-format string (%s).\n", body, *errmsg);
|
||||
goto error;
|
||||
@ -3575,7 +3575,7 @@ struct tcpcheck_rule *parse_tcpcheck_expect(char **args, int cur_arg, struct pro
|
||||
|
||||
cur_arg++;
|
||||
release_sample_expr(status_expr);
|
||||
px->conf.args.ctx = ARGC_SRV;
|
||||
px->conf.args.ctx = ARGC_TCK;
|
||||
status_expr = sample_parse_expr((char *[]){args[cur_arg], NULL}, &idx,
|
||||
file, line, errmsg, &px->conf.args, NULL);
|
||||
if (!status_expr) {
|
||||
@ -3647,14 +3647,14 @@ struct tcpcheck_rule *parse_tcpcheck_expect(char **args, int cur_arg, struct pro
|
||||
chk->expect.status_expr = status_expr; status_expr = NULL;
|
||||
|
||||
if (on_success_msg) {
|
||||
px->conf.args.ctx = ARGC_SRV;
|
||||
px->conf.args.ctx = ARGC_TCK;
|
||||
if (!parse_logformat_string(on_success_msg, px, &chk->expect.onsuccess_fmt, 0, SMP_VAL_BE_CHK_RUL, errmsg)) {
|
||||
memprintf(errmsg, "'%s' invalid log-format string (%s).\n", on_success_msg, *errmsg);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
if (on_error_msg) {
|
||||
px->conf.args.ctx = ARGC_SRV;
|
||||
px->conf.args.ctx = ARGC_TCK;
|
||||
if (!parse_logformat_string(on_error_msg, px, &chk->expect.onerror_fmt, 0, SMP_VAL_BE_CHK_RUL, errmsg)) {
|
||||
memprintf(errmsg, "'%s' invalid log-format string (%s).\n", on_error_msg, *errmsg);
|
||||
goto error;
|
||||
@ -3730,7 +3730,7 @@ struct tcpcheck_rule *parse_tcpcheck_expect(char **args, int cur_arg, struct pro
|
||||
case TCPCHK_EXPECT_BINARY_LF:
|
||||
case TCPCHK_EXPECT_HTTP_BODY_LF:
|
||||
lf_expr_init(&chk->expect.fmt);
|
||||
px->conf.args.ctx = ARGC_SRV;
|
||||
px->conf.args.ctx = ARGC_TCK;
|
||||
if (!parse_logformat_string(pattern, px, &chk->expect.fmt, 0, SMP_VAL_BE_CHK_RUL, errmsg)) {
|
||||
memprintf(errmsg, "'%s' invalid log-format string (%s).\n", pattern, *errmsg);
|
||||
goto error;
|
||||
@ -3748,7 +3748,7 @@ struct tcpcheck_rule *parse_tcpcheck_expect(char **args, int cur_arg, struct pro
|
||||
goto error;
|
||||
}
|
||||
else if (chk->expect.flags & TCPCHK_EXPT_FL_HTTP_HNAME_FMT) {
|
||||
px->conf.args.ctx = ARGC_SRV;
|
||||
px->conf.args.ctx = ARGC_TCK;
|
||||
lf_expr_init(&chk->expect.hdr.name_fmt);
|
||||
if (!parse_logformat_string(npat, px, &chk->expect.hdr.name_fmt, 0, SMP_VAL_BE_CHK_RUL, errmsg)) {
|
||||
memprintf(errmsg, "'%s' invalid log-format string (%s).\n", npat, *errmsg);
|
||||
@ -3778,7 +3778,7 @@ struct tcpcheck_rule *parse_tcpcheck_expect(char **args, int cur_arg, struct pro
|
||||
goto error;
|
||||
}
|
||||
else if (chk->expect.flags & TCPCHK_EXPT_FL_HTTP_HVAL_FMT) {
|
||||
px->conf.args.ctx = ARGC_SRV;
|
||||
px->conf.args.ctx = ARGC_TCK;
|
||||
lf_expr_init(&chk->expect.hdr.value_fmt);
|
||||
if (!parse_logformat_string(vpat, px, &chk->expect.hdr.value_fmt, 0, SMP_VAL_BE_CHK_RUL, errmsg)) {
|
||||
memprintf(errmsg, "'%s' invalid log-format string (%s).\n", vpat, *errmsg);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user