Connection module handles a single, possibly pipelined, http connection.
create ?finalise ?persistent ?ctx endp connects to
endp. The connection handle may be used immediately, although the connection may not yet be established.
val connect : ?finalise:(t -> unit Net.IO.t) -> ?persistent:bool -> ?ctx:Net.ctx -> Net.endp -> t Net.IO.t
create, but returns d promise which gets fulfilled when the connection is established or rejected when connecting fails.
val shutdown : t -> unit
Send EOF. On TCP connections send a FIN packet. On TLS connections send a close notify. No new requests can be sent afterwards, but responses may still be received.
val close : t -> unit
Immediately close connection. All outstanding requests will fail, but non-idempotent requests that already went out on the wire may have produced side-effects.
val is_closed : t -> bool
is_closed connection is
connection still accepts new requests.
val length : t -> int
Number of unfulfilled requests. This includes requests already sent out and requests still waitung to be sent.