Overview

HTTP/2

Plaintext (h2c)#

import serve, serve/reactor
 
serveHttp2Reactor(8080, handler)

Over TLS#

serveHttp2TlsReactor(8443, tlsContext, handler)

One port, both protocols#

When a client doesn't know in advance whether the server speaks HTTP/1.1 or HTTP/2, ALPN lets it negotiate during the TLS handshake — one HTTPS port serves both:

serveHttpsAlpnReactor(8443, tlsContext, handler)

The repo's reactor_alpn.nim example is titled, in the maintainer's own words, "one HTTPS port, both protocols — ALPN dispatch on the reactor."

Conformance#

HTTP/2 support is checked against h2spec 146/146, over both h2c and TLS — the full conformance suite, not a subset. The reactor_h2tls.nim example notes this directly: "TLS on the reactor — async h2 over TLS, h2spec 146/146 on both."

SETTINGS negotiation is explicit rather than hidden behind defaults — see reactor_h2.nim, commit message: "the SETTINGS a deployment announces are its own."