]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: proto_http: replace generic opaque types by real used types for the actions...
authorThierry FOURNIER <tfournier@arpalert.org>
Fri, 31 Jul 2015 06:54:25 +0000 (08:54 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 20 Aug 2015 15:13:46 +0000 (17:13 +0200)
This patch removes the generic opaque type for storing the configuration of the
action "set-method", "set-path", "set-query" and "set-uri".

include/types/action.h
src/proto_http.c

index 436c7fb0288f220c6e04cf6ba48f9eb3b180a1a6..188b17fabc1fdaeb55eba2ff9db368a54975ac58 100644 (file)
@@ -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;
index bc116d6f1652c9d38b447bd150409780353f0518..23c7eb4f8b3ef0ef448b769ba3a15e6a9385d212 100644 (file)
@@ -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);