Http module

Server_Config

structSource

What an App does when nothing else is said. Every number is a limit or a timeout in milliseconds unless it says otherwise; 0 turns the ones that allow it off.

Fields

address: := ":8080"
Where to listen: ":8080", "127.0.0.1:3000", "[::1]:8080". Port 0 picks a free one.
threads: := 0
Schedulers (OS threads), each with its own listener. 0 (or less) is one per processor.
header_timeout: := 10_000
How long a client may take to send the request head, from its first byte; also the limit for the TLS handshake of an https connection. Over it: 408.
body_timeout: := 30_000
How long a client may stay silent while sending a request body. Over it: 408.
idle_timeout: := 60_000
How long a keep-alive connection may wait for its next request before it is closed. With no limit it waits until the client sends something or hangs up (stop still closes it).
write_timeout: := 30_000
How long one write of a response may take; a slower client is disconnected.
shutdown_timeout: := 10_000
How long stop waits for requests in progress before it cuts connections off. Here 0 or less does not mean no limit: the wait is over at once and connections are cut without waiting, so there is no way to wait forever.
max_body_size: := 1024 * 1024
Request limits. A request over one is refused with 413, 414 or 431 and the connection closes.
max_head_size: := 64 * 1024
max_headers: := 100
max_line_size: := 8 * 1024
max_requests_per_connection: := 10_000
Requests served on one connection before it is closed (0 or less: no limit).
read_buffer_size: := 16 * 1024
Bytes read from a socket at a time (one buffer per connection).
server_name: := "jaic"
The Server header; empty sends none.
log_requests: := false
Print one line per request to standard output: method, target, status and time.
handle_signals: := true
Stop on SIGINT and SIGTERM (Ctrl-C): see serve.
tls: *Tls.Tls_Config
Serve HTTPS: every accepted connection does a TLS handshake first (within header_timeout). A Tls_Config that went through Tls.tls_config_init, with a certificate chain and private key, that outlives the server; its alpn should be empty or .["http/1.1"]. Null: plain HTTP.

See also