Skip to content

ClientConnectionConfig

[Source]

Configuration for an HTTP client connection.

Parser limits control the maximum size of response components. Idle timeout controls how long the connection can sit without I/O activity before the library closes it. Connection timeout bounds how long the initial connection handshake is allowed to take. Read buffer size bounds how much data the connection reads per scheduler turn. from specifies the local bind address (empty string means any interface).

// All defaults (60-second idle timeout, 10 MB max body, 16 KB read buffer)
ClientConnectionConfig

// Custom idle timeout via MakeIdleTimeout (milliseconds)
let timeout = match lori.MakeIdleTimeout(30_000)
| let t: lori.IdleTimeout => t
end
ClientConnectionConfig(where
  max_body_size' = 52_428_800,  // 50 MB
  idle_timeout' = timeout)

// Disable idle timeout
ClientConnectionConfig(where idle_timeout' = None)

// Set a 5-second connection timeout
let ct = match lori.MakeConnectionTimeout(5_000)
| let t: lori.ConnectionTimeout => t
end
ClientConnectionConfig(where connection_timeout' = ct)

// Smaller read buffer to limit work per turn
let rbs = match lori.MakeReadBufferSize(4096)
| let r: lori.ReadBufferSize => r
end
ClientConnectionConfig(where read_buffer_size' = rbs)
class val ClientConnectionConfig

Constructors

create

[Source]

Create client connection configuration.

Parser limits default to sensible values. idle_timeout' is an IdleTimeout (milliseconds) or None to disable idle timeout. Defaults to 60 seconds. connection_timeout' is a ConnectionTimeout (milliseconds) or None to disable connection timeout. Defaults to None. read_buffer_size' bounds how much data the connection reads per scheduler turn — a smaller buffer means less work per turn at the cost of more turns to deliver a large response. Defaults to 16 KB (lori's default). from' specifies the local bind address (empty string means any interface).

new val create(
  max_status_line_size': USize val = 8192,
  max_header_size': USize val = 8192,
  max_chunk_header_size': USize val = 128,
  max_body_size': USize val = 10485760,
  idle_timeout': (IdleTimeout | None val) = call,
  connection_timeout': (ConnectionTimeout | None val) = reference,
  read_buffer_size': ReadBufferSize = call,
  from': String val = "")
: ClientConnectionConfig val^

Parameters

Returns


Public fields

let max_status_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 idle_timeout: (IdleTimeout | None val)

[Source]


let connection_timeout: (ConnectionTimeout | None val)

[Source]


let read_buffer_size: ReadBufferSize

[Source]


let from: String val

[Source]