Skip to main content

Module http

Module http 

Source
Expand description

A minimal synchronous HTTP/1.1 server: one request per connection, a thread per connection, a hard cap on connections, and every read and write bounded.

It serves a JSON API to a tunnel and a local CLI, nothing else, so it speaks just enough HTTP for that: Content-Length bodies only, Connection: close on every response. Anything it does not understand is refused with a status rather than guessed at.

Structs§

HttpServer
Owns the connection cap and the shutdown flag shared by every listener.
Limits
Bounds on what one connection may cost.
Request
Response
Shutdown
A flag every accept loop polls. Cloning shares it.
UnixSocket
A unix listener that removes its socket file on drop, but only while the file is still the one it bound, so a successor’s socket is never deleted.

Enums§

HttpListener
A bound listening socket.
Peer
Who is on the other end of a connection.

Traits§

Duplex
A connection a handler takes over after 101 Switching Protocols (a websocket): both directions, and a read deadline it can shorten to poll.

Type Aliases§

Handler
StreamFn
Writes a streamed body (server-sent events) until it returns; the connection closes after it, which is what delimits the body.
TlsConfig
A TLS server config that can be swapped while serving (certificate rotation); each connection takes the one current when it arrives.
UpgradeFn
Runs on the connection after a 101; the connection closes when it returns.