Webs_http11.ResponseResponse codec.
val decode_status_line :
bytes ->
first:int ->
last:int ->
Webs.Http.Version.t * Webs.Http.Status.t * stringdecode_status_line b ~first ~crlf decodes a status line that starts at first and whose ending CRLF starts at last+1. Raises Failure on errors.
TODO Do not expose this.
val read :
?head_buffer:bytes ->
?log:string ->
Bytesrw.Bytes.Reader.t ->
(Webs.Http.Response.t, string) Stdlib.resultread r reads an HTTP/1.1 response from r. The body of the response is an Webs.Http.Body.content.Bytes_reader on r.
log is used as the Webs.Http.Response.log.head_buffer is the temporary buffer used to store the HTTP head. Defaults to a fresh fresh buffer of size Webs.Http.Connector.Default.max_http_head_byte_size.The function errors if the message head cannot fit in head_buffer or if a decoding error occurs.
val encode_head : Webs.Http.Response.t -> stringencode_head response is the HTTP/1.1 message head of reponse: the status line, the crlf-terminated headers and the final crlf. The written headers go through Webs.Http.Headers.for_connector with the body of response.
val encode : Webs.Http.Response.t -> stringencode response encodes response to an HTTP/1.1 response with encode_head followed by the response body.
Raises Invalid_argument on Webs.Http.Body.content.Custom bodies.
val write_head : Bytesrw.Bytes.Writer.t -> Webs.Http.Response.t -> unitwrite_head w response writes the encode_head of response on w.
val write : eod:bool -> Bytesrw.Bytes.Writer.t -> Webs.Http.Response.t -> unitwrite ~eod w response writes response as an HTTP/1.1 response on w with write_head, followed by the response body and a final Bytes.Slice.eod iff eod is true.
Raises Invalid_argument on Webs.Http.Body.content.Custom bodies.