From b3d6f44af8509063bf98591b4b86e9d64e73a8c1 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Wed, 29 Oct 2025 15:39:49 +0000 Subject: [PATCH] MEDIUM: h1: Immediately try to read data for frontend In h1_init(), if we're a frontend connection, immediately attempt to read data, if the connection is ready, instead of just subscribing. There may already be data available, at least if we're using 0RTT. This may be backported up to 2.8 in a while, after 3.3 is released, so that if it causes problem, we have a chance to hear about it. --- src/mux_h1.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/mux_h1.c b/src/mux_h1.c index 1d5e8c6cf..d9d63c271 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -1332,8 +1332,21 @@ static int h1_init(struct connection *conn, struct proxy *proxy, struct session /* prepare to read something */ if (b_data(&h1c->ibuf)) tasklet_wakeup(h1c->wait_event.tasklet); - else if (h1_recv_allowed(h1c)) - h1c->conn->xprt->subscribe(h1c->conn, h1c->conn->xprt_ctx, SUB_RETRY_RECV, &h1c->wait_event); + else if (h1_recv_allowed(h1c)) { + if (!conn_is_back(conn)) { + /* + * We may have data immediately available, + * especially if we're using 0RTT. + */ + if (h1_recv(h1c)) + tasklet_wakeup(h1c->wait_event.tasklet); + } else { + h1c->conn->xprt->subscribe(h1c->conn, + h1c->conn->xprt_ctx, + SUB_RETRY_RECV, + &h1c->wait_event); + } + } if (!conn_is_back(conn)) proxy_inc_fe_cum_sess_ver_ctr(sess->listener, proxy, 1); -- 2.47.3