0_13_0.md

doc/release_notes/0_13_0.md
Last Update: 2024-12-18 13:38:28 +0000

0.13.0

Features

Upgrade plugin

A new plugin, :upgrade, is now available. This plugin allows one to “hook” on HTTP/1.1’s protocol upgrade mechanism (see: developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism), which is the mechanism that browsers use to initiate websockets (there is an example of how to use httpx to start a websocket client connection in the tests)

You can read more about the :upgrade plugin in the wiki.

It’s the basis of two plugins:

:h2c

This plugin was been rewritten on top of the :upgrade plugin, and handles upgrading a plaintext (non-“https”) HTTP/1.1 connection, into an HTTP/2 connection.

os85.gitlab.io/httpx/wiki/Connection-Upgrade#h2c

:upgrade/h2

This plugin handles when a server responds to a request with an Upgrade: h2 header, does the following requests to the same origin via HTTP/2 prior knowledge (bypassing the necessity for ALPN negotiation, which is the whole point of the feature).

os85.gitlab.io/httpx/wiki/Connection-Upgrade#h2

:addresses option

The :addresses option is now available. You can use it to pass a list of IPs to connect to:

# will not resolve example.com, and instead connect to one of the IPs passed.
HTTPX.get("http://example.com", addresses: %w[172.5.3.1 172.5.3.2]))

You should also use it to connect to HTTP servers bound to a UNIX socket, in which case you’ll have to provide a path:

HTTPX.get("http://example.com", transport: "unix", addresses: %w[/path/to/usocket]))

The :transport_options are therefore deprecated, and will be moved in a major version.

Improvements

Some internal improvements that allow certain plugins not to “leak” globally, such as the :compression plugin, which used to enable compression for all the httpx sessions from the same process. It doesn’t anymore.

Using exceptionless nonblocking connect calls in the supported rubies.

Removed unneeded APIs around the Options object (with_ methods, or the defined options list).

Bugfixes

HTTP/1.1 persistent connections were closing after each request after the max requests was reached. It’s fixed, and the new connection will also be persistent.

When passing open IO objects for origins (the :io option), httpx was still trying to resolve the origin’s domain. This not only didn’t make sense, it broke if the domain is unresolvable. It has been fixed.

Fixed usage of :io option when passed an “authority/io” hash.

Fixing some issues around trying to connnect to the next available IPAddress when the previous one was unreachable or ETIMEDOUT.