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.
This commit is contained in:
Christopher Faulet 2021-03-15 15:10:38 +01:00
parent ae863c62e3
commit 3b6446f4d9
3 changed files with 5 additions and 2 deletions

View 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 */

View 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) {

View 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)) {