package httpun

  1. Overview
  2. Docs
type t
val schedule_read : t -> on_eof:(unit -> unit) -> on_read:(Bigstringaf.t -> off:int -> len:int -> unit) -> unit

schedule_read t ~on_eof ~on_read will setup on_read and on_eof as callbacks for when bytes are available in t for the application to consume, or when the input channel has been closed and no further bytes will be received by the application.

Once either of these callbacks have been called, they become inactive. The application is responsible for scheduling subsequent reads, either within the on_read callback or by some other mechanism.

val close : t -> unit

close t closes t, indicating that any subsequent input received should be discarded.

val is_closed : t -> bool

is_closed t is true if close has been called on t and false otherwise. A closed t may still have bytes available for reading.

OCaml

Innovation. Community. Security.