Skip to main content

Module http_server

Module http_server 

Source
Expand description

HTTP-over-TCP transport for the same NDJSON frame shapes the Unix socket crate::server speaks.

Plaintext HTTP/1.1 only — TLS termination is the operator’s concern.

Wire shape:

  • request: POST / with a JSON body matching Request; any other method or path returns 405 / 404.
  • one-shot reply: 200 OK + Content-Type: application/json + a single Response body.
  • streaming reply: 200 OK + Content-Type: application/x-ndjson + one JSON Response frame per chunk, terminated by an End frame. The client cancels by closing the TCP connection.

Auth: Authorization: Bearer <token>, constant-time compared against the configured token via the subtle crate. Boot validation (e.g. “anonymous access only on loopback”) lives in the caller.

Structs§

HttpServerConfig

Enums§

HttpServerError

Functions§

spawn_http_server
Spawn one accept loop per bind address. Returns the spawned task handles; each task runs until cancel fires or the listener errors fatally.