]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: connection: support HTTP/3.0 for smp_*_http_major fetch
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 7 Jun 2022 09:57:20 +0000 (11:57 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 7 Jun 2022 10:04:12 +0000 (12:04 +0200)
smp_fc_http_major may be used to return the http version as an integer
used on the frontend or backend side. Previously, the handler only
checked for version 2 or 1 as a fallback. Extend it to support version 3
with the QUIC mux.

src/connection.c

index 620ef97f7c643f2a3c3abdac9ecb4c0c62c34a6e..f68c14a173d17a5d4986de90741d31e0c6dfcedb 100644 (file)
@@ -2101,6 +2101,7 @@ static int
 smp_fetch_fc_http_major(const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
        struct connection *conn = NULL;
+       const char *mux_name = NULL;
 
        if (obj_type(smp->sess->origin) == OBJ_TYPE_CHECK)
                 conn = (kw[0] == 'b') ? sc_conn(__objt_check(smp->sess->origin)->sc) : NULL;
@@ -2118,8 +2119,16 @@ smp_fetch_fc_http_major(const struct arg *args, struct sample *smp, const char *
                return 0;
        }
 
+       mux_name = conn_get_mux_name(conn);
+
        smp->data.type = SMP_T_SINT;
-       smp->data.u.sint = (strcmp(conn_get_mux_name(conn), "H2") == 0) ? 2 : 1;
+       if (strcmp(mux_name, "QUIC") == 0)
+               smp->data.u.sint = 3;
+       else if (strcmp(mux_name, "H2") == 0)
+               smp->data.u.sint = 2;
+       else
+               smp->data.u.sint = 1;
+
        return 1;
 }