]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: mux_quic: reset stream after app shutdown for HTTP/0.9
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 22 Apr 2026 07:28:24 +0000 (09:28 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 6 May 2026 06:51:27 +0000 (08:51 +0200)
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

index 4208029aa6b6b73372402d22f67ecee6f2aeab66..5300ca5f633a3b9b61321afd26873b2534b1b15f 100644 (file)
@@ -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;
        }