Downloading a multi-gigabyte ISO, dataset, or build artifact over an unstable connection often fails for a simple reason: a single TCP stream has no built-in way to resume at the application layer if the socket resets.
Instead of restarting from 0%, HTTP/1.1 and HTTP/2 support byte-range requests, which turn a monolithic transfer into resumable, parallelizable chunks.
1. Checking Server Support with Accept-Ranges
When a client sends a HEAD or initial GET request, the server advertises byte-range support via:
Accept-Ranges: bytes Content-Length: 4294967296 If Accept-Ranges: bytes is present, the client knows it can request arbitrary slices of the file instead of reading from byte 0 in one shot.
2. Fetching and Resuming Slices with Range and Content-Range
To request a specific slice (or resume from where a connection dropped), the client sends a Range header:
GET /releases/archive.iso HTTP/1.1 Range: bytes=1048576-2097151 A compliant server responds with 206 Partial Content and a Content-Range header confirming the exact byte offsets returned:
HTTP/1.1 206 Partial Content Content-Range: bytes 1048576-2097151/4294967296 Content-Length: 1048576 With parallel byte-range chunking, a client splits the file into multiple non-overlapping ranges and fetches them concurrently. If one connection stalls or hits per-stream server throttling, only that chunk needs to be retried—while other connections keep making progress.
3. Preventing File Corruption with If-Range (ETag / Last-Modified)
Resuming a partial download has a subtle hazard: what if the file on the server was updated between the time the download paused and resumed? Mixing old bytes from v1 with new bytes from v2 silently corrupts the file.
HTTP solves this with conditional range requests using If-Range, paired with either a strong ETag or Last-Modified timestamp:
GET /releases/archive.iso HTTP/1.1 Range: bytes=1048576- If-Range: "65a1b2c3-100000000" - If the
ETagstill matches, the server returns206 Partial Contentwith the requested bytes. - If the file changed, the server ignores the
Rangeheader and returns200 OKwith the full updated file, preventing silent corruption.
Takeaway
Combining Accept-Ranges: bytes, Range / 206 Partial Content chunking, and If-Range validation gives you resilient, resumable transfers even on flaky Wi-Fi or Windows/desktop environments where network interfaces frequently sleep or switch.
