Skip to main content

Module server

Module server 

Source
Expand description

The listeners and connection loops.

Server::setup binds the listener (and, in the http1 build, creates the thread pool); then Server::run (http1), run_tls (TLS with HTTP/2 via ALPN, or plain HTTP/1.1 without a certificate), run_quic (HTTP/3) and run_redirect (HTTP → HTTPS) accept connections, parse requests and hand them to your Application. ConnectionInfo carries the client and server addresses and the TLS SNI name. Examples: src/server/example/.

Modules§

proxy_protocol
Inbound PROXY protocol, versions 1 (text) and 2 (binary), as HAProxy, AWS NLB, GCP and most L4 load balancers send it: the client’s address, prepended to the connection. With proxy_protocol = true (RWS_CONFIG_PROXY_PROTOCOL) every connection to the main listener must start with one — before the TLS handshake on HTTPS — and its source address becomes the client address rws logs, rate-limits and forwards in X-Forwarded-For. A connection without a valid header is closed.

Structs§

Address
IP address and port pair.
ConnectionInfo
Network context for the current connection, passed into every Controller.
Server

Constants§

REQUEST_HEAD_TIMEOUT
Longest time from the first byte of a request head to its end (nginx’s client_header_timeout). The idle timeout alone restarts on every read, so a client sending one byte every few seconds could hold a connection for weeks with a 64 KiB head.