Webs_http11.RequestRequest codec.
val decode_line :
bytes ->
first:int ->
last:int ->
Webs.Http.Method.t * string * Webs.Http.Version.tdecode_line b ~first ~last decodes a request 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 ->
service_path:Webs.Http.Path.t ->
Bytesrw.Bytes.Reader.t ->
(Webs.Http.Request.t, Webs.Http.Response.t) Stdlib.resultread r reads an HTTP/1.1 request from r. The body of the request is an Http.Body.Bytes_reader on r.
log is used as the Webs.Http.Request.loghead_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 result is devised with Http.for_service_connector with the given service_path and thus satisfies the service requests conventions.
The function errors if the message header cannot fit in header_buffer or if a decoding error occurs.
val encode_head : Webs.Http.Request.t -> stringencode_head request is the HTTP/1.1 message head of request: the request line, the crlf-terminated headers and the final crlf. The written headers go through Http.Headers.for_connector with the body request.
val encode : Webs.Http.Request.t -> stringencode request encodes request to an HTTP/1.1 request with encode_head followed by the request body.
Raises Invalid_argument on Webs.Http.Body.content.Custom bodies.
val write_head : Bytesrw.Bytes.Writer.t -> Webs.Http.Request.t -> unitwrite_head w request writes encode_head of request on w.
val write : eod:bool -> Bytesrw.Bytes.Writer.t -> Webs.Http.Request.t -> unitwrite ~eod w request writes request as an HTTP/1.1 request on w with write_head, followed by the request body, and a final Bytes.Slice.eod iff eod is true.
Raises Invalid_argument on Webs.Http.Body.content.Custom bodies.