Skip to main content

parse_http_byte_range

Function parse_http_byte_range 

Source
pub fn parse_http_byte_range(
    value: &str,
    resource_length: u64,
) -> Result<ByteRange, HttpRangeParseError>
Expand description

Parses a reconstruction Range header into an inclusive byte range.

The Xet reconstruction API uses bytes=<start>-<end> syntax with an inclusive end. When the requested end exceeds the resource length, the returned range is clamped to the last byte of the resource.

ยงErrors

Returns HttpRangeParseError::InvalidSyntax when the header uses unsupported syntax, HttpRangeParseError::InvalidNumber when parsing fails, and HttpRangeParseError::Unsatisfiable when the requested start exceeds the last byte of the resource.