]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: config/proxy: Don't warn for HTTP rules in TCP if 'switch-mode http' set
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 15 Mar 2021 14:10:38 +0000 (15:10 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 1 Apr 2021 11:22:42 +0000 (13:22 +0200)
Warnings about ignored HTTP directives in a TCP proxy are inhibited if at
least one switch-mode tcp action is configured to perform HTTP upgraded.

include/haproxy/proxy-t.h
src/cfgparse.c
src/stream.c

index e8e23851b5ff9327f5f0a63bcc78e3e82df7dbc1..02d1391df2acd808515f18165d84eac003e551c9 100644 (file)
@@ -89,7 +89,7 @@ enum PR_SRV_STATE_FILE {
 #define PR_O_IGNORE_PRB 0x00000200      /* ignore empty requests (aborts and timeouts) */
 #define PR_O_NULLNOLOG  0x00000400      /* a connect without request will not be logged */
 #define PR_O_WREQ_BODY  0x00000800      /* always wait for the HTTP request body */
-/* unused: 0x1000 */
+#define PR_O_HTTP_UPG   0x00001000      /* Contain a "switch-mode http" tcp-request rule */
 #define PR_O_FF_ALWAYS  0x00002000      /* always set x-forwarded-for */
 #define PR_O_PERSIST    0x00004000      /* server persistence stays effective even when server is down */
 #define PR_O_LOGASAP    0x00008000      /* log as soon as possible, without waiting for the stream to complete */
index 2682fba3335e692de1c436915229a3fb28a1f792..7f82409ed945b796217f53871556ef8294842771 100644 (file)
@@ -3055,7 +3055,7 @@ out_uri_auth_compat:
                        err_code |= ERR_WARN;
                }
 
-               if (curproxy->mode != PR_MODE_HTTP) {
+               if (curproxy->mode != PR_MODE_HTTP && !(curproxy->options & PR_O_HTTP_UPG)) {
                        int optnum;
 
                        if (curproxy->uri_auth) {
index a0c68749a5fd27de9220e1ec48eeada09edc9517..702082bdaaa986c3147845db673aa05b71a7e844 100644 (file)
@@ -2870,6 +2870,9 @@ static int check_tcp_switch_stream_mode(struct act_rule *rule, struct proxy *px,
        enum pr_mode pr_mode = (uintptr_t)rule->arg.act.p[0];
        enum proto_proxy_mode mode = (1 << (pr_mode == PR_MODE_HTTP));
 
+       if (pr_mode == PR_MODE_HTTP)
+               px->options |= PR_O_HTTP_UPG;
+
        if (mux_proto) {
                mux_ent = conn_get_best_mux_entry(mux_proto->token, PROTO_SIDE_FE, mode);
                if (!mux_ent || !isteq(mux_ent->token, mux_proto->token)) {