[ANN] httpx 0.13.0 released

httpx 0.13.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

# 0.13.0

## Features

### Upgrade plugin

A new plugin, `:upgrade`, is now available. This plugin allows one to
"hook" on HTTP/1.1's protocol upgrade mechanism (see:
Protocol upgrade mechanism - HTTP | MDN),
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](
test/support/requests/plugins/upgrade.rb · master · HoneyryderChuck / httpx · GitLab
))

You can read more about the `:upgrade` plugin in the [wiki](
Connection Upgrade · HTTPX).

It's the basis of two plugins:

#### `:h2c`

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.

https://honeyryderchuck.gitlab.io/httpx/wiki/Connection-Upgrade#h2c

#### `:upgrade/h2`

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

https://honeyryderchuck.gitlab.io/httpx/wiki/Connection-Upgrade#h2

### `:addresses` option

The `: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[172.5.3.1 172.5.3.2]))

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", addresses: %w[/path/to/usocket]))

The `:transport_options` are therefore deprecated, and will be moved in a
major version.

## Improvements

Some internal improvements that allow certainn 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).

## Bugfixes

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 `:io` option), `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.