Repository navigation
HTTP 3
A TLS listener with http3: true also answers HTTP/3 (RFC 9114) over QUIC (RFC 9000) on the same port
number, over UDP. It runs on the same epoll workers as HTTP/1.1 and HTTP/2, through the same router,
middleware and Ctx. QUIC, its TLS mapping, loss recovery and QPACK are viltrum's own code: no third-party
library. Linux only.
app.serve([
viltrum.Listener{
addr: '0.0.0.0:8443'
http2: true
http3: true
tls: viltrum.TlsOptions{
cert_file: 'certs/dev.crt'
key_file: 'certs/dev.key'
}
},
])!curl --http3-only -k https://127.0.0.1:8443/ # a curl built with HTTP/3
h2load --alpn-list=h3 -n 1000 -c 10 https://127.0.0.1:8443/The certificate must be RSA: QUIC needs viltrum's own TLS 1.3 handshake (hs13), which signs with RSA-PSS,
and has no mbedtls to fall back on. The handshake uses TLS_AES_128_GCM_SHA256 and X25519.
The same Ctx as for HTTP/1.1: the request's fields arrive as an HTTP/1.1 head, so the same checks run
(host, header count and size, body limit). c.file and app.static_files stream from disk as the client
takes the data.
Not served over HTTP/3 yet (answered 501): deferred responses (c.after, c.suspend, c.fetch),
streamed responses (c.stream, SSE) and WebSocket. Clients reach those routes over HTTP/1.1 or HTTP/2.
| Streams | 128 requests open at once per connection, raised as they finish |
| Flow control | 16 MiB per connection, 1 MiB per request stream |
| Idle timeout | 30 s |
| Response memory | a connection stops taking new requests while 512 KiB of answers wait to be sent; they are served as the client reads |
| QPACK | static table only (dynamic table capacity 0) |
0-RTT, Retry, connection migration, key update (a key-updated packet is dropped and the connection times
out), Alt-Svc announcement on HTTP/1.1 and HTTP/2 responses, server push, trailers in responses. Design and
phases: HTTP/3.