Skip to content

ServerConfig

[Source]

Server-level configuration.

Host and port specify the listen address. Parser limits control the maximum size of request components. Idle timeout controls how long a keep-alive connection can sit without activity before being closed. max_requests_per_connection limits how many requests a single keep-alive connection can serve before the server closes it (analogous to nginx's keepalive_requests). None means unlimited. Use MakeMaxRequestsPerConnection to create validated limit values (must be at least 1).

// All defaults (60-second idle timeout, unlimited requests)
ServerConfig("localhost", "8080")

// Custom timeout via MakeIdleTimeout (milliseconds)
let timeout = match lori.MakeIdleTimeout(30_000)
| let t: lori.IdleTimeout => t
end
ServerConfig("0.0.0.0", "80" where
  max_body_size' = 10_485_760,  // 10 MB
  idle_timeout' = timeout)

// Disable idle timeout
ServerConfig("0.0.0.0", "80" where idle_timeout' = None)

// Limit to 1000 requests per connection
match MakeMaxRequestsPerConnection(1000)
| let m: MaxRequestsPerConnection =>
  ServerConfig("0.0.0.0", "80" where max_requests_per_connection' = m)
end
class val ServerConfig

Constructors

create

[Source]

Create server configuration.

host' and port' specify the listen address. Parser limits default to sensible values. idle_timeout' is an IdleTimeout (milliseconds) or None to disable idle timeout. Defaults to 60 seconds. Use lori.MakeIdleTimeout(ms) to create custom timeout values. max_pending_responses' limits the number of pipelined requests that can be outstanding before the connection closes — this prevents unbounded memory growth from actors that never respond. max_requests_per_connection' limits how many requests a single keep-alive connection can serve before the server closes it. None (the default) means unlimited. Use MakeMaxRequestsPerConnection to create validated limit values (must be at least 1).

new val create(
  host': String val,
  port': String val,
  max_request_line_size': USize val = 8192,
  max_header_size': USize val = 8192,
  max_chunk_header_size': USize val = 128,
  max_body_size': USize val = 1048576,
  max_pending_responses': USize val = 100,
  idle_timeout': (Constrained[U64 val, IdleTimeoutValidator val] val | None val) = call,
  max_requests_per_connection': (Constrained[USize val, _MaxRequestsPerConnectionValidator val] val | None val) = reference)
: ServerConfig val^

Parameters

Returns


Public fields

let host: String val

[Source]


let port: String val

[Source]


let max_request_line_size: USize val

[Source]


let max_header_size: USize val

[Source]


let max_chunk_header_size: USize val

[Source]


let max_body_size: USize val

[Source]


let max_pending_responses: USize val

[Source]


let idle_timeout: (Constrained[U64 val, IdleTimeoutValidator val] val | None val)

[Source]


let max_requests_per_connection: (Constrained[USize val, _MaxRequestsPerConnectionValidator val] val | None val)

[Source]