Skip to main content

h11r logo

h11r

A fast, typed Sans-I/O HTTP/1.1 engine with a Rust core and Python API.

CI codecov PyPI Crates.io docs.rs Python 3.11–3.14 Rust 1.88+ License: MIT

h11r is a low-level HTTP/1.1 protocol engine with a transport-independent Rust core and a typed Python API. Applications own their network I/O: send methods produce wire bytes, while received peer bytes become immutable Python events. The library enforces message framing, connection state, and protocol errors while your code keeps control of transport, runtime, and application policy.

Use it to build HTTP/1.1 clients, servers, proxies, protocol adapters, or test tools. It is not a ready-made HTTP client that opens connections and sends requests for you.

h11r is currently alpha software. Its public API may change during alpha development.

Why h11r

  • Low protocol-layer overhead. The checked-in benchmarks show higher throughput than h11 across five equivalent HTTP/1.1 workloads. See the results.
  • A Python-native, typed API. Work with immutable event objects, Python exceptions, and precise type information in editors and type checkers.
  • Your transport and runtime. The library does not choose sockets, TLS, concurrency, cancellation, or back-pressure policy.
  • More control when you need it. Start with ordinary request and response bytes, then opt into streaming bodies, buffer-preserving writes, pipelining, or protocol handoff.

Quick Start

For Python, add h11r to a uv-managed project:

uv add h11r

Or install it with pip:

pip install h11r

For Rust, add the protocol core and use its docs.rs API:

cargo add h11r

Create a client-role connection, serialize one bodyless request, and parse a complete response:

import h11r

client = h11r.Connection(h11r.Role.CLIENT)
request_bytes = client.send_request(
    "GET",
    "/hello",
    [("Host", "example.test")],
)
request_bytes += client.end_of_message()

client.receive_data(b"HTTP/1.1 200 OK\r\nContent-Length: 17\r\n\r\nHello from h11r!\n")

status_code = None
response_body = bytearray()

while True:
    event = client.next_event()

    match event:
        case h11r.Response(status_code=code):
            status_code = code
        case h11r.Data(data=chunk):
            response_body.extend(chunk)
        case h11r.EndOfMessage():
            break

print(status_code, bytes(response_body))

Output:

200 b'Hello from h11r!\n'

In a real client, your transport writes request_bytes and supplies each read to receive_data(). The first tutorial keeps the same client-side flow and makes that boundary visible before adding a socket.

Learn and Integrate

Use the runnable examples when you need a specific integration:

Goal Example
Process a body incrementally and validate trailers streaming_body.py
Preserve response order for pipelined requests pipelining.py
Pass a transport-owned file region through to sendfile() zero_copy_body.py
Hand a successful WebSocket Upgrade to wsproto websocket_upgrade.py
Build a complete teaching server with asyncio streams asyncio_server.py

Performance

Python benchmark comparing h11r and h11

The chart compares protocol-layer throughput for h11r and h11 0.16.0 across five equivalent Python HTTP/1.1 workloads that reuse their connections. Each workload uses public APIs and includes protocol state transitions. It does not include socket, TLS, or asynchronous runtime overhead. Higher is faster.

The results were produced by the pyperf benchmark. The raw pyperf result used to render the chart is included for reproduction and inspection. The measurement environment is recorded in the chart. Results will vary with hardware and Python version.

Scope and compatibility

Each Connection maintains one endpoint's view of an HTTP/1.1 connection. Higher-level clients, servers, proxies, and test tools decide how to schedule I/O and apply application policy.

It supports client and server roles, HTTP/1.0 peers, Content-Length and chunked framing, keep-alive cycles, informational responses, trailers, and protocol handoff after Upgrade. Header and trailer section byte size and field count have independent limits; application body limits remain the caller's responsibility. Local API misuse is reported separately from remote protocol errors.

The Python package supports GIL-enabled CPython 3.11 through 3.14 and free-threaded CPython 3.14t. CI also exercises CPython 3.15 and 3.15t while they are prereleases. Independent Connection instances may run in parallel. Operations on one connection still have protocol order and must be serialized by its caller.

