Module Mhttp_serverSource

Sourcetype error

The type of errors.

Sourceval pp_error : error Fmt.t

Pretty-printer of errors.

module Method = H2.Method

Request methods.

module Headers = H2.Headers

Header fields.

Sourcetype stop

Type of switches to stop a HTTP server.

Sourceval stop : unit -> stop

stop () creates a new switch to stop a HTTP server.

Sourceval switch : stop -> unit

switch stop turns off the HTTP server associated to the given stop. It call registered (by the HTTP server) finalizers and terminates. If the given switch is already off, it does nothing.

Sourcetype flow = [
  1. | `Tcp of Mnet.TCP.buffer Mnet.TCP.flow
  2. | `Tls of Mnet_tls.t
]

The type of connection used to communicate with the client.

Sourcetype request = {
  1. meth : Method.t;
  2. target : string;
  3. scheme : string;
  4. headers : Headers.t;
}

A request consisting of a method (see Method), a target (the path requested by the client), a scheme (whether the client used "http" or "https") and a headers.

Sourcetype body = [
  1. | `V1 of H1.Body.Writer.t
  2. | `V2 of H2.Body.Writer.t
]
Sourcetype conn = [
  1. | `H1 of H1.Server_connection.t
  2. | `H2 of H2.Server_connection.t
]
Sourcetype reqd = [
  1. | `V1 of H1.Reqd.t
  2. | `V2 of H2.Reqd.t
]
Sourcetype error_handler = [ `V1 | `V2 ] -> ?request:request -> error -> (Headers.t -> body) -> unit
Sourcetype handler = flow -> conn -> reqd -> unit
Sourceval clear : ?kind:Mnet.TCP.buffer Mnet.TCP.kind -> ?stop:stop -> ?config:H1.Config.t -> ?ready:unit Miou.Computation.t -> ?error_handler:error_handler -> ?upgrade:(Mnet.TCP.buffer Mnet.TCP.flow -> unit) -> handler:handler -> Mnet.TCP.state -> port:int -> unit
Sourceval with_tls : ?stop:stop -> ?config: [ `Both of H1.Config.t * H2.Config.t | `H2 of H2.Config.t | `HTTP_1_1 of H1.Config.t ] -> ?ready:unit Miou_sync.Computation.t -> ?error_handler:error_handler -> Tls.Config.server -> ?upgrade:(Mnet_tls.t -> unit) -> handler:handler -> Mnet.TCP.state -> port:int -> unit
Sourceval peer : secure:bool -> (Ipaddr.t * int) Logs.Tag.def