fix(player): a suffix range on an empty entry is answered whole (#293)

Merged
AL
2h ago
+9-0

Closes #293.

parseRange('bytes=-5', 0) returned { start: 0, end: -1 }. It now returns 'none', so the empty body is answered whole with 200.

  • Why not 416: RFC 9110 §14.1.2 makes a non-zero suffix the one range an empty representation satisfies, and §14.2 lets a server ignore Range when there is no content. bytes=0- and bytes=-0 on an empty resource stay unsatisfiable.
  • Reach: none in the worker today. serveLocated answers a size-0 entry before any range is parsed. This fixes the function on its own terms.
  • Tests: range.test.ts has the three empty-resource cases; the player's unit tests pass (401).

#292 rewrites this function's doc comment to say a suffix on size 0 gives end: -1. Whichever of the two merges second gets that line corrected to the fixed behaviour before it merges.


Summary by cubic

Fixes parseRange answering a suffix range on an empty resource with { start: 0, end: -1 }. It now returns 'none', so the empty body is answered whole with a 200; bytes=0- and bytes=-0 on an empty resource remain unsatisfiable.