mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-05 00:02:38 -04:00
59 lines
2.7 KiB
Markdown
59 lines
2.7 KiB
Markdown
# 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: https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism), 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](https://gitlab.com/os85/httpx/-/blob/master/test/support/requests/plugins/upgrade.rb))
|
|
|
|
You can read more about the `:upgrade` plugin in the [wiki](https://os85.gitlab.io/httpx/wiki/Connection-Upgrade).
|
|
|
|
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://os85.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://os85.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:
|
|
|
|
```ruby
|
|
# 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:
|
|
|
|
```ruby
|
|
HTTPX.get("http://example.com", transport: "unix", 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 certain 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.
|