[ANN] httpx 0.12.0 released

httpx 0.11.0 has been released.

HTTPX.get("HoneyryderChuck / httpx · GitLab
<HoneyryderChuck / httpx · GitLab>")

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), 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

These are the announcements since the last update:

# 0.12.0

## Features

### AWS Sigv4 Authentication Plugin

A new plugin, `:aws_sigv4`, is now shipped with `httpx`. It implements the
[AWS Signature Version 4 request signing process](
Signature Version 4 signing process - AWS General Reference), a
well documented way of authenticating requests to AWS services, which has
since been adopted by other cloud providers, such as Google Cloud Storage.

See how to use it here:

For convenience, there's a derivative plugin, `:aws_sdk_authentication`,
which builds on top of `:aws_sigv4`, and integrates with the `aws-sdk-core`
gem, maintained by AWS, to resolve the authentication credentials (p.ex. if
you support ephemeral access keys).

See how to use it here:

Other FAQ: AWS Sigv4 · Wiki · HoneyryderChuck / httpx · GitLab

### HTTP/2 support for JRuby

`jruby-openssl` doesn't support ALPN protocol negotiation, nor are there
plans to implement, which limited the seamless HTTP/2 usage in `httpx`. A
new connection adapter was therefore added specifically for JRuby, where
ssl/tls connections will be handled using ffi-based openssl bindings,
provided you bundle `ffi-compiler` and `concurrent-ruby`, and install a
TLS/1.2-compatible `openssl` package.

See how to use it here:

## Improvements

### truffleruby support

`httpx` supports and tests against `truffleruby` (known to run tests since
v20.3, passing all tests since v21).

### Performance

Several optimizations were introduced:

* Reduction in read/write system calls;
* more usage of `String#byteslice` in parsing (instead of string mutation);
* Avoid selection on connections with no outstanding requests;

They all contributed to a massive performance improvement, itself reflected
in test runs, which need half the time they used to to complete.

### APIs

* `HTTPX::ErrorResponse#to_s` now uses the exception full message, instead
of just the backtrace.

## Bugfixes

* HTTP/2 stream protocol errors do not cause the process to hang (instead,
error responnses are yielded);
* Fixed body stream bugs on retries when error causing retry would happen
* Fixed `:multipart` plugin body rewind on retries to start the transfer
from the beginning;
* Fixed auto-load of `:proxy` plugin when `HTTPS_PROXY` or `HTTP_PROXY` is
* Errno::EPIPE errors mid transfer now cause `httpx` to read from the
server and get the appropriate HTTP error response;
* Make sure that all requests have an error responnse if the error happens
* Fixed TCP handshake Errno::INPROGRESS handling inside TLS connnections,
which was causing the process to hang in a high handshake contention
* Do not call the event loop if there's nothing to listen on (the DoH
resolver was being listened on even if there was nothing to be request);
* Fixed double event registry for DoH resolvers;

# 0.11.3

## Bugfixes

`EOFError` was being thrown when HTTP/1.1 non-chunked responses which don't
contain a "content-length" header. The RFC mandates that the socket should
be consumed until the server closes it, so a patch was implemented, to
return the available response in such cases.

# 0.11.2

## Bugfixes

The `:cookies` plugin wasn't able to parse `Expires` values, as it was
using `Time.httpdate` to parse timestamps, which is RFC 2616-compliant,
whereas cookies datetime values need to be RFC 6265-compliant.

# 0.11.1

## Bugfixes

Fixed a bug related to the `:compression` plugin trying to process a last
empty DATA frame from an HTTP/2 response, after it had been closed.