From: Thierry FOURNIER Date: Fri, 31 Jul 2015 06:54:25 +0000 (+0200) Subject: MINOR: proto_http: replace generic opaque types by real used types for the actions... X-Git-Tag: v1.6-dev4~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8855a92d8cc45a6751093238d82df858365366df;p=thirdparty%2Fhaproxy.git MINOR: proto_http: replace generic opaque types by real used types for the actions on thr request line This patch removes the generic opaque type for storing the configuration of the action "set-method", "set-path", "set-query" and "set-uri". --- diff --git a/include/types/action.h b/include/types/action.h index 436c7fb028..188b17fabc 100644 --- a/include/types/action.h +++ b/include/types/action.h @@ -57,6 +57,10 @@ struct act_rule { struct list value; /* pattern to retrieve MAP value */ } map; struct sample_expr *expr; + struct { + struct list logfmt; + int action; + } http; struct hlua_rule *hlua_rule; struct { struct sample_expr *expr; diff --git a/src/proto_http.c b/src/proto_http.c index bc116d6f16..23c7eb4f8b 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -12248,11 +12248,11 @@ int http_action_set_req_line(struct act_rule *rule, struct proxy *px, chunk_reset(&trash); /* If we have to create a query string, prepare a '?'. */ - if (*(int *)&rule->arg.act.p[2] == 2) + if (rule->arg.http.action == 2) trash.str[trash.len++] = '?'; - trash.len += build_logline(s, trash.str + trash.len, trash.size - trash.len, (struct list *)&rule->arg.act.p[0]); + trash.len += build_logline(s, trash.str + trash.len, trash.size - trash.len, &rule->arg.http.logfmt); - http_replace_req_line(*(int *)&rule->arg.act.p[2], trash.str, trash.len, px, s); + http_replace_req_line(rule->arg.http.action, trash.str, trash.len, px, s); return 1; } @@ -12275,19 +12275,19 @@ int parse_set_req_line(const char **args, int *orig_arg, struct proxy *px, struc switch (args[0][4]) { case 'm' : - *(int *)&rule->arg.act.p[2] = 0; + rule->arg.http.action = 0; rule->action_ptr = http_action_set_req_line; break; case 'p' : - *(int *)&rule->arg.act.p[2] = 1; + rule->arg.http.action = 1; rule->action_ptr = http_action_set_req_line; break; case 'q' : - *(int *)&rule->arg.act.p[2] = 2; + rule->arg.http.action = 2; rule->action_ptr = http_action_set_req_line; break; case 'u' : - *(int *)&rule->arg.act.p[2] = 3; + rule->arg.http.action = 3; rule->action_ptr = http_action_set_req_line; break; default: @@ -12301,9 +12301,9 @@ int parse_set_req_line(const char **args, int *orig_arg, struct proxy *px, struc return -1; } - LIST_INIT((struct list *)&rule->arg.act.p[0]); + LIST_INIT(&rule->arg.http.logfmt); proxy->conf.args.ctx = ARGC_HRQ; - parse_logformat_string(args[cur_arg], proxy, (struct list *)&rule->arg.act.p[0], LOG_OPT_HTTP, + parse_logformat_string(args[cur_arg], proxy, &rule->arg.http.logfmt, LOG_OPT_HTTP, (proxy->cap & PR_CAP_FE) ? SMP_VAL_FE_HRQ_HDR : SMP_VAL_BE_HRQ_HDR, proxy->conf.args.file, proxy->conf.args.line);