package httpaf_caged

  1. Overview
  2. Docs

Module Httpaf_caged.Server_connection

type t
type error = [
  1. | `Bad_gateway
  2. | `Bad_request
  3. | `Exn of exn
  4. | `Internal_server_error
]
type request_handler = Reqd.t -> unit
type error_handler = ?request:Request.t -> error -> (Headers.t -> [ `write ] Httpaf.Body.t) -> unit
val create : ?config:Config.t -> ?error_handler:error_handler -> request_handler -> t
val next_read_operation : t -> [ `Close | `Read | `Yield ]
val read : t -> Bigstringaf.t -> off:int -> len:int -> int
val read_eof : t -> Bigstringaf.t -> off:int -> len:int -> int
val yield_reader : t -> (unit -> unit) -> unit
val next_write_operation : t -> [ `Close of int | `Write of Bigstringaf.t IOVec.t list | `Yield ]
val report_write_result : t -> [ `Closed | `Ok of int ] -> unit
val yield_writer : t -> (unit -> unit) -> unit
val report_exn : t -> exn -> unit
val is_closed : t -> bool
val error_code : t -> error option
val shutdown : t -> unit