class

ServerX::PooledServer

Inherits Reference < Object

nginx-style transport: one buffer per connection, offset-based HTTP/1.1 parser, zero heap allocations per request on the fast path (handler == nil, the benchmark payload). With a handler attached (see AppServer) the same transport drives a stock HTTP::Handler — framing (keep-alive, Content-Length, chunked bodies, pipelining) is decided here, below the handler API.

Hardening: read/write timeouts, per-worker connection limit (503), header limit 431, malformed request line / Content-Length 400, unsupported Transfer-Encoding 501, request body cap 413, Expect: 100-continue, graceful shutdown on SIGTERM/SIGINT (stop accepting, drain in-flight).

Constants

BUF_SIZE = 64 * 1024

Constructors

new(host : String, port : Int32, stats : Stats = Stats.new, read_timeout : Time::Span | Nil = 30.seconds, write_timeout : Time::Span | Nil = 30.seconds, max_body : Int64 = (16_i64 * 1024) * 1024, max_conns : Int32 = 8192, backlog : Int32 = 1024, tls : OpenSSL::SSL::Context::Server | Nil = nil, drain_timeout : Time::Span = 10.seconds, install_signals : Bool = true)
Source

Instance methods

drain_connections
Source
eq_ignore_case?(buf : Slice(UInt8), from : Int32, len : Int32, s : String) : Bool
Source
header_end(buf : Slice(UInt8), filled : Int32) : Int32
Source
listen
Source
move_left(buf : Slice(UInt8), from : Int32, len : Int32) : Nil
Source
request_line_ok?(buf : Slice(UInt8), head : Int32) : Bool

Request line is METHOD SP PATH SP HTTP/1.x CRLF.

Source
scan_headers(buf : Slice(UInt8), head : Int32) : HeaderScan

One walk over the header block collecting everything the transport needs. head is the offset of the terminating "\r\n\r\n".

Source
stop

Graceful shutdown: stop accepting, let in-flight requests finish.

Source

Nested types