0.22.3¶ ↑
Features¶ ↑
HTTPX::Response::Body#filename
¶ ↑
A new method, .filename
can be called on response bodies, to get the filename referenced by the server for the received payload (usually in the “Content-Disposition” header).
response = HTTPX.get(url) response.raise_for_status filename = response.body.filename # you can do, for example: response.body.copy_to("/home/files/#{filename}")
Improvements¶ ↑
Loading integrations by default¶ ↑
Integrations will be loaded by default, as long as the dependency being integrated is already available:
require "ddtrace" require "httpx" HTTPX.get(... # request will be traced via the datadog integration
Faraday: better error handling¶ ↑
The faraday
adapter will not raise errors anymore, when used in parallel mode. This fixes the difference in behaviour with the equivalent typhoeus
parallel adapter, which does not raise errors in such cases as well. This behaviour will exclude 4xx and 5xx HTTP responses, which will not be considered errors in the faraday
adapter.
If errors occur in parallel mode, these’ll be available in env[:error]
. Users can check it in two ways:
response.status == 0 # or !response.env[:error].nil?
Bugfixes¶ ↑
-
unix socket: handle the error when the path for the unix sock is invalid, which was causing an endless loop.
IPv6 / Happy eyeballs v2¶ ↑
-
the
native
resolver will now use IPv6 nameservers with zone identifier to perform DNS queries. This bug was being ignored prior to ruby 3.1 due to some pre-filtering on the nameservere which were covering misuse of theuri
dependency for this use case. -
Happy Eyeballs v2 handshake error on connection establishment for the first IP will now ignore it, in case an ongoing connecting for the second IP is happening. This fixes a case where both IPv4 and IPv6 addresses are served for a given domain, but only one of them can be connected to (i.e. if connection via IPv6 fails, the IPv4 one should still proceed to completion).
-
the
native
resolver won’t try querying DNS name candidates, if the resolver sends an empty answer with an error code different from “domain not found”. -
fix error of Happy Eyeballs v2 handshake, where the resulting connection would coalesce with an already open one for the same IP before requests were merged to the coalesced connection, resulting in no requests being sent and the client hanging.
Chore¶ ↑
-
fixed error message on wrong type of parameter for the
compression_threshold_size
option from the:compression
plugin.