Module Http.Range

Range requests.

References.

Byte ranges

type bytes = [
| `First of int(*

First given offset to last offset

*)
| `Last of int(*

At most last given n bytes.

*)
| `Range of int * int(*

First offset and last offset.

*)
]

The type for byte range specifications. Offsets are zero-based.

val eval_bytes : len:int -> bytes -> (int * int) option

eval_bytes ~len b given a representation length len and byte range b returns a concrete zero-based byte range or None if the range cannot be satisfied for len.

Ranges

type t = [
| `Bytes of bytes list(*

Byte ranges.

*)
| `Other of string * string(*

Range unit and value.

*)
]

The type for ranges.

val decode : string -> (t, string) Stdlib.result

decode s decodes a range header value.

val encode : t -> string

encode r serializes ranges r in unit u. It's the client duty to make sure ranges are valid.