Module Webs_unix.Connector

Tools for writing connectors.

Reading requests

val read : Unix.file_descr -> bytes -> start:int -> len:int -> int

read fd b ~start ~len reads at most len bytes of fd into b starting at start.

val req_body_reader : max_req_body_byte_size:int -> body_length:int option -> Unix.file_descr -> bytes -> first_start:int -> first_len:int -> unit -> (bytes * int * int) option

resp_body_reader fd b ~start ~start_len is a body reader for fd that using buffer b and assuming the first first_len bytes are already in b at first_start.

Writing responses

val write : Unix.file_descr -> bytes -> start:int -> len:int -> unit

write fd b ~start ~len writes len byte of b starting at start on fd. Raises Unix.Unix_error but handles Unix.EINTR.

val resp_body_writer : Webs.Http.resp -> Webs.Http.resp * (Unix.file_descr -> unit)

resp_body_writer r is a body writer for r along with an upated response r in case the response is a file.