pub fn parse_range_header(
range: &str,
content_length: u64,
) -> Result<(u64, u64), S3ServiceError>Expand description
Parse an HTTP Range header value and return the inclusive byte range.
Supported formats:
bytes=0-499– first 500 bytesbytes=-500– last 500 bytesbytes=500-– from byte 500 to the endbytes=0-– the entire content
Returns an inclusive (start, end) tuple.
§Errors
Returns S3ServiceError::InvalidRange if the range header is malformed
or specifies an unsatisfiable range.
§Examples
use rustack_s3_core::utils::parse_range_header;
let (start, end) = parse_range_header("bytes=0-499", 1000).unwrap();
assert_eq!((start, end), (0, 499));