]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: frontend: retrieve the ALPN name when available
authorWilly Tarreau <w@1wt.eu>
Sun, 4 Dec 2016 17:59:29 +0000 (18:59 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 27 Jun 2017 12:38:02 +0000 (14:38 +0200)
Here we try to retrieve the negociated ALPN on the front connection.
This will be used to decide whether or not we want to switch to H2.

src/frontend.c

index 4ad3cfe58b8ad592e49457c928badd9fecfa317a..efb6bde2aa4f09a76eb08a0bddb002797761d30a 100644 (file)
@@ -56,6 +56,14 @@ int frontend_accept(struct stream *s)
        struct connection *conn = objt_conn(sess->origin);
        struct listener *l = sess->listener;
        struct proxy *fe = sess->fe;
+       const char *alpn_str = NULL;
+       int alpn_len;
+
+       /* check if we're in HTTP mode, directly connected to the connection,
+        * and with ALPN advertising H2.
+        */
+       if (conn->owner == &s->si[0])
+               conn_get_alpn(conn, &alpn_str, &alpn_len);
 
        if ((fe->mode == PR_MODE_TCP || fe->mode == PR_MODE_HTTP)
            && (!LIST_ISEMPTY(&fe->logsrvs))) {