package shuttle_http

  1. Overview
  2. Docs
type t
val sexp_of_t : t -> Sexplib0.Sexp.t
val default : t
val create : ?buf_len:int -> ?max_connections:int -> ?max_accepts_per_batch:int -> ?backlog:int -> ?write_timeout:Core.Time_ns.Span.t -> ?read_header_timeout:Core.Time_ns.Span.t -> ?error_handler:error_handler -> unit -> t

HTTP Server configuration

  • buf_len is the buffer size used for the underlying tcp socket channel. The default value is 16_000 bytes.
  • max_connections is the maximum number of concurrent connections that can be active within a server. The default behavior is to have no upper bound on this number.
  • max_accepts_per_batch is the maximum number of socket connections that a server will attempt to accept in a single accept call. The default value is 1.
  • backlog is the number of clients that can have a pending connection. Additional connections can be rejected, enqueued or ignored based on the underlying operating system's behavior.
  • write_timeout is the maximum duration that the underlying socket will wait for any pending write syscalls to finish.
  • read_header_timeout is the maximum time span that the server loop is allowed to read a request's headers. The default value is 60 seconds. If read_header_timeout is zero then no timeout is used, and the server could potentially wait forever attempting to read enough data to parse request headers.
  • error_handler allows customizing how unhandled exceptions, and any potential parsing or i/o errors get rendered. The default implementation will attempt to send an HTTP response with a status code and an empty body.
OCaml

Innovation. Community. Security.