Pure-Julia HTTP/2 library — RFC 9113
and RFC 7541, covering
both server and client roles, cross-tested against libnghttp2 via
Nghttp2Wrapper.jl.
PureHTTP2.jl is a standalone implementation of HTTP/2 written entirely in
Julia. It was extracted from the http2 submodule of
gRPCServer.jl and
developed as a reusable library under the
PureHTTP2.jl constitution: pure Julia
only, TDD with TestItemRunner.jl,
reference parity with libnghttp2, Keep a Changelog + Semantic
Versioning, and warning-free Documenter.jl
builds.
[deps] in Project.toml is empty: PureHTTP2.jl has zero runtime
dependencies beyond Julia's standard library. Optional TLS / ALPN
support is provided via a package extension that loads when
OpenSSL.jl is present in
the same environment.
using Pkg
Pkg.add("PureHTTP2")Minimum Julia version: 1.10. The test/interop/ cross-test
environment against Nghttp2Wrapper.jl requires Julia ≥ 1.12
separately.
using PureHTTP2, Sockets
# Connect to a local h2c server (e.g., Nghttp2Wrapper.HTTP2Server).
tcp = connect(IPv4("127.0.0.1"), 8080)
conn = HTTP2Connection()
result = PureHTTP2.open_connection!(conn, tcp;
request_headers = Tuple{String, String}[
(":method", "GET"),
(":path", "/"),
(":scheme", "http"),
(":authority", "127.0.0.1:8080"),
])
println("status = ", result.status)
println("headers = ", result.headers)
println("body = ", String(result.body))
close(tcp)For the server-side counterpart, see
docs/src/tls.md and PureHTTP2.serve_connection!.
For TLS / ALPN support via the optional OpenSSL extension, see
docs/src/client.md.
- Frame layer — encode / decode for all RFC 9113 §6 frame types (DATA, HEADERS, PRIORITY, RST_STREAM, SETTINGS, PUSH_PROMISE, PING, GOAWAY, WINDOW_UPDATE, CONTINUATION).
- HPACK — encoder / decoder with dynamic table and Huffman compression, cross-validated against 23,688 conformance cases from http2jp/hpack-test-case.
- Stream state machine — RFC 9113 §5 transitions with odd / even stream-ID parity enforcement.
- Connection lifecycle — preface exchange, SETTINGS negotiation, flow control, GOAWAY, graceful shutdown.
- Server-role IO entry point —
serve_connection!(conn, io)drives a server over anyBase.IOsatisfying the IO adapter contract (read(io, n::Int),write(io, bytes),close(io)). - Client-role IO entry point —
open_connection!(conn, io; request_headers, request_body)drives a single client-role request / response exchange over the same contract. - Optional TLS ALPN helper —
PureHTTP2.set_alpn_h2!(ctx)provided by thePureHTTP2OpenSSLExtpackage extension when OpenSSL.jl is loaded. Converts aVector{String}protocol list into RFC 7301 §3.1 wire format and hands it to OpenSSL'sssl_set_alpn. - Reference parity against
libnghttp2— 14Interop:@testitemunits intest/interop/cross-test PureHTTP2.jl against Nghttp2Wrapper.jl, including a live h2c TCP round trip in each direction (server-role and client-role). - Documentation — 10-page Documenter.jl site with warning-free builds enforced from Milestone 1 onward.
At v0.1.0, the following are deliberately not yet shipped:
- Server-side h2 TLS ALPN — blocked on an upstream OpenSSL.jl
binding gap for
SSL_CTX_set_alpn_select_cb. The client-side ALPN helper (set_alpn_h2!) works end-to-end; the server side cannot yet negotiateh2in a TLS handshake. Tracked inupstream-bugs.md. - Multi-request client sessions —
open_connection!ships a single-request API. Stream multiplexing and long-lived sessions over one connection are a post-v0.1.0concern. - Affirmative server push handling —
open_connection!andserve_connection!negotiateSETTINGS_ENABLE_PUSH = 0and treat anyPUSH_PROMISEas a connection-levelPROTOCOL_ERRORper RFC 9113 §8.4. Accepting, processing, or explicitly refusing pushed streams is out of scope. - Multi-frame request bodies —
request_bodyis a singleVector{UInt8}written as one DATA frame. Chunked / streamed uploads are deferred. - macOS / Windows CI — the CI matrix is Linux-only at
v0.1.0. PureHTTP2.jl is pure Julia and should work on other platforms, but it is not yet tested there. - Stream priority beyond best-effort (RFC 9113 §5.3),
extensible SETTINGS per RFC 7540 §6.5.2, performance
benchmarks, and a fuzz harness — all deferred to post-
v0.1.0milestones. SeeROADMAP.md.
- Documentation (stable): https://s-celles.github.io/PureHTTP2.jl/stable/
- Documentation (dev): https://s-celles.github.io/PureHTTP2.jl/dev/
- Changelog:
CHANGELOG.md - Roadmap:
ROADMAP.md - Reference parity vs
libnghttp2:docs/src/nghttp2-parity.md - Upstream bug tracker:
upstream-bugs.md
PureHTTP2.jl is distributed under the MIT License. See the
Provenance appendix in CHANGELOG.md for the
extraction history and license inheritance from gRPCServer.jl.
PureHTTP2.jl was lifted and shifted from the http2 submodule of
gRPCServer.jl at
commit 4abc0932.
Reference parity is validated against the C implementation
libnghttp2 via
Nghttp2Wrapper.jl.