NAME

h2spec-server - Minimal HTTP/2 server for conformance and load testing

SYNOPSIS

h2spec-server [--stats] [port]

# Default port 8080
h2spec-server

# Custom port
h2spec-server 9000

# Per-connection frame counters on STDERR
h2spec-server --stats 9000

# Run h2spec against it
h2spec -h localhost -p 9000

# Drive the early-response path
h2load -n 5000 -c 20 -m 50 -d bigfile http://localhost:9000/early

DESCRIPTION

A minimal HTTP/2 cleartext (h2c) server designed for testing with h2spec, the HTTP/2 conformance testing tool, and for load testing the binding's callback surface with h2load and nghttp.

The server responds with "200 OK" to all valid requests. It uses a fork-per-connection model to handle h2spec's rapid test connections.

OPTIONS

--stats

Print one counter line per connection to STDERR when that connection ends:

h2spec-server stats pid=123 streams_accepted=50 frames_sent=0:50;1:50 \
    frames_not_sent=none invalid_frames=0 errors=0 early_resets=50

frames_sent and frames_not_sent are key:count lists, keyed by HTTP/2 frame type and by NGHTTP2_ERR_* code respectively, or none when empty. early_resets counts the streams reset because the response finished while the request half was still open.

--help

Print the usage message and exit.

ENDPOINTS

/echo (and any other path)

Responds 200 with a short static body once the whole request has arrived.

/early

Responds 200 as soon as the request headers arrive, without reading the request body. The response therefore completes while the request half is still open, and the server closes the stream with RST_STREAM(NO_ERROR) from inside on_frame_send. h2load -d FILE against this endpoint drives that path on every request.

/stream?n=N

Responds 200 with a streaming body of N KiB, produced a chunk at a time so a reset can land mid-body. Each chunk is at most 1 KiB and never larger than what nghttp2 asks for. N defaults to 1.

SIGNALS

SIGTERM

Graceful shutdown. The listening process stops accepting and forwards the signal; each connection submits GOAWAY naming the highest stream it accepted, flushes until nghttp2 has nothing left to write or two seconds pass, and exits with status 0.

SEE ALSO

Net::HTTP2::nghttp2, https://github.com/summerwind/h2spec