2026-09-17 · 8 min read
- http
- range-requests
- reliability
HTTP range requests allow a client to ask for part of a selected representation. Download managers use them to resume interrupted transfers, media players use them to seek, and caches can use them to store partial responses.
The mechanism is byte-oriented. Character positions, decoded media frames, and offsets in an uncompressed source are not interchangeable with byte positions in the representation the server selected for the request.
Define interval arithmetic precisely
A bytes range has an inclusive first and last position. bytes=0-99 therefore requests 100 bytes. Open-ended ranges request from one position to the end, while suffix ranges request a number of bytes from the end.
- Return 206 for a satisfiable partial response.
- Set Content-Range to the exact returned interval and complete length.
- Set Content-Length to the size of the response body, not the full file.
- Return 416 with an unsatisfied Content-Range when no interval applies.
Bind resumed bytes to one representation
A client must not append new bytes to an old partial file after the resource changes. Store a strong ETag or another protocol-appropriate validator alongside the partial data and send it with If-Range on resume.
When the validator no longer matches, the server can return 200 with the complete current representation. The client must replace its partial state instead of treating that body as the requested slice.
Account for content encoding and caches
Range semantics apply to the selected representation. Content negotiation and compression can produce different byte sequences for the same underlying resource, so caches and clients need validators and Vary behavior that distinguish those variants.
Multiple ranges use a multipart response with its own boundaries and per-part Content-Range fields. If the product does not need multi-range support, reject or coalesce it according to a documented limit rather than building an unbounded response.
Test interruption and reconstruction
Use Flashman's URL tool for request targets, units converter for interval calculations, hash tool for end-to-end fixture integrity, diff for headers, and timestamp converter for retry timelines.
Test one-byte resources, the first and last byte, adjacent parallel ranges, suffix and open-ended syntax, invalid and excessive ranges, zero-length resources, validator changes, compression, redirects, cache hits, interrupted retries, and origins that ignore Range.