Skip to content

Fix ASGI disconnect handling for HTTP/3 stream resets and connection termination - #383 - #384

Open
appunni-m wants to merge 3 commits into
pgjones:mainfrom
appunni-m:fix/h3-asgi-disconnect
Open

appunni-m wants to merge 3 commits into
pgjones:mainfrom
appunni-m:fix/h3-asgi-disconnect

Conversation

@appunni-m

Copy link
Copy Markdown

#383 :

Hypercorn’s HTTP/3 path did not propagate some QUIC disconnect events to the ASGI application.

When a client reset an HTTP/3 request stream, or when the underlying QUIC connection terminated, Hypercorn received the QUIC event but the corresponding ASGI application could remain unaware and continue waiting on receive().

The expected flow is:

QUIC StreamReset / ConnectionTerminated
        ↓
Hypercorn closes affected request stream(s)
        ↓
ASGI application receives
{"type": "http.disconnect"}

This change routes these HTTP/3 lifecycle events through Hypercorn’s existing StreamClosed handling.

For StreamReset, only the affected request stream is closed.

For ConnectionTerminated, all active request streams on that QUIC connection are closed.

This brings the HTTP/3 path in line with Hypercorn’s existing disconnect semantics and the ASGI HTTP disconnect event.

Reproduction

Before this change:

HTTP/3 request
    ↓
client resets stream
    ↓
Hypercorn receives StreamReset
    ↓
ASGI application keeps waiting on receive()

After this change:

HTTP/3 request
    ↓
client resets stream
    ↓
Hypercorn closes the request stream
    ↓
ASGI application receives http.disconnect

Relevant specifications:

  • ASGI HTTP spec — http.disconnect
  • RFC 9114 — HTTP/3 request cancellation
  • RFC 9000 — QUIC stream reset and connection termination

@appunni-m
appunni-m force-pushed the fix/h3-asgi-disconnect branch from 61536d5 to 05716d4 Compare October 4, 2026 12:17

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant