Fix draft-16 SUBSCRIBE parser to read KVP parameter list - #5
Merged
Conversation
Previously decode_subscribe_message always parsed the draft-14 layout (inline subscriber_priority, group_order, forward, filter_type) even when the session had negotiated draft-16. Every incoming SUBSCRIBE over draft-16 was rejected with "received invalid SUBSCRIBE" because the parameter-count byte was being read as subscriber_priority and the first KVP delta-type (0x21 for SUBSCRIPTION_FILTER) tripped the group_order <= 2 guard. - Thread DraftVersion through decode_subscribe_message and both call sites in moqt_session.cpp (trace + serve_subscriptions). - Implement a draft-16 branch that reads a delta-encoded KVP parameter list and populates SubscribeMessage from FORWARD (0x10), SUBSCRIBER_PRIORITY (0x20), SUBSCRIPTION_FILTER (0x21), and GROUP_ORDER (0x22). Tolerate spec-listed SUBSCRIBE parameters we do not act on (DELIVERY_TIMEOUT, AUTHORIZATION_TOKEN, NEW_GROUP_REQUEST) and reject any truly unknown parameter per spec section 9.2. - Apply spec defaults when parameters are omitted (subscriber_priority = 128, forward = 1) and enforce strict GROUP_ORDER wire values (0x1 or 0x2 only) per spec section 9.2.2.4. - Test helper now encodes a real draft-16 SUBSCRIBE when asked. - Fix server-originated request IDs in the fixture to be odd per spec section 9.1 (was using even IDs). - Add regression tests covering the literal bytes captured from an Akamai relay, rejection of unknown parameters, and rejection of GROUP_ORDER=0 on the wire.
mondain
approved these changes
Apr 14, 2026
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.
Previously decode_subscribe_message always parsed the draft-14 layout (inline subscriber_priority, group_order, forward, filter_type) even when the session had negotiated draft-16. Every incoming SUBSCRIBE over draft-16 was rejected with "received invalid SUBSCRIBE" because the parameter-count byte was being read as subscriber_priority and the first KVP delta-type (0x21 for SUBSCRIPTION_FILTER) tripped the group_order <= 2 guard.