Releases: benoitc/hackney
4.2.0
Added
- IPv6 for HTTP/3. The
familyconnect option (inet|inet6) is forwarded to QUIC, which resolves DNS and races addresses with Happy Eyeballs (RFC 8305). IPv6 literals such ashttps://[::1]/work too. - 0-RTT and session resumption for HTTP/3. Session tickets are cached per
{host, port, transport}and replayed on the next connection; a bodyless one-shot request is then sent as 0-RTT, otherwise the ticket gives a resumed handshake. Controlled by thezero_rttoption, with an explicitsession_tickettaking precedence. Newhackney_h3helpers:early_data_accepted/1,get_session_ticket/1,wait_session_ticket/2.
Fixed
- Recover from an expired cross-signed root instead of failing the handshake (e.g. Let's Encrypt's ISRG Root X2 cross-signed by the expired ISRG Root X1), across HTTP/1.1, HTTP/2, HTTP/3 and WebTransport. A genuinely expired leaf or intermediate still fails, and partial chains keep working.
- HTTP/3 connections from the pool now apply
ssl_options(cacerts,insecure) that previously did not reach the QUIC layer. - A pooled connection that stops between checkout and the request call no longer leaks
exit:{normal, _}/exit:noprocto the caller; request, body and streaming calls return{error, closed}instead (#861). - A proxy host given as an atom (e.g.
localhost) or a binary is accepted again for the plain, connect and socks5 proxy tuples instead of being silently ignored (#858).
Dependencies
- quic 1.4.5 -> 1.6.3.
- h2 0.6.1 -> 0.8.0.
- webtransport 0.2.6 -> 0.3.1.
hackney 4.1.0
WebTransport client. Drop-in addition alongside the WebSocket API, no breaking changes.
Added
- WebTransport client API (
hackney:wt_connect/1,2,wt_send/2,wt_recv/1,2,wt_setopts/2,wt_close/1,2), mirroring the WebSocketws_*API so code switches by swapping thews_prefix forwt_. Runs over HTTP/3 (default) or HTTP/2. One session multiplexes many streams (wt_open_stream/2,wt_stream_send/3,4,wt_stream_recv/2,3,wt_close_stream/2,wt_reset_stream/3,wt_stop_sending/3) plus unreliable datagrams (wt_send_datagram/2) andwt_session_info/1. No custom wire framing, so it interoperates with any WebTransport server. Caller path and headers are checked for CR/LF/NUL and a buffer cap bounds unread data. See the WebTransport Guide.
Dependencies
- Add
webtransport0.2.6.
Full changelog: https://github.com/benoitc/hackney/blob/master/NEWS.md
hackney 4.0.3
OTP 29 support and HTTP/3 server-certificate verification. Drop-in upgrade from 4.0.2, no API changes.
Security
- HTTP/3 now verifies the server certificate. quic 1.4.4 authenticates the server by default; hackney passes the request's
insecureoption and any configured CA (cacerts/cacertfileinssl_options) through to the QUIC connection, so verification can be disabled or pointed at a custom trust store. Without a configured CA, quic uses its default trust store.
Changed
- Replace the deprecated
catch Exprform withtry ... catchso hackney compiles cleanly on OTP 29.
Dependencies
- Bump quic to 1.4.5 (fixes server-cert chain validation when the server sends an extra cross-sign above the anchored intermediate).
- Bump h2 to 0.6.1 (OTP 29 deprecated-catch fix).
Full changelog: https://github.com/benoitc/hackney/blob/master/NEWS.md
hackney 4.0.2
Bug-fix release. Drop-in upgrade from 4.0.1, no API changes.
Bug Fixes
- Fix an intermittent pool crash when a server closes a pooled keep-alive connection during checkout (#850). The checkout now tolerates the
set_ownerrace and falls through to a fresh connection instead of crashing on a bad match, and an async ownership handoff to an already-closed pooled connection stops it promptly so the pool drops it from rotation. - Expose
hackney:body/1,2andhackney:stream_body/1again so the response body can be read afterstart_response/1in streaming body mode (#849). The migration guide and examples referenced these but they were not exported. The getting-started guide and README were corrected as well.
Full changelog: https://github.com/benoitc/hackney/blob/master/NEWS.md
hackney 4.0.1
Security release. Fixes 9 reported vulnerabilities (4 high, 4 medium, 1 low) plus one hardening change across the HTTP/1.1, HTTP/2, HTTP/3, WebSocket, cookie and URL handling code. No API changes, so it is a drop-in upgrade from 4.0.0.
If you use hackney directly or through a library (HTTPoison, Tesla's hackney adapter, ExAws, and others), please upgrade.
Security
High
- CVE-2026-47066 (GHSA-6cp8): infinite loop in the Alt-Svc response parser.
- CVE-2026-47073 (GHSA-q8jg): unbounded WebSocket frame, message and handshake buffers.
- CVE-2026-47074 (GHSA-jq4m): slow-drip OOM on buffered HTTP/3 responses.
- CVE-2026-47071 (GHSA-gp9c): missing timeout on a proxy TLS upgrade.
Medium
- CVE-2026-47076 (GHSA-pj7v): SSRF allowlist bypass via percent-encoded host.
- CVE-2026-47072 (GHSA-f9vr): CR/LF injection in the WebSocket upgrade request.
- CVE-2026-47075 (GHSA-j9wq): CR/LF injection in the request target.
- CVE-2026-47070 (GHSA-h73q): cross-origin HTTP/3 redirect leaked Authorization and Cookie.
Low
- CVE-2026-47069 (GHSA-mp55): CR/LF injection via cookie domain and path options.
Hardening
to_atom/1no longer falls back tolist_to_atom/1, removing an atom-leak path (GHSA-6rmf, no CVE assigned).
Dependencies
- Bump quic to 1.4.3.
- Bump h2 to 0.6.0.
Credits
Thanks to PJUllrich, Ganbagana and tepel-chen for the reports, and to maennchen for coordinating disclosure.
Full changelog: https://github.com/benoitc/hackney/blob/master/NEWS.md
hackney 4.0.0
Hackney 4 trims the client down. The HTTP/2 and HTTP/3 stacks are now delegated to erlang_h2 and erlang_quic, so hackney no longer ships its own framing, HPACK / QPACK codecs, control streams or state machines. The HTTP/3 path is fully RFC 9114 compliant via quic_h3, with ALPN negotiation, Alt-Svc discovery (RFC 7838), and the same hackney:request/5 API as HTTP/1.1.
The bundled metrics subsystem is gone. In its place a Go-style middleware chain runs around hackney:request/1..5, configured per request with {middleware, [Fun, ...]} or globally via application:set_env(hackney, middleware, [...]). Users plug in prometheus, telemetry or anything else without hackney owning the policy. See the Middleware Guide and the HTTP/3 Guide.
Breaking
- Removed
hackney_metrics,hackney_metrics_backend,hackney_metrics_prometheus,hackney_metrics_dummy. Themetrics_backendapp env is no longer read. Migration recipes for prometheus and telemetry are inguides/middleware.md. Pool state is still observable throughhackney_pool:get_stats/1. - HTTP/2 and HTTP/3 low-level message tags and modules moved to the new libraries. The user-facing
hackney:request/5API is unchanged.
What's new
- Middleware chain (
hackney_middleware): outermost-first composition, request rewrite, response rewrite, short-circuit, per-request or global config. - HTTP/3 via
quic_h3: pure Erlang QUIC stack, no NIFs. ALPN-negotiated, opt-in with{protocols, [http3, http2, http1]}orapplication:set_env(hackney, default_protocols, [http3, http2, http1]). - Alt-Svc auto-discovery: server
Alt-Svcheaders are now parsed and cached on every response (HTTP/1.1, HTTP/2 and HTTP/3), so subsequent requests can upgrade to HTTP/3 transparently. Honorsclearand merges multipleAlt-Svcheaders per RFC 7230 §3.2.2. - HTTP/2 connection-pooling stability fixes for sustained concurrent load (#836).
Deps
h20.4.0quic1.0.0
Full changelog: https://github.com/benoitc/hackney/blob/4.0.0/NEWS.md
3.2.1
3.2.0
Refactor
- Replace all cowlib modules with hackney-native implementations
- Remove
src/libs/directory (all modules moved tosrc/)
Performance
- HTTP/2 state machine optimizations:
- Stream caching for recently accessed streams
- gb_sets for lingering streams (O(log N) vs O(N) lookups)
- IOList accumulation for header fragments
- HPACK and QPACK header compression with O(1) static table lookups
- WebSocket: use
rand:bytes/1instead ofcrypto:strong_rand_bytes/1for mask keys
Added
- h2spec HTTP/2 compliance testing (95% pass rate - 139/146 tests)
h2spec_server.erl: Minimal HTTP/2 server for compliance testingh2spec_SUITE.erl: CT suite for running h2spec tests- Makefile target:
make h2spec-test
- HTTP/3 E2E tests against real servers
hackney_http3_e2e_SUITE.erl: Tests against Cloudflare, Google, quic.tech- Makefile targets:
make http3-e2e-test,make all-e2e-test
- HTTP/2 machine benchmarks (
hackney_http2_machine_bench.erl)
Bug Fixes
- Fix HTTP/2 flow control for body sending (use
send_or_queue_data/4) - Fix async 204/304/HEAD responses not sending
donemessage - Fix unknown HTTP/2 frame types not being ignored (RFC 7540 4.1)
- Fix HTTP/2 frame size validation
3.1.2
3.1.1
Bug Fixes
- Fix HTTP/3 Fin flag handling for HEAD requests and responses without body
- Bump
quicdependency to 0.7.1 (fixes packet number reconstruction)
Added
- Add TLS options support in
hackney_quic(verify, cacerts, cacertfile, SNI) - Add redirect following in
hackney_h3(follow_redirect, max_redirect options) - Add HTTP/3 integration and redirect test suites (36 new tests)