]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: frontend: report the connection's ALPN in the debug output
authorWilly Tarreau <w@1wt.eu>
Sun, 4 Dec 2016 18:05:24 +0000 (19:05 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 27 Jun 2017 12:38:02 +0000 (14:38 +0200)
Now the incoming connection will also report the ALPN field, truncated
to 15 characters.

src/frontend.c

index efb6bde2aa4f09a76eb08a0bddb002797761d30a..24805085037152cb6e9db0fa1137d7b428796dc8 100644 (file)
@@ -101,21 +101,28 @@ int frontend_accept(struct stream *s)
        if (unlikely((global.mode & MODE_DEBUG) && conn &&
                     (!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)))) {
                char pn[INET6_ADDRSTRLEN];
+               char alpn[16] = "<none>";
 
                conn_get_from_addr(conn);
 
+               if (alpn_str) {
+                       int len = MIN(alpn_len, sizeof(alpn) - 1);
+                       memcpy(alpn, alpn_str, len);
+                       alpn[len] = 0;
+               }
+
                switch (addr_to_str(&conn->addr.from, pn, sizeof(pn))) {
                case AF_INET:
                case AF_INET6:
-                       chunk_printf(&trash, "%08x:%s.accept(%04x)=%04x from [%s:%d]\n",
+                       chunk_printf(&trash, "%08x:%s.accept(%04x)=%04x from [%s:%d] ALPN=%s\n",
                                     s->uniq_id, fe->id, (unsigned short)l->fd, (unsigned short)conn->t.sock.fd,
-                                    pn, get_host_port(&conn->addr.from));
+                                    pn, get_host_port(&conn->addr.from), alpn);
                        break;
                case AF_UNIX:
                        /* UNIX socket, only the destination is known */
-                       chunk_printf(&trash, "%08x:%s.accept(%04x)=%04x from [unix:%d]\n",
+                       chunk_printf(&trash, "%08x:%s.accept(%04x)=%04x from [unix:%d] ALPN=%s\n",
                                     s->uniq_id, fe->id, (unsigned short)l->fd, (unsigned short)conn->t.sock.fd,
-                                    l->luid);
+                                    l->luid, alpn);
                        break;
                }