Documentation

Std.Http.Server.Config

Config #

This module exposes the Config, a structure that describes timeout, request and headers configuration of an HTTP Server.

Connection limits configuration with validation.

  • maxConnections : Nat

    Maximum number of simultaneous active connections (default: 1024). Setting this to 0 disables the limit entirely: the server will accept any number of concurrent connections and no semaphore-based cap is enforced. Use with care — an unconstrained server may exhaust file descriptors or memory under adversarial load.

  • maxRequests : Nat

    Maximum number of requests per connection.

  • maxHeaders : Nat

    Maximum number of headers allowed per request.

  • maxHeaderBytes : Nat

    Maximum aggregate byte size of all header field lines in a single message (name + value bytes plus 4 bytes per line for : and \r\n). Default: 64 KiB.

  • lingeringTimeout : Time.Millisecond.Offset

    Timeout (in milliseconds) for receiving additional data while a request is actively being processed (e.g. reading the request body). Applies after the request headers have been parsed and replaces the keep-alive timeout for the duration of the request.

  • keepAliveTimeout : { x : Time.Millisecond.Offset // x > 0 }

    Timeout for keep-alive connections

  • headerTimeout : Time.Millisecond.Offset

    Maximum time (in milliseconds) allowed to receive the complete request headers after the first byte of a new request arrives. This prevents Slowloris-style attacks where a client sends bytes at a slow rate to hold a connection slot open without completing a request. Once a request starts, each individual read must complete within this window. Default: 5 seconds.

  • enableKeepAlive : Bool

    Whether to enable keep-alive connections by default.

  • maximumRecvSize : Nat

    The maximum size that the connection can receive in a single recv call.

  • defaultPayloadBytes : Nat

    Default buffer size for the connection

  • generateDate : Bool

    Whether to automatically generate the Date header in responses.

  • serverName : Option Header.Value

    The Server header value injected into outgoing responses. none suppresses the header entirely.

  • maxUriLength : Nat

    Maximum length of request URI (default: 8192 bytes)

  • maxStartLineLength : Nat

    Maximum number of bytes consumed while parsing request start-lines (default: 8192 bytes).

  • maxHeaderNameLength : Nat

    Maximum length of header field name (default: 256 bytes)

  • maxHeaderValueLength : Nat

    Maximum length of header field value (default: 8192 bytes)

  • maxSpaceSequence : Nat

    Maximum number of spaces in delimiter sequences (default: 16)

  • maxLeadingEmptyLines : Nat

    Maximum number of leading empty lines (bare CRLF) to skip before a request-line (RFC 9112 §2.2 robustness). Default: 8.

  • maxChunkExtNameLength : Nat

    Maximum length of chunk extension name (default: 256 bytes)

  • maxChunkExtValueLength : Nat

    Maximum length of chunk extension value (default: 256 bytes)

  • maxChunkLineLength : Nat

    Maximum number of bytes consumed while parsing one chunk-size line with extensions (default: 8192 bytes).

  • maxChunkSize : Nat

    Maximum allowed chunk payload size in bytes (default: 8 MiB).

  • maxBodySize : Nat

    Maximum allowed total body size per request in bytes (default: 64 MiB).

  • maxReasonPhraseLength : Nat

    Maximum length of reason phrase (default: 512 bytes)

  • maxTrailerHeaders : Nat

    Maximum number of trailer headers (default: 20)

  • maxChunkExtensions : Nat

    Maximum number of extensions on a single chunk-size line (default: 16).

Instances For

    Converts to HTTP/1.1 config.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For