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:
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.
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).
: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[126.96.36.199 188.8.131.52]))
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]))
:transport_options are therefore deprecated, and will be moved in a major version.
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).
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
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.