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.0

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.0
File Size Uploaded
h11r-0.2.0.tar.gz 64.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for h11r 0.2.0
File
h11r-0.2.0-cp314-cp314t-win_arm64.whl CPython 3.14 CPython 3.14 free-threading Windows ARM64 Details
h11r-0.2.0-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details
h11r-0.2.0-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.0-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.0-cp314-cp314t-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 Details
h11r-0.2.0-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.0-cp311-abi3-win_arm64.whl CPython 3.11 abi3 Windows ARM64 Details
h11r-0.2.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
h11r-0.2.0-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.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details
h11r-0.2.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
h11r-0.2.0-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.0.tar.gz

Download URL h11r-0.2.0.tar.gz
Size 64.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d320199df195427691901e891271b178701fce88ae623a2840b5e596a884a191
BLAKE2b-256 checksum
How to use checksums
1814b0c35e62eae4c84519102e1fb8051a777e185337b413b2ed9eca978faeeb
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 2, 2026.

Transparency log

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

Download URL h11r-0.2.0-cp314-cp314t-win_arm64.whl
Size 196.9 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows ARM64
SHA-256 checksum
How to use checksums
074832ad785efcf7ff903418691ca6fe55290115328baee174a200bf592e208b
BLAKE2b-256 checksum
How to use checksums
83b270affeb97804cf8630d4653676d9ea822a757f9c46df50c05c1452fbf03b
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 2, 2026.

Transparency log

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

Download URL h11r-0.2.0-cp314-cp314t-win_amd64.whl
Size 204.3 kB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
d38f98319e966ac68ce6900f0166c807adeef008b8da6b4a4cf250d622ac6768
BLAKE2b-256 checksum
How to use checksums
bbcc86a91391cb1d349dd3d9e9baa1386b4f8b14e79cdbde69dc6a6f052ac436
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 2, 2026.

Transparency log

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

Download URL h11r-0.2.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 353.1 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
a56009289bd141f2e839a2e1c5c7a8b86260cf0ea545457d9be41f8d98c41aae
BLAKE2b-256 checksum
How to use checksums
8f477957ca207325fac360041a03d37c0a1d7cb450317748d7cf904bb07cbf30
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 2, 2026.

Transparency log

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

Download URL h11r-0.2.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 346.7 kB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ ARM64
SHA-256 checksum
How to use checksums
11b2926e15cd11c4fb03ef4a35ab6ed8c50f89b9c5c3c8c8c13633f8ac5d08b7
BLAKE2b-256 checksum
How to use checksums
9e52565221af18f15b28bbfff49059ce9fb48a495de70ebc976bb53665575f63
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 2, 2026.

Transparency log

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

Download URL h11r-0.2.0-cp314-cp314t-macosx_11_0_arm64.whl
Size 319.0 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d1a5ed7772fad806142d284d29d863692ce03b96c084d9396e5f3e34a74989ce
BLAKE2b-256 checksum
How to use checksums
1efeeff930f304b6f97e509a4f5556584030f4f023799fb93ae5b579c4af57e8
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 2, 2026.

Transparency log

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

Download URL h11r-0.2.0-cp314-cp314t-macosx_10_12_x86_64.whl
Size 325.6 kB
Tags CPython 3.14 CPython 3.14 free-threading macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
3b5f503d9fe18bfb1f190250c974e1bcdf6ea74e72959a53d5486afe1697939b
BLAKE2b-256 checksum
How to use checksums
12baef76b950ecf46ca23908668af63fc4b548dcc6542ee6b0c9175d2cc4b77d
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 2, 2026.

Transparency log

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

Download URL h11r-0.2.0-cp311-abi3-win_arm64.whl
Size 202.3 kB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
061fc4bd1e7eeab4e4ff7659ab83092fb58154efc2f42ec6f1ac283146848ad6
BLAKE2b-256 checksum
How to use checksums
6e1f0190638b03dcbdeef07dbc8edb091d46b962750d165ea7bfbbd4fde69482
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 2, 2026.

Transparency log

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

Download URL h11r-0.2.0-cp311-abi3-win_amd64.whl
Size 209.5 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
be817f9955e81f0002588520f603ec1554d7c1237e608bc27929d080caede249
BLAKE2b-256 checksum
How to use checksums
680015a69c03e4da9b46175d7ae1fb968c99be0e32ecf71a287d9029d82eccb8
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 2, 2026.

Transparency log

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

Download URL h11r-0.2.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 360.6 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
244afa6137e89184c9c5bce955ce0cdb3247fc77fb235a45e880c912c6f4205b
BLAKE2b-256 checksum
How to use checksums
30839236fbe71c8669471d480d82b63353b388afdea74d3377b6e92883d95c61
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 2, 2026.

Transparency log

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

Download URL h11r-0.2.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 353.8 kB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
747bc4c89aeaaa78715482a995db05b1d6c1f44f1bc405e86a9c8ab9a1aaec7e
BLAKE2b-256 checksum
How to use checksums
97368fc017554f7776ff5d1ceee72f2cbf844ffa63166174cd1e0d30ad402f55
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 2, 2026.

Transparency log

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

Download URL h11r-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
Size 322.6 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
af65f2127da7a532aee334739172685902d1ea1817deefc71b03a0e7e3bd3e62
BLAKE2b-256 checksum
How to use checksums
03c6473a000ab4c4222d6127e921924972cd0faa4a09ad37e5029ec6653b18ea
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 2, 2026.

Transparency log

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

Download URL h11r-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 325.6 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5ecff1060867c2ca17bfd90c7cd9ba610324da8a4b7b1c156cc78358a6538f51
BLAKE2b-256 checksum
How to use checksums
9a04510916da0527850c09c9596b89a9bc73c50beefed4066c6dff8c24506c1b
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 2, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.2

25 release files

0.2.1

13 release files

This release

0.2.0 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