Registry Mirror
Skip to content

Repository files navigation

HttpAsm

HttpAsm

Extreme performance HTTP and networking library

CI Platforms: Linux, Windows, macOS Architectures: x86-64, ARM64 h2spec: 146 of 146 Security review: Claude Mythos Benchmarks License: Apache-2.0

HttpAsm is an HTTP and networking library written in assembly, for x86-64 and ARM64
on Linux, Windows and macOS: HTTP/1.1, HTTP/2 and HTTP/3, client and server, over QUIC
and TLS 1.2 and 1.3 of its own. One C ABI serves C, C++, .NET, Python, Rust, Go, Zig
and NASM programs alike.

HttpAsm's compatibility target is the RFCs, read from the RFC Editor's own files, and it is held to
parity with six enterprise languages: its client and server are tested against the HTTP and TLS stacks
of C#, C, Rust, Python, Java and Go. Every MUST, SHOULD and MAY is a row of the requirement registry
that a test names; where a stack and an RFC differ, the RFC is the source of truth and HttpAsm aligns.

What is HttpAsm?

HttpAsm is a library, not a server program: a program links it and calls it through one C ABI, include/httpasm.h (and httpasm.inc for NASM). AsmSdk, which builds it, takes it to every language AsmSdk serves: C#, F# and Visual Basic reference it as a .NET package and call it through the bindings AsmSdk generates, and C, C++, Python, Rust, Go and Zig call it through its C header. Its protocol core does no I/O: bytes go in, and bytes and events come out. Per-core event loops drive it, and so can a host's own loop or a test. It belongs to the AsmFoundation family, next to KvAsm and GrpcAsm.

The stack

HttpAsm's stack: the C ABI, .NET and Python over HTTP/1.1, HTTP/2 and HTTP/3, over TLS 1.2, TLS 1.3 and QUIC, over the certificates and the cryptography in assembly, on x86-64 and ARM64 with Linux, Windows and macOS

