An OCaml webserver, but the allocating version (vs httpz which doesnt)
at main 31 lines 1.1 kB view raw
1(** Low-level buffer writing primitives for HTTP response generation. *) 2 3(** {1 Basic Writers} *) 4 5(** Write a single character. Returns [off + 1]. *) 6val char : Base_bigstring.t -> off:int -> char -> int 7 8(** Write a string. Returns [off + String.length s]. *) 9val string : Base_bigstring.t -> off:int -> string -> int 10 11(** Write CRLF ([\r\n]). Returns [off + 2]. *) 12val crlf : Base_bigstring.t -> off:int -> int 13 14(** {1 Integer Writers} *) 15 16(** Write a non-negative integer in decimal. Returns new offset. *) 17val int : Base_bigstring.t -> off:int -> int -> int 18 19(** Write an int64 in decimal. Returns new offset. *) 20val int64 : Base_bigstring.t -> off:int -> int64 -> int 21 22(** Write a non-negative integer in lowercase hexadecimal. Returns new offset. *) 23val hex : Base_bigstring.t -> off:int -> int -> int 24 25(** {1 Fixed-Width Writers} *) 26 27(** Write a 2-digit decimal number (zero-padded). Returns [off + 2]. *) 28val digit2 : Base_bigstring.t -> off:int -> int -> int 29 30(** Write a 4-digit decimal number (zero-padded). Returns [off + 4]. *) 31val digit4 : Base_bigstring.t -> off:int -> int -> int