From af49294633abd3fb41067027fe97bd09c414891f Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Wed, 22 Apr 2026 09:28:24 +0200 Subject: [PATCH] MINOR: mux_quic: reset stream after app shutdown for HTTP/0.9 HTTP/3 implements a GOAWAY frame for graceful shutdown. This allows to reject any new stream opening with a larger ID. This is implemented via HTTP/3 attach() callback called by qcs_new(). When HTTP/0.9 is used, there is no similar mechanism. This renders some feature such as server max-reuse difficult to implement. This patch now provides a method for such protocols with no graceful shutdown support. Instead of invoking attach() callback, a stream is now immediately resetted if the application protocol layer is already closed. This patch does not change the behavior for HTTP/3. Only limited protocols (currently only HTTP/0.9) without graceful shutdown are impacted. These protocols are identified as their shutdown() callback is nul. This change is only necessary for HTTP/0.9 as there is no equivalent of HTTP/3 GOAWAY in this case. --- src/mux_quic.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mux_quic.c b/src/mux_quic.c index 4208029aa..5300ca5f6 100644 --- a/src/mux_quic.c +++ b/src/mux_quic.c @@ -223,7 +223,16 @@ static struct qcs *qcs_new(struct qcc *qcc, uint64_t id, enum qcs_type type) } } - if (qcc->app_ops->attach && qcc->app_ops->attach(qcs, qcc->ctx)) { + /* If app layer is closed, reset immediately a new stream if proto does + * not implement graceful shutdown. Else proto is responsible to either + * accept or reject the new stream via its attach() operation. + */ + if (qcc->app_st >= QCC_APP_ST_SHUT && !qcc->app_ops->shutdown) { + qcc_abort_stream_read(qcs); + qcc_reset_stream(qcs, 0, 0); + goto out; + } + else if (qcc->app_ops->attach && qcc->app_ops->attach(qcs, qcc->ctx)) { TRACE_ERROR("app proto failure", QMUX_EV_QCS_NEW, qcc->conn, qcs); goto err; }