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 mostlen
bytes offd
intob
starting atstart
.
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 forfd
that using bufferb
and assuming the firstfirst_len
bytes are already inb
atfirst_start
.
Writing responses
val write : Unix.file_descr -> bytes -> start:int -> len:int -> unit
write fd b ~start ~len
writeslen
byte ofb
starting atstart
onfd
. RaisesUnix.Unix_error
but handlesUnix.EINTR
.
val resp_body_writer : Webs.Resp.t -> Webs.Resp.t * (Unix.file_descr -> unit)
resp_body_writer r
is a body writer forr
along with an upated responser
in case the response is a file.