Skip to content

Commit 5147ec4

Browse files
committed
MINOR: quic: use server cache for ALPN on BE side
On the backend side, the ALPN may not be available in transport layer if the MUX was started before handshake completion. Thus, it is necessary to retrieve it from the server cache.
1 parent de91aca commit 5147ec4

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/mux_quic.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,13 +1695,25 @@ int qcc_install_app_ops(struct qcc *qcc)
16951695
{
16961696
struct connection *conn = qcc->conn;
16971697
const struct qcc_app_ops *app_ops;
1698+
struct server *srv;
16981699
const char *alpn;
16991700
int alpn_len;
17001701

17011702
TRACE_ENTER(QMUX_EV_QCC_NEW, conn);
17021703

1703-
if (!conn_get_alpn(conn, &alpn, &alpn_len))
1704-
goto err;
1704+
if (!conn_get_alpn(conn, &alpn, &alpn_len)) {
1705+
if (!conn_is_back(conn))
1706+
goto err;
1707+
1708+
srv = __objt_server(conn->target);
1709+
HA_RWLOCK_RDLOCK(SERVER_LOCK, &srv->path_params.param_lock);
1710+
alpn = srv->path_params.nego_alpn;
1711+
HA_RWLOCK_RDUNLOCK(SERVER_LOCK, &srv->path_params.param_lock);
1712+
1713+
if (!alpn)
1714+
goto err;
1715+
alpn_len = strlen(srv->path_params.nego_alpn);
1716+
}
17051717

17061718
app_ops = quic_alpn_to_app_ops(alpn, alpn_len);
17071719
if (!app_ops)

src/xprt_quic.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ static int qc_get_alpn(const struct connection *conn, void *xprt_ctx, const char
245245
int ret = 0;
246246

247247
TRACE_ENTER(QUIC_EV_CONN_NEW, qc);
248+
248249
if (qc->alpn) {
249250
*str = qc->alpn;
250251
*len = strlen(qc->alpn);

0 commit comments

Comments
 (0)