Webs_unix.Fd
File descriptor tools.
type Webs.Http.Body.custom_content +=
| Writer of Unix.file_descr Webs.Http.Body.writer
The type for direct file descriptor body writers.
These writers write their bodies directly on the output file descriptor given to them.
*)read fd b ~start ~len
reads at most len
bytes of fd
into b
starting at start
. Raises Unix.Unix_error
but handles Unix.EINTR
.
write fd b ~start ~len
writes len
byte of b
starting at start
on fd
. Raises Unix.Unix_error
but handles Unix.EINTR
.
val bytes_reader :
max_request_body_byte_size:int ->
content_length:int option ->
Unix.file_descr ->
bytes ->
first_start:int ->
first_len:int ->
Bytesrw.Bytes.Reader.t
bytes_reader fd b ~start ~start_len
is a bytes reader for fd
using buffer b
and assuming the first first_len
bytes are already in b
at first_start
.
val body_writer : Webs.Http.Body.t -> Unix.file_descr Webs.Http.Body.writer
body_writer b
is a body writer for b
writing on a given file descriptors. This supports bodies with the following content:
Webs.Http.Body.content.Empty
Webs.Http.Body.content.Byte_writer
Webs.Http.Body.Byte_reader
Webs.Http.Body.content.Custom
supporting Writer
read_http11_crlfs
reads the status line and headers in bytes
up-to max_bytes
. Returns the list of crlf
locations, the start of the body and how much was read from the body. Raises Failure
and Unix.Unix_error
val write_http11_request : Unix.file_descr -> Webs.Http.Request.t -> unit
write_http_request fd request
writes request
as an an HTTP/1.1 request on fd
. This calls Webs.Http.Headers.for_connector
on the headers and the value of Webs.Http.Request.version
is ignored.