Skip to content

fix(datagram): preserve quarter stream id - #340

Merged
seanmonstar merged 3 commits into
hyperium:masterfrom
HeikoBornholdt:fix/h3-datagram-stream-id
Aug 7, 2026
Merged

fix(datagram): preserve quarter stream id#340
seanmonstar merged 3 commits into
hyperium:masterfrom
HeikoBornholdt:fix/h3-datagram-stream-id

Conversation

@HeikoBornholdt

Copy link
Copy Markdown
Contributor

h3-datagram encoded the Quarter Stream ID correctly, but then stored a zeroed buffer in EncodedDatagram. As a result, every outgoing HTTP/3 Datagram was serialized with Quarter Stream ID 0.

This breaks datagrams for later request streams on the same HTTP/3 connection, for example when multiple MASQUE CONNECT-UDP sessions share one H3 connection. Those datagrams appear to belong to the first request stream and may be routed to the wrong session, ignored, or rejected.

@Streetblock Streetblock left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this commit in an isolated merge against current upstream/master.

  • the merge is conflict-free
  • cargo fmt --all -- --check passes
  • cargo test --workspace passes (227 h3 tests, the h3-datagram test, and 9 documentation tests)
  • the only warning is the pre-existing direct-path h3-quinn cfg warning tracked separately in #335

I also expanded the round-trip test locally across all QUIC VarInt width boundaries for Quarter Stream IDs (0, 1, 2^6-1, 2^6, 2^14-1, 2^14, 2^30-1, 2^30, and 2^60-1). All cases preserve the original stream ID and payload.

The one-line production fix correctly uses the already encoded header buffer instead of replacing it with zeros. The broader boundary table could be a useful optional test enhancement, but I do not consider it a merge blocker.

@seanmonstar seanmonstar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@seanmonstar
seanmonstar merged commit ebd4260 into hyperium:master Aug 7, 2026
16 checks passed
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.

3 participants