Example Programs¶
Standalone programs for testing and learning. All are built by default.
Binaries are in build/bin/.
server (build/bin/server)¶
Minimal QUIC/HTTP/3 server. Serves files from the current working directory; returns a 20-byte body for unknown paths. Single-threaded, one connection at a time.
Source: mod_http3/examples/server.c
Generate a certificate and start:
Verify:
Test with the built-in client:
Test with curl:
Test with Chrome:
google-chrome \
--user-data-dir=/tmp/quic_dev \
--ignore-certificate-errors \
--origin-to-force-quic-on=localhost:4433 \
https://localhost:4433
Stop:
Behavior:
| Request Path | Response |
|---|---|
/ or unknown |
20-byte default body (12345678901234567890) |
/filename |
Contents of ./filename if it exists |
HEAD method |
Headers only, no body |
GET method |
Headers + body |
Limitations: Single-threaded, no HTTP/2 or HTTP/1.1 fallback, no Alt-Svc header, no TLS session resumption.
quic_client_test (build/bin/quic_client_test)¶
Native QUIC/HTTP/3 client. Sends one or more concurrent GET requests. Verifies the server certificate against a supplied CA cert. No curl needed.
Source: mod_http3/examples/quic_client_test.c
Start a server first:
Single stream:
Expected: Status 200, All streams complete.
Five concurrent streams:
TLS handshake trace (writes trace.txt):
Usage:
| Argument | Description |
|---|---|
-trace |
Write TLS message trace to trace.txt |
hostname |
Server hostname (e.g., localhost) |
port |
Server UDP port (e.g., 4433) |
cacert.pem |
CA certificate to verify the server |
num_streams |
Number of concurrent HTTP/3 GET streams (default: 1) |
Limitations: Sends GET requests only, requests root path / only, no HTTP/2 or HTTP/1.1 fallback.
quic_server_test (build/bin/quic_server_test)¶
DO NOT USE. This test is broken. Both QUIC_TSERVER instances try to handshake with an external address that does not exist, so the test hangs indefinitely.
Use build/bin/server + build/bin/quic_client_test instead.
Source: mod_http3/examples/quic_server_test.c
biomemexample (build/bin/biomemexample)¶
Demonstrates OpenSSL BIO memory buffers. fork()s into client and server processes that perform a TLS handshake over Unix pipes using memory BIOs (BIO_s_mem). Not QUIC or HTTP/3 related - an OpenSSL BIO learning example.
Source: mod_http3/examples/biomemexample.c
Run:
The client sends "abcdefgh", the server sends "ABCDEFGH". Both print what they sent and received.
apr_miniserver (build/bin/apr_miniserver)¶
Minimal UDP server using APR socket types. Listens on UDP port 8081, spawns a thread per datagram, prints received data. Not QUIC or HTTP/3 related - an APR learning example.
Source: mod_http3/examples/miniserver.c
Run:
Send a message:
Server output:
Stop: