mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 19:36:04 +00:00
Delivers the range-request semantics the original PR body promised but the diff did not implement. Without range support, Chrome's <video> element issues full-file GETs on seek; with this commit it can issue `Range: bytes=...` and get a sliced 206 back, so seek + partial-load work without re-pulling the whole file. - Add `parseRangeHeader` (exported for unit tests) covering the three RFC 7233 single-range forms: bytes=START-END (closed), bytes=START- (open-ended), bytes=-SUFFIX (last N bytes). Multi-range falls back to `absent` (full 200) so we never reassemble multipart/byteranges. - Binary path now returns 206 Partial Content with Content-Range + sliced Content-Length on satisfiable ranges, 416 Range Not Satisfiable with `Content-Range: bytes (asterisk)/<size>` on unsatisfiable ranges, and 200 with `Accept-Ranges: bytes` on full-body GETs so clients know ranges are supported. - Add unit tests for parseRangeHeader (10 cases: 3 forms, clamping, unsatisfiable edges, malformed inputs, multi-range fallback). - Add integration test covering 200 + Accept-Ranges, all 3 range forms with byte-correct slices, 416 on out-of-bounds, and multi-range -> 200 fallback. Addresses Miga's review finding on #1735. Co-Authored-By: Jerrai <noreply@anthropic.com> — Jerrai