0_19_0.md

doc/release_notes/0_19_0.md
Last Update: 2024-11-19 13:02:02 +0000

0.19.0

Features

Happy Eyeballs v2

When the system supports dual-stack networking, httpx implements the Happy Eyeballs v2 algorithm (RFC 8305) to resolve hostnames to both IPv6 and IPv4 addresses while privileging IPv6 connectivity. This is implemented by httpx both for the :native as well as the :https (DoH) resolver (which do not perform address sorting, thereby being “DNS-based load-balancing” friendly), and “outsourced” to getaddrinfo when using the :system resolver.

IPv6 connectivity will also be privileged for /etc/hosts local DNS (i.e. localhost connections will connec to ::1).

A new option, :ip_families, will also be available ([Socket::AF_INET6, Socket::AF_INET] in dual-stack systems). If you’d like to i.e. force IPv4 connectivity, you can do use it (client = HTTPX.with(ip_families: [Socket::AF_INET])).

Improvements

DNS: :system resolver uses getaddrinfo (instead of the resolver lib)

The :system resolver switched to using the getaddinfo system function to perform DNS requests. Not only is this call not blocking the session event loop anymore (unlike pre-0.19.0 :system resolver), it adds a lot of functionality that the stdlib resolv library just doesn’t support at the moment (such as SRV records).

HTTP/2 proxy support

The :proxy plugin handles “prior-knowledge” HTTP/2 proxies.

HTTPX.plugin(:proxy, fallback_protocol: "h2").with_proxy(uri: "http://http2-proxy:3128").get(...

Connection coalescing has also been enabled for proxied connections (also CONNECT-tunneled connections).

curl-to-httpx

widget in project website to turn curl commands into the equivalent httpx code.

Bugfixes

  • faraday adapter now supports passing session options.

  • proxy: several fixes which enabled env-var (HTTP(S)_PROXY) defined proxy support.

  • proxy: fixed graceful recovery from proxy tcp connect errors.

  • several fixes around CNAMEs timeouts with the native resolver.

  • https resolver is now closed when wrapping session closes (it was left open).