Project 18: Production HTTP/2 Server with Complete Features
A complete HTTP/2 server combining everything you’ve learned: io_uring or epoll, TLS with ALPN, HTTP/2 binary framing, multiplexed streams, header compression (HPACK), flow control, a thread pool for handlers, and C++20 coroutines for clean async code.
Quick Reference
| Attribute | Value |
|---|---|
| Primary Language | C++20 |
| Alternative Languages | Rust, Go |
| Difficulty | Level 5: Master |
| Time Estimate | 1-2 months |
| Knowledge Area | HTTP/2, All Previous Concepts Combined |
| Tooling | Full production server |
| Prerequisites | All previous projects, especially 6, 13-16 |
What You Will Build
A complete HTTP/2 server combining everything you’ve learned: io_uring or epoll, TLS with ALPN, HTTP/2 binary framing, multiplexed streams, header compression (HPACK), flow control, a thread pool for handlers, and C++20 coroutines for clean async code.
Why It Matters
This project builds core skills that appear repeatedly in real-world systems and tooling.
Core Challenges
- ALPN negotiation → maps to TLS extension for protocol selection
- HTTP/2 frame parsing → maps to binary frames, variable-length headers
- Stream multiplexing → maps to multiple request/response pairs on one connection
- HPACK compression → maps to dynamic table, Huffman coding
- Flow control → maps to window updates, backpressure
Key Concepts
- HTTP/2 Protocol: RFC 7540
- HPACK Compression: RFC 7541
- HTTP/2 Framing: “HTTP/2 in Action” Chapter 3 - Pollard
- ALPN: “Bulletproof SSL and TLS” - Ristić
Real-World Outcome
$ ./h2_server --port 443 --cert server.crt --key server.key \
--threads 8 --io-backend io_uring
HTTP/2 server starting...
Port: 443
TLS: enabled (ALPN: h2, http/1.1)
Backend: io_uring
Threads: 8
# Verify with curl:
$ curl -k --http2 https://localhost/
HTTP/2 200
content-type: text/html
...
# Check protocol:
$ curl -k -sI https://localhost | grep -i protocol
HTTP/2 200
# Load test:
$ h2load -n 100000 -c 100 -t 4 https://localhost/
finished in 2.5s
requests: 100000 total, 100000 started, 100000 done, 100000 succeeded
status codes: 100000 2xx
traffic: 45.00MB total, 44.80MB data
min/max/mean/sd: 0.5ms/25.3ms/2.1ms/1.8ms
requests/sec: 40,000
# Server handles concurrent streams:
$ nghttp -v https://localhost/page1 https://localhost/page2 &
[Stream 1] /page1 - 200 OK
[Stream 3] /page2 - 200 OK
# Both on same TCP connection!
Implementation Guide
- Reproduce the simplest happy-path scenario.
- Build the smallest working version of the core feature.
- Add input validation and error handling.
- Add instrumentation/logging to confirm behavior.
- Refactor into clean modules with tests.
Milestones
- Milestone 1: Minimal working program that runs end-to-end.
- Milestone 2: Correct outputs for typical inputs.
- Milestone 3: Robust handling of edge cases.
- Milestone 4: Clean structure and documented usage.
Validation Checklist
- Output matches the real-world outcome example
- Handles invalid inputs safely
- Provides clear errors and exit codes
- Repeatable results across runs
References
- Main guide:
LEARN_CPP_NETWORK_PROGRAMMING.md - “HTTP/2 in Action” by Barry Pollard