Documentation
¶
Overview ¶
Package httprange provides a utility function for parsing HTTP Range headers.
The function supports requests for a single range of bytes, which is the most common use case for range requests. It returns the start and end positions of the requested range, along with the corresponding Content-Range and Content-Length strings for use in an HTTP 206 Partial Content response.
The current implementation does not fully comply with RFC 7233 in the following ways:
The function assumes that the unit is always 'bytes'. According to RFC 7233, a range unit identifier can be bytes or any token registered in the HTTP Range Unit Registry. However, 'bytes' is the only range unit identifier defined by HTTP/1.1, and it's the most commonly used in practice.
The function only supports a single range. RFC 7233 allows a client to request multiple ranges in a single request, but this is not often used in practice and can increase the complexity of the server's response.
These limitations are deemed acceptable for the typical use cases this function is designed for, and they significantly simplify the implementation. However, if full compliance with RFC 7233 is required, this function should not be used.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalid = errors.New("invalid range header format")
Functions ¶
This section is empty.