Skip to content

Commit 850e8f2

Browse files
gmarzotafrind
authored andcommitted
moq_decode: request_id left response messages in draft-17, not 18
Per the draft-17 spec text, Request ID was already removed from PUBLISH_DONE, SUBSCRIBE_OK, REQUEST_OK, REQUEST_ERROR and FETCH_OK in draft-17 (implicit from the bidi request stream context). The tool's gates said draft < 18, copied from MoQFramer -- but moxygen skips draft 17 entirely (kSupportedVersions = 14/15/16/18), so its < 18 gates are only ever exercised as <= 16 and happen to work. For a spec decoder with an explicit --version flag, < 17 is the correct boundary. Fixes: - PUBLISH_DONE and FETCH_OK read request_id unconditionally; gate them. - SUBSCRIBE_OK / REQUEST_OK / REQUEST_ERROR gates corrected 18 -> 17. Reported by a user decoding draft-17 PUBLISH_DONE frames.
1 parent 0ee1d9d commit 850e8f2

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

tools/moq_decode.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,8 @@ def parse_subscribe(cursor, annot, draft, payload_end=None):
517517

518518

519519
def parse_subscribe_ok(cursor, annot, draft, payload_end):
520-
# Draft 18+: request_id is implicit from the bidi request stream context.
521-
if draft < 18:
520+
# Draft 17+: request_id is implicit from the bidi request stream context.
521+
if draft < 17:
522522
val, s = cursor.read_varint()
523523
annot.add(s, cursor.pos, "request_id", str(val))
524524
val, s = cursor.read_varint()
@@ -545,9 +545,9 @@ def parse_subscribe_ok(cursor, annot, draft, payload_end):
545545

546546

547547
def parse_request_error(cursor, annot, draft, payload_end):
548-
# Draft 18+: request_id is implicit from the bidi request stream context;
548+
# Draft 17+: request_id is implicit from the bidi request stream context;
549549
# the receiver FIFO-correlates errors with outstanding requests.
550-
if draft < 18:
550+
if draft < 17:
551551
val, s = cursor.read_varint()
552552
annot.add(s, cursor.pos, "request_id", str(val))
553553
val, s = cursor.read_varint()
@@ -569,8 +569,8 @@ def parse_publish_namespace(cursor, annot, draft, payload_end):
569569

570570

571571
def parse_request_ok(cursor, annot, draft, payload_end):
572-
# Draft 18+: request_id is implicit (per-stream).
573-
if draft < 18:
572+
# Draft 17+: request_id is implicit (per-stream).
573+
if draft < 17:
574574
val, s = cursor.read_varint()
575575
annot.add(s, cursor.pos, "request_id", str(val))
576576
if draft > 14:
@@ -610,8 +610,10 @@ def parse_unsubscribe(cursor, annot, draft, payload_end):
610610

611611

612612
def parse_publish_done(cursor, annot, draft, payload_end):
613-
val, s = cursor.read_varint()
614-
annot.add(s, cursor.pos, "request_id", str(val))
613+
# Draft 17+: request_id is implicit from the bidi request stream context.
614+
if draft < 17:
615+
val, s = cursor.read_varint()
616+
annot.add(s, cursor.pos, "request_id", str(val))
615617
val, s = cursor.read_varint()
616618
annot.add(s, cursor.pos, "status_code", str(val))
617619
val, s = cursor.read_varint()
@@ -777,8 +779,10 @@ def parse_fetch_cancel(cursor, annot, draft, payload_end):
777779

778780

779781
def parse_fetch_ok(cursor, annot, draft, payload_end):
780-
val, s = cursor.read_varint()
781-
annot.add(s, cursor.pos, "request_id", str(val))
782+
# Draft 17+: request_id is implicit from the bidi request stream context.
783+
if draft < 17:
784+
val, s = cursor.read_varint()
785+
annot.add(s, cursor.pos, "request_id", str(val))
782786

783787
if draft < 15:
784788
val, s = cursor.read_uint8()

0 commit comments

Comments
 (0)