httpx 1.4.0 has been released.
HTTPX.get("https://gitlab.com/honeyryderchuck/httpx
<https://gitlab.com/honeyryderchuck/httpx>")
HTTPX is an HTTP client library for the Ruby programming language.
Among its features, it supports:
* HTTP/2 and HTTP/1.x protocol versions
* Concurrent requests by default
* Simple and chainable API
* Proxy Support (HTTP(S), CONNECT tunnel, Socks4/4a/5)
* Simple Timeout System
* Lightweight by default (require what you need)
And also:
* Compression (gzip, deflate, brotli)
* Streaming Requests
* Authentication (Basic Auth, Digest Auth, AWS Sigv4)
* Expect 100-continue
* Multipart Requests
* Cookies
* HTTP/2 Server Push
* H2C Upgrade
* Automatic follow redirects
* International Domain Names
* GRPC
* Circuit breaker
* WebDAV
* SSRF Filter
* Datadog integration
* Faraday integration
* Webmock integration
* Sentry integration
Here are the updates since the last release:
# 1.4.0
## Features
### `:content_digest` plugin
The `:content_digest` can be used to calculate the digest of request
payloads and set them in the `"content-digest"` header; it can also
validate the integrity of responses which declare the same
`"content-digest"` header.
More info under Content Digest ยท honeyryder
## Per-session connection pools
This architectural changes moves away from per-thread shared connection
pools, and into per-session (also thread-safe) connection pools. Unlike
before, this enables connections from a session to be reused across
threads, as well as limiting the number of connections that can be open on
a given origin peer. This fixes long-standing issues, such as reusing
connections under a fiber scheduler loop (such as the one from the gem
`async`).
A new `:pool_options` option is introduced, which can be passed an hash
with the following sub-options:
* `:max_connections_per_origin`: maximum number of connections a pool
allows (unbounded by default, for backwards compatibility).
* `:pool_timeout`: the number of seconds a session will wait for a
connection to be checked out (default: 5)
More info under
https://honeyryderchuck.gitlab.io/httpx/wiki/Connection-Pools
## Improvements
* `:aws_sigv4` plugin: improved digest calculation on compressed request
bodies by buffering content to a tempfile.
* `HTTPX::Response#json` will parse payload from extended json MIME types
(like `application/ld+json`, `application/hal+json`, ...).
## Bugfixes
* `:aws_sigv4` plugin: do not try to rewind a request body which yields
chunks.
* fixed request encoding when `:json` param is passed, and the `oj` gem is
used (by using the `:compat` flag).
* native resolver: on message truncation, bubble up tcp handshake errors as
resolve errors.
* allow `HTTPX::Response#json` to accept extended JSON mime types (such as
responses with `content-type: application/ld+json`)
## Chore
* default options are now fully frozen (in case anyone relies on overriding
them).
### `:xml` plugin
XML encoding/decoding (via `:xml` request param, and `HTTPX::Response#xml`)
is now available via the `:xml` plugin.
Using `HTTPX::Response#xml` without the plugin will issue a deprecation
warning.
# 1.3.4
## Bugfixes
* webmock adapter: fix tempfile usage in multipart requests.
* fix: fallback to binary encoding when parsing incoming invalid charset in
HTTP "content-type" header.
# 1.3.3
## Bugfixes
* fixing a regression introduced in 1.3.2 associated with the webmock
adapter, which expects matchable request bodies to be strings
# 1.3.2
## Bugfixes
* Prevent `NoMethodError` in an edge case when the `:proxy` plugin is
autoloaded via env vars and webmock adapter are used in tandem, and a real
request fails.
* raise invalid uri error if passed request uri does not contain the host
part (ex: `"https:/get"`)
# 1.3.1
## Improvements
* `:request_timeout` will be applied to all HTTP interactions until the
final responses returned to the caller. That includes:
* all redirect requests/responses (when using the `:follow_redirects`
plugin)
* all retried requests/responses (when using the `:retries` plugin)
* intermediate requests (such as "100-continue")
* faraday adapter: allow further plugins of internal session (ex:
`builder.adapter(:httpx) { |sess| sess.plugin(:follow_redirects) }...`)
## Bugfixes
* fix connection leak on proxy auth failed (407) handling
* fix busy loop on deferred requests for the duration interval
* do not further enqueue deferred requests if they have terminated
meanwhile.
* fix busy loop caused by coalescing connections when one of them is on the
DNS resolution phase still.
* faraday adapter: on parallel mode, skip calling `on_complete` when not
defined.