An OCaml webserver, but the allocating version (vs httpz which doesnt)
1(** Span into the buffer. *)
2
3(** Span type - offset and length into buffer. *)
4type t =
5 { off : int
6 ; len : int
7 }
8
9(** Create a span from offset and length. *)
10val make : off:int -> len:int -> t
11
12(** Get offset. *)
13val off : t -> int
14
15(** Get length. *)
16val len : t -> int
17
18(** Case-sensitive comparison with string. *)
19val equal : Base_bigstring.t -> t -> string -> bool
20
21(** Case-insensitive comparison with string. *)
22val equal_caseless : Base_bigstring.t -> t -> string -> bool
23
24(** Parse decimal integer from span. Returns [-1L] on error.
25 Note: This does NOT check for overflow. Use [parse_int64_limited] for security. *)
26val parse_int64 : Base_bigstring.t -> t -> int64
27
28(** Parse decimal integer from span with overflow protection and maximum value limit.
29 Returns (value, overflow_flag)
30 - value: parsed value or [-1L] if empty/invalid
31 - overflow_flag: [true] if value exceeds [max_value] or has too many digits *)
32val parse_int64_limited : Base_bigstring.t -> t -> max_value:int64 -> int64 * bool
33
34(** Copy span to string. Allocates. *)
35val to_string : Base_bigstring.t -> t -> string
36
37(** Copy span to bytes. Allocates. *)
38val to_bytes : Base_bigstring.t -> t -> bytes
39
40(** Pretty-print span contents using buffer. *)
41val pp_with_buf : Base_bigstring.t -> Stdlib.Format.formatter -> t -> unit
42
43(** Pretty-print span structure (offset and length). *)
44val pp : Stdlib.Format.formatter -> t -> unit