1_1_0.md

doc/release_notes/1_1_0.md
Last Update: 2024-04-03 14:03:54 +0000

1.1.0

Features

A function, #peer_address, was added to the response object, which returns the IP (either a string or an IPAddr object) from the socket used to get the response from.

response = HTTPX.get("https://example.com")
response.peer_address #=> #<IPAddr: IPv4:93.184.216.34/255.255.255.255>

error responses will also expose an IP address via #peer_address as long a connection happened before the error.

Improvements

  • A performance regression involving the new default timeouts has been fixed, which could cause significant overhead in “multiple requests in sequence” scenarios, and was clearly visible in benchmarks.

  • this regression will still be seen in jruby due to a bug, which fix will be released in jruby 9.4.5.0.

  • HTTP/1.1 connections are now set to handle as many requests as they can by default (instead of the past default of max 200, at which point they’d be recycled).

  • tolerate the inexistence of openssl in the installed ruby, like net-http does.

  • on_connection_opened and on_connection_closed will yield the OpenSSL::SSL::SSLSocket instance for https backed origins (instead of always the Socket instance).

Bugfixes

  • when using the :native resolver (default option), a default of 1 for ndots is set, for systems which do not set one.

  • replaced usage of Float::INFINITY with nil for timeout defaults, as the former can’t be used in IO wait functions.

  • faraday adapter timeout setup now maps to :read_timeout and :write_timeout options from httpx.

  • fixed HTTP/1.1 connection recycling on number of max requests exhausted.

  • response.json will now work when “content-type” header is set to “application/hal+json”.

Chore

  • when using the :cookies plugin, a warning message to install the idnx message will only be emitted if the cookie domain is an IDN (this message was being shown all the time since v1 release).