Relationship to h11

h11r is an independent Sans-I/O HTTP/1.1 protocol engine with a Rust core and a typed Python API. It performs no network I/O and does not depend on the Python h11 package at runtime. h11r and h11 occupy the same protocol-engine layer, but their public APIs differ, so switching between them requires adapting application integration code.

The Rust core uses httparse for request and response heads and trailer fields. h11r implements framing, buffering and resource limits, wire serialization, and its public Rust and Python APIs.

Interoperability tests verify representative h11r-client/h11-server and h11-client/h11r-server exchanges at the HTTP wire boundary. They provide evidence for those exchanges, not an API-compatibility or exhaustive wire-compatibility guarantee. h11 remains a mature pure-Python library with its own established API and ecosystem.

Contributing

See CONTRIBUTING.md for development and release guidance.

License

MIT

Metadata

Release files for h11r 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for h11r 0.2.1
File Size Uploaded
h11r-0.2.1.tar.gz 64.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for h11r 0.2.1
File
h11r-0.2.1-cp314-cp314t-win_arm64.whl CPython 3.14 CPython 3.14 free-threading Windows ARM64 Details
h11r-0.2.1-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
h11r-0.2.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64 Details
h11r-0.2.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ ARM64 Details
h11r-0.2.1-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details
h11r-0.2.1-cp314-cp314t-macosx_10_12_x86_64.whl CPython 3.14 CPython 3.14 free-threading macOS 10.12+ x86-64 Details
h11r-0.2.1-cp311-abi3-win_arm64.whl CPython 3.11 abi3 Windows ARM64 Details
h11r-0.2.1-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
h11r-0.2.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details
h11r-0.2.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details
h11r-0.2.1-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
h11r-0.2.1-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details

Total release size: 3.6 MB

Release files / h11r-0.2.1.tar.gz

Download URL h11r-0.2.1.tar.gz
Size 64.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5820aa33c04bb39f93d66fff023c4c79590befe1a6be847727e0acb15bc90207
BLAKE2b-256 checksum
How to use checksums
7f0dee78f395bc1ddba42c9f17f32f257b1595881033bea2c84dc06a480f623a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 22, 2026.

Transparency log

Release files / h11r-0.2.1-cp314-cp314t-win_arm64.whl

Download URL h11r-0.2.1-cp314-cp314t-win_arm64.whl
Size 197.2 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows ARM64
SHA-256 checksum
How to use checksums
f3ae538bbac0892d495da8de2969ee23761d8dffa290a26d2553d42849941f64
BLAKE2b-256 checksum
How to use checksums
2adb350c6294f19e52cce89b58cab3b6d366ab17df3f434c41bc42f0cd2bd299
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 22, 2026.

Transparency log

Release files / h11r-0.2.1-cp314-cp314t-win_amd64.whl

Download URL h11r-0.2.1-cp314-cp314t-win_amd64.whl
Size 204.9 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
fca8a21e44c0bdda10dfa719f68b88d823b543eb276704f61274eba66857214d
BLAKE2b-256 checksum
How to use checksums
94312f822af1b9a8795afde340feb2e6b5b7b5d802cabcd844e1acd1826fcd92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 22, 2026.

Transparency log

Release files / h11r-0.2.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL h11r-0.2.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 358.1 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
bee0cd478ccbaa964ffc48361be7bfb6f5db65a3d6cc1e237a87adce6597f942
BLAKE2b-256 checksum
How to use checksums
9665963e33db5e1c1ec3d24419813f98c1b5f96bb8d93ca5a454a51b2695bafb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 22, 2026.

Transparency log

Release files / h11r-0.2.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL h11r-0.2.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 349.9 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
9411ad5584e78de5330cf1bedced7c6a4695326d57164ac21f6df3bd7b99e9a4
BLAKE2b-256 checksum
How to use checksums
84505d74e30468f8ad0bae0ad2cd60689366dfab96d5a545cf925fadafa4e58d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 22, 2026.

