moq-native,relay: don't advertise the illegal qmux-00.moqt-18 pair#1579
Merged
Conversation
moq-transport-18 requires qmux-01, so `qmux-00.moqt-18` is an illegal WebSocket subprotocol pair. dev advertised the full qmux x moq ALPN matrix (and offered every draft per ALPN), which produced that pair; js/net already pins draft-18 to qmux-01, so the Rust side was the outlier. Add a `qmux_versions_for` helper in moq-native that pins moqt-18 to qmux-01 and leaves every other ALPN unrestricted (`&[]`, expanded by qmux), used by both the WebSocket client and listener. The relay's `supported_subprotocols` skips the qmux-00.moqt-18 cell. Each crate guards the "moqt-18" literal with a test so it stays the draft-18 ALPN. No new public API. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4 tasks
Share the axum test harness behind a `spawn_test_server` helper and add `every_advertised_pair_is_acceptable`: for each versioned `(qmux, moq)` pair in `supported_subprotocols`, a client offering exactly that pair must negotiate it end-to-end. Conversely, offering the excluded `qmux-00.moqt-18` pair must fail the handshake rather than silently downgrade. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
moq-transport-18 requires qmux-01, so
qmux-00.moqt-18is an illegal WebSocket subprotocol pair. Ondevthe Rust side advertised the full{qmux-01, qmux-00} × moq_net::ALPNSmatrix (relay) and offered every draft per ALPN (&[], native client/listener), which produces that illegal pair.js/net'sconnect.tsalready pins draft-18 to qmux-01, so the Rust side was the outlier; this brings it in line.rs/moq-native/src/websocket.rs: add a privateqmux_versions_for(alpn)helper that pinsmoqt-18toqmux-01and returns&[](every draft) for all other ALPNs. Used by both the WebSocket clientconnect()and theWebSocketListener.rs/moq-relay/src/websocket.rs:supported_subprotocols()skips theqmux-00.moqt-18cell of the matrix."moqt-18"literal with a test asserting it stays the IETF draft-18 ALPN (wire0xff000012), so the pin can't silently rot.No new public API.
js/netalready encodes this policy, so no JS change is needed.Background
This supersedes #1513, which added a
moq-netversion→qmux policy mapping (QmuxVersion,qmux_versions(),QMUX_ALPNS,QMUX_ALPN_STRINGS, etc.) as a workaround for qmux 0.1.0.dev's qmux 0.1.1with_protocols(alpn, &[Version])API plus the full-matrixsupported_subprotocols()already handle qmux negotiation, so that surface is redundant. The only real gap was the one illegal pair, which this fixes minimally.Test plan
cargo test -p moq-native -p moq-relay --lib websocket::— passes, including:moqt_18_pins_to_qmux01/supported_subprotocols_lists_full_matrix: the pin and the advertised matrix (with the illegal pair excluded), plus draft-18 literal drift guards.every_advertised_pair_is_acceptable: spins up the axum WebSocket handler and, for every versioned(qmux, moq)pair we advertise, connects a client offering exactly that pair and asserts it negotiates end-to-end; also asserts offeringqmux-00.moqt-18fails the handshake.axum_ws_negotiates_newest_moq_alpn: existing newest-ALPN regression, refactored onto a sharedspawn_test_serverharness.cargo fmt -p moq-native -p moq-relay -- --checkclean.cargo clippy -p moq-native -p moq-relay --all-targets -- -D warningsclean.(Written by Claude)