From: Thierry FOURNIER Date: Wed, 20 Nov 2013 14:09:52 +0000 (+0100) Subject: BUG/MINOR: arg: fix error reporting for add-header/set-header sample fetch arguments X-Git-Tag: v1.5-dev20~204 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c0054fe83c19eaab8b37ce57d033aa5c4b75c04;p=thirdparty%2Fhaproxy.git 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 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"; } diff --git a/src/proto_http.c b/src/proto_http.c index 1921b93298..b5ad54c848 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -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; diff --git a/src/sample.c b/src/sample.c index 1a2ab478a7..dc2304a7de 100644 --- a/src/sample.c +++ b/src/sample.c @@ -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; }