Module Http.Private

Private codecs (unstable).

Warning. This API is unstable. It may change between minor versions of the library. Use at your own risk.

val trim_ows : string -> string

trim_ows trims starting and ending HTTP ows.

val decode_request_line : bytes -> first:int -> crlf:int -> Method.t * string * Version.t

decode_request_line b ~first ~crlf decodes a request line that starts at first and whose ending CRLF starts at crlf. Raises Failure on errors.

val decode_status_line : bytes -> first:int -> crlf:int -> Version.t * Status.t * string

decode_status_line b ~first ~crlf decodes a status line that starts at first and whose ending CRLF starts at crlf. Raises Failure on errors.

val decode_header_field : bytes -> first:int -> crlf:int -> Headers.Name.t * string

decode_header_field b ~first ~crlf decodes a header field that starts at first and whose ending CRLF starts at crlf. Raises Failure on errors.

val decode_headers : bytes -> crlfs:int list -> Headers.t

decode_headers b crlfs decodes the headers. b has the header section with the start line (either request or status line) or finished by the first crlfs.

val encode_http11_response_head : Status.t -> reason:string -> Headers.t -> string

encode_http11_response_head is the HTTP/1.1 head for a response with the given parameters. This has the final double CRLF.

val encode_http11_request_head : Method.t -> request_target:string -> Headers.t -> string

encode_http11_request_head is the HTTP/1.1 head for a request with the given paramters. This has the final double CRLF.