Hcs.Server.Driver
hcs · API reference
Single-loop driver for a sans-I/O http server connection over an Eio flow.
The http connections are driven by one fiber (unlike the old ocaml-h1/h2 split read/write fibers): flush all pending output, then read more, until the connection closes — or, for HTTP/1.1, upgrades, at which point the caller takes over the byte stream for WebSocket. The connection's read/write ops are supplied as closures so this drives both protocol connections.
type wop =
| Writev of Http_core.Iovec.t list
| Yield
| Closeval run :
flow:[> `Flow | `R | `W ] Eio.Flow.sink ->
cbuf:Conn_buffers.t ->
clock:[> float Eio.Time.clock_ty ] Eio.Time.clock ->
idle_timeout:float ->
read_timeout:float ->
write_timeout:float ->
feed:(Http_core.Bigstring.t -> off:int -> len:int -> unit) ->
next:(unit -> wop) ->
report:(int -> 'a) ->
eof:(unit -> 'b) ->
?is_upgraded:(unit -> bool) ->
initial:string ->
unit ->
unit