Page
Library
Module
Module type
Parameter
Class
Class type
Source
Mehari_mirage.MakeSourceA functor building an IO module from Mirage components.
module Stack : Tcpip.Stack.V4V6module Time : Mirage_time.Sinclude Mehari.NET
  with module IO := IO
   and type addr = Ipaddr.t
   and type clock := unitHandlers are asynchronous functions from Mehari.request to Mehari.response.
Rate limiter. See Rate limit.
Middlewares take a handler, and run some code before or after — producing a “bigger” handler. See Middleware.
Does nothing but call its inner handler. Useful for disabling middleware conditionally during application startup:
if development then
  my_middleware
else
  Mehari.no_middlewareCombines a list of middlewares into one, such that these two lines are equivalent: Mehari.pipeline [ mw1 ; mw2 ] @@ handler  mw1 @@ mw2 @@ handler.
Creates a router. If none of the routes match the Mehari.request, the router returns Mehari.not_found.
val route : 
  ?rate_limit:rate_limiter ->
  ?mw:middleware ->
  ?regex:bool ->
  string ->
  handler ->
  routeroute ~rate_limit ~mw ~regex path handler forwards requests for path to handler. path can be a string literal or a regex in Perl style depending of value of regex. If rate limit is in effect, handler is not executed and a respond with Mehari.status Mehari.slow_down is sended.
scope ~rate_limit ~mw prefix routes groups routes under the path prefix, rate_limit and mw.
A dummy value of type route that is completely ignored by the router. Useful for disabling routes conditionally during application start.
virtual_hosts ?meth [(domain, handler); ...] produces a handler which enables virtual hosting at the TLS-layer using SNI.
meth can be used to choose which source to match the hostnames against. Defaults to `SNI.Set Mehari's logger to the given log level.
val make_rate_limit : 
  ?period:int ->
  int ->
  [ `Second | `Minute | `Hour | `Day ] ->
  rate_limiterSame as Mehari.NET.make_rate_limit but without the required trailing unit parameter.
Same as Mehari.NET.logger but without the required trailing unit parameter.
Same as Mehari.response, but the new Mehari.response is wrapped in a promise.
Same as respond but respond with given Mehari.body and use given Mehari.mime as mime type.
Same as respond but respond with given text and use text/plain as Mehari.mime type.
val respond_gemtext : 
  ?charset:string ->
  ?lang:string list ->
  Mehari.Gemtext.t ->
  Mehari.response IO.tSame as respond but respond with given Mehari.Gemtext.t and use text/gemini as Mehari.mime type.
val respond_raw : 
  [ `Body of string | `Full of int * string * string ] ->
  Mehari.response IO.tSame as Mehari.response_raw, but the new Mehari.response is wrapped in a promise.
val run : 
  ?port:int ->
  ?verify_url_host:bool ->
  ?config:Tls.Config.server ->
  ?timeout:float ->
  certchains:Tls.Config.certchain list ->
  stack ->
  handler ->
  unit IO.trun ?port ?verify_url_host  ?config ?timeout ?certchains stack handler runs the server using host.
port is the port to listen on. Defaults to 1965.verify_url_host, if true (by default), will verify if the URL hostname corresponds to the server's certificate (chosen according to ocaml-tls sni.md).config is the TLS server configuration. Defaults to
  Tls.Config.server ~certificates
      ~authenticator:(fun ?ip:_ ~host:_ _ -> Ok None)
      ()To support client certificates, specify the authenticator.
timeout is the maximum waiting time in seconds for the client to write a request after TLS handshake. Unset by default.certchains is the list of form [(certs, key); ...], the last one is considered default.