Skip to content

Fix draft-16 SUBSCRIBE parser to read KVP parameter list - #5

Merged
mondain merged 1 commit into
openmoq:mainfrom
rwl4:main
Apr 14, 2026
Merged

Fix draft-16 SUBSCRIBE parser to read KVP parameter list#5
mondain merged 1 commit into
openmoq:mainfrom
rwl4:main

Conversation

@rwl4

@rwl4 rwl4 commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

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.

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
mondain merged commit f707ea7 into openmoq:main Apr 14, 2026
2 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.

2 participants