Features

  • HTTP/1.1 - both directions: RFC 9112's request and status lines, field lines, chunked bodies and pipelining, and section 6.3's request-smuggling defenses, held to 1,671 published smuggling requests.
  • HTTP/2 - client and server: frames, streams, flow control, HPACK (its Huffman code generated from RFC 7541) and server push; h2c, and h2 by ALPN; h2spec 146/146, and 17 published floods served or cut with ENHANCE_YOUR_CALM.
  • HTTP/3 and QUIC - client and server: QUIC's transport, its TLS handshake and its loss recovery (RFC 9000, 9001, 9002), HTTP/3 and QPACK (RFC 9114, 9204), and server push built once for HTTP/2 and HTTP/3.
  • TLS 1.3 and 1.2 - both roles, on cryptography of its own. TLS 1.3 (RFC 9846) with resumption and 0-RTT behind a replay filter, post-handshake authentication, Encrypted Client Hello, certificate compression (zlib, Brotli, Zstandard: each codec its own), delegated credentials, the key log and the post-quantum hybrids X25519MLKEM768, SecP256r1MLKEM768 and SecP384r1MLKEM1024; TLS 1.2 within RFC 9325's bounds: ECDHE with AEAD suites, the extended master secret. Sans-I/O: the caller's memory, random source and clock.
  • Certificates - X.509 path validation (RFC 5280, with RFC 9618's policy graph), server identity (RFC 9525), OCSP and CRLs stapled, supplied or fetched, Certificate Transparency's SCTs, PKCS #12 files, and the keys' formats (PEM, PKCS #8, PKCS #1, SEC1).
  • Cryptography - SHA-1, SHA-2, SHA-3, HMAC, HKDF, PBKDF2, AES-GCM and AES-CBC, ChaCha20-Poly1305, X25519, X448, ECDH and ECDSA on P-256/384/521, Ed25519, Ed448, RSA, ML-KEM and FFDHE; held to NIST's and Wycheproof's vectors, checked for constant time under valgrind and timed by dudect.
  • For every consumer - a worker per core; handlers answer at once, or later from any thread; slow clients cut by a minimum data rate. C and NASM call the C ABI; .NET gets an ASP.NET Core server and an HttpClient handler; Python gets ASGI.
  • CPU Acceleration - Every platform's fastest path - x86-64 and ARM64, on Linux, Windows and macOS: every accelerated routine (SSE2 to AVX-512, AES-NI, VAES and the SHA extensions on x86-64; NEON and the cryptography extensions on ARM64) has a plain version beside it, chosen once at load; HTTPASM_CPU caps the tier.

Warning

Footguns. 0-RTT data is replayable: the handler sees HTTPASM_REQUEST_EARLY_DATA and should act on it only where doing it twice is harmless. The key log hands out every secret: a build with HttpAsmNoKeyLog=true cannot log at all.

How it is proven

Check Result What it covers
The requirement registry 5,008 requirements, 74 documents every row proven by a test that names it, or deferred with a reason
h2spec 146 of 146 HTTP/2, in cleartext and over TLS
BoGo (BoringSSL's runner) 658 pass, none fails TLS, both roles
tlsfuzzer every script passes the TLS server: about 20,000 scripted probes a run
RFC 8448 five traces, octet for octet the key schedule, records and handshakes, where RFC 9846 still holds them
Interop 117 of 117 curl, OpenSSL, GnuTLS, BoringSSL, rustls, nginx, h2o, Chromium, Firefox
Fuzzing 33 fuzzers every parser, at every CPU tier, against a guard page; TLS's 19 ran about 110 million inputs
Floods and smuggling 17 floods, 1,671 requests every published HTTP/2 flood; defparam's and PortSwigger's mutations
Faults every allocation, 33 system calls each failed in turn: no crash, hang or spin
Constant time valgrind and dudect every function that takes a secret
Coverage gate every block and branch edge runs, or is listed with the reason it cannot

The suite runs at every CPU tier the machine has; every multi-version routine also runs under Intel SDE's AVX-512 where the CPU has none.

Security review with Claude Mythos

HttpAsm's code is reviewed with Claude Mythos, Anthropic's model for cyber defense, through Anthropic's Cyber Verification Program. Claude Mythos reads the assembly, the parsers and the cryptography the way an attacker would, to find vulnerabilities before a release does. Each finding is fixed, and a test that reproduces it joins the suite, beside the fuzzers, the coverage gate and the conformance suites above.

Performance

Measured on an Intel Core i9-13900K under WSL2 (Linux 5.15), the servers and the load generators on separate CPUs of the same machine; the median of 5 rounds of 10 s, CPU time per request being the measure (requests a second follow the load generator as much as the server). Absolute numbers depend on the machine: compare within a row. benchmarks/README.md has every run, its method and the candidates it rejected.

Server CPU per request relative to HttpAsm's (1x): nginx 1.24 from 1.62x to 10.6x, h2o 2.2.5 from 1.17x to 17.3x

Cleartext: four workers each, 2026-11-27. HTTPS: one worker each, TLS 1.3 with X25519, ECDSA P-256 and AES-128-GCM, 2026-12-01. In one process, the TLS engine does 3.0x OpenSSL 3.5.9's handshakes, 5.0x its resumptions and 1.72x its AES-128-GCM records.

Quick start

A server answering every request "Hello, World!", over HTTP/1.1 and HTTP/2 alike:

// hello.c
#include <httpasm.h>
#include <stdio.h>
#include <unistd.h>

static void hello(void *context, httpasm_exchange *exchange)
{
    static const httpasm_field type = {
        .name = (const uint8_t *)"Content-Type", .name_length = 12,
        .value = (const uint8_t *)"text/plain", .value_length = 10,
    };
    httpasm_exchange_respond(exchange, 200, &type, 1, (const uint8_t *)"Hello, World!", 13);
}

int main(void)
{
    httpasm_server_options options = { .handler = hello, .port = 8080 };
    httpasm_server *server = httpasm_server_create(&options, NULL);
    if (server == NULL || httpasm_server_start(server) != 0)
        return 1;
    printf("listening on port %u\n", httpasm_server_port(server));
    pause();                                /* serve until the process is stopped */
}
cc hello.c -I src/HttpAsm/include -L src/HttpAsm/bin/Release/libc/linux-x64 -lhttpasm -o hello
LD_LIBRARY_PATH=src/HttpAsm/bin/Release/libc/linux-x64 ./hello

Handlers may also answer later, from any thread (httpasm_exchange_defer), and a tls configuration in the options makes the same server HTTPS. Every function is documented in include/httpasm.h.

Build and test

AsmSdk builds HttpAsm with dotnet build from Windows, macOS or Linux, for each of them on x86-64 and ARM64.

dotnet build HttpAsm.slnx                          # the library, the sample and the tests
tests/run-linux.sh Release                         # every test, at every CPU tier, on both Linux backends
benchmarks/bench.sh --quick                        # single-thread routines, every tier, the rivals
tests/coverage/run.sh                              # every block and branch edge, and the gate

HTTPASM_CPU caps the library's CPU tier in any program, as OPENSSL_ia32cap does for OpenSSL: v1 is the plain version. The fuzzers, the constant-time checks, BoGo, tlsfuzzer and the interop suite each have their run.sh: docs/DESIGN.md lists them all.

Documentation

License

Apache-2.0 - see LICENSE. The files under specs/rfc/ are the RFC Editor's unmodified copies of IETF documents, under the IETF Trust's legal provisions (BCP 78).

Related AsmFoundation projects

  • AsmSdk - the MSBuild SDK that builds HttpAsm: assembly projects next to .csproj
  • KvAsm - a gRPC key-value server in assembly
  • GrpcAsm - a gRPC server and client in assembly
  • AsmFoundation - Free Open Source Assembly Software

About

A complete HTTP networking library in cross-platform assembly: HTTP/1.1, HTTP/2 and HTTP/3 with QUIC and TLS

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages