← Lessons

quiz vs the machine

Platinum1720

Networking

Range Requests and Resumable Downloads

How a client fetches part of a file to resume or seek without restarting.

5 min read · advanced · beat Platinum to climb

Asking for a slice

A range request lets a client ask for only part of a resource using the Range header, for example bytes from one offset to another. The server replies with status 206 Partial Content and a Content Range header describing which bytes it sent.

Advertising and validating

  • The server signals support with Accept Ranges bytes; otherwise the client must download the whole file.
  • A resumed download should include an If Range validator using an ETag or last modified date, so the server can confirm the file has not changed since the first part was fetched.
  • If the file changed, the server returns the full body instead to avoid stitching mismatched bytes.

Where it shines

Range requests power resumable downloads after a dropped connection, video seeking where the player jumps to a timestamp, and parallel downloads that fetch several ranges at once. Without them a single network blip would force a restart from byte zero.

A request for a range beyond the file size returns 416 Range Not Satisfiable.

Key idea

Range requests fetch byte slices with status 206 and a Content Range header, enabling resumable downloads, seeking, and parallel fetches when the server advertises Accept Ranges.

Check yourself

Answer to earn rating on the learn ladder.

1. Which status code indicates a partial response to a range request?

2. Why include an If Range validator when resuming a download?

3. How does a server advertise that it supports byte ranges?