subscribe

206 Partial Content

206 Partial Content is used for range requests. It’s possible for a HTTP client to request only portions of a resource using range requests.

Examples of this might include a large log resource for which a client only wants the last n bytes. Or maybe a video and the client doesn’t want to buffer more data than needed, or maybe a user is seeking through the video by fast-forwarding.

If a client issued a range request, and the server is able to handle this feature, it can indicate to the client that it’s sending back only certain ranges with the 206 Partial Content status, and Content-Range headers.

The following request asks the server for a portion of a video:

GET /video.mp4 HTTP/1.1
Range: bytes=1048576-2097152

A server supporting this could respond as follows:

HTTP/1.1 206 Partial Content
Content-Range: bytes 1048576-2097152/3145728
Content-Type: video/mp4

...

If a server doesn’t support Range requests, it will just return a 200 OK and send back the entire video. A client will know that the server didn’t support it via this status code and the omission of the Content-Range header.

References

  • RFC7233 - (HTTP/1.1): Range Requests

HTTP series

This article is part of a series about the HTTP protocol. Read them all here:

Informational 1xx

Successful 2xx

Redirection 3xx

Client Error 4xx

Server Error 5xx

Web mentions