From: Christopher Faulet Date: Mon, 15 Mar 2021 14:10:38 +0000 (+0100) Subject: MINOR: config/proxy: Don't warn for HTTP rules in TCP if 'switch-mode http' set X-Git-Tag: v2.4-dev15~44 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3b6446f4d99dd0e046468889d691b19cbf7f15de;p=thirdparty%2Fhaproxy.git MINOR: config/proxy: Don't warn for HTTP rules in TCP if 'switch-mode http' set 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. --- diff --git a/include/haproxy/proxy-t.h b/include/haproxy/proxy-t.h index e8e23851b5..02d1391df2 100644 --- a/include/haproxy/proxy-t.h +++ b/include/haproxy/proxy-t.h @@ -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 */ diff --git a/src/cfgparse.c b/src/cfgparse.c index 2682fba333..7f82409ed9 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -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) { diff --git a/src/stream.c b/src/stream.c index a0c68749a5..702082bdaa 100644 --- a/src/stream.c +++ b/src/stream.c @@ -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)) {