Transparency log

Release files / h11r-0.2.1-cp314-cp314t-macosx_11_0_arm64.whl

Download URL h11r-0.2.1-cp314-cp314t-macosx_11_0_arm64.whl
Size 318.9 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5d7721a56a47902f39a1cac1747b36dac8af0031b6e2136cde621f861afd0697
BLAKE2b-256 checksum
How to use checksums
f2a7747c59c7f45c4cda7b1c66f797772490b7b8eccd68af7c9ffae3eba72182
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 22, 2026.

Transparency log

Release files / h11r-0.2.1-cp314-cp314t-macosx_10_12_x86_64.whl

Download URL h11r-0.2.1-cp314-cp314t-macosx_10_12_x86_64.whl
Size 325.3 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
56066b510d1c5f1d94dd3eaffd26ec6d5350f2f57b861e21416cf28fcf5cca3f
BLAKE2b-256 checksum
How to use checksums
b898f788a1cff308eeafecac6ff8fd0786af132a6fe9e533ba61ad80aa06c383
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 22, 2026.

Transparency log

Release files / h11r-0.2.1-cp311-abi3-win_arm64.whl

Download URL h11r-0.2.1-cp311-abi3-win_arm64.whl
Size 202.1 kB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
5c6d57f2b8d74983db5c0de54609ecad86a148387ceeb93f6dbe47e62b8eb19c
BLAKE2b-256 checksum
How to use checksums
15125a45679f3c572faa9faa2d5897454ed615067d529304b7ed50ffeaf346a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 22, 2026.

Transparency log

Release files / h11r-0.2.1-cp311-abi3-win_amd64.whl

Download URL h11r-0.2.1-cp311-abi3-win_amd64.whl
Size 210.2 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
524063ff3d055cd49b3c9c7bb6cd08b843ae393304b96dddd7d54a2c024d29d1
BLAKE2b-256 checksum
How to use checksums
1f5aeeb4c40539a1f73512600403ecfb835bec9556a34384e5b961e985d36d76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 22, 2026.

Transparency log

Release files / h11r-0.2.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL h11r-0.2.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 366.2 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
2ba19850b296657db3250e5dfdc050e67ad6221ed59ebab3f3fd7eb842246260
BLAKE2b-256 checksum
How to use checksums
4196b8add4206ecd2a3b77cc26b2a9fe7a8a8804b7304fc07b8d19d8a6af5410
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 22, 2026.

Transparency log

Release files / h11r-0.2.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL h11r-0.2.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 356.6 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
22615823a4ecafc7031540339df08ab3f50352eea95704de4273f86407cdf2cd
BLAKE2b-256 checksum
How to use checksums
b0ca703e2c1bfe2b4badbfc254ed57535c8fe57a72423651ba5559e0045276ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 22, 2026.

Transparency log

Release files / h11r-0.2.1-cp311-abi3-macosx_11_0_arm64.whl

Download URL h11r-0.2.1-cp311-abi3-macosx_11_0_arm64.whl
Size 323.4 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fcbc6986ffaaa496ec43074296567c0a9b446edc5c83e37fd9c6dde108af0fd6
BLAKE2b-256 checksum
How to use checksums
7cdf873ec828c6c9651bfe60817a360d348e74ab83b8ed4c8bb8c2081595e843
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 22, 2026.

Transparency log

Release files / h11r-0.2.1-cp311-abi3-macosx_10_12_x86_64.whl

Download URL h11r-0.2.1-cp311-abi3-macosx_10_12_x86_64.whl
Size 326.8 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8d7ad4582235d9761a53bb3da7b968483395df92d2548b6fb6b3bea2fb192fec
BLAKE2b-256 checksum
How to use checksums
e5c18fc6c89522006f92477b72bce69ceeb8014e63d5ec0fc5350947893c475c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 22, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.2

25 release files

This release

0.2.1 This release

13 release files

0.1.1

13 release files

0.1.0

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page