httpx 0.7.0 has been released.
httpx is a client library for making HTTP requests from Ruby. It has a
simple but highly configurable API to perform single and multiple requests
(supports HTTP/2 as well has 1.1 and 1.0). It also supports DNS over HTTPS.
* An error was reported when using the follow plugin allowing insecure
redirects: if the insecure redirect would be for the same host, and the
original request was performed with HTTP/2, the library would try to
coalesce the request, and was blocking the processr. A check was introduced
to ensure that connection only coalesces if both origins are for https
### New option: `:max_requests`.
This is a connection-level option signalizing how many requests can be
performed on a connection, before a new one has to be initiated. Although
the HTTP/1 parser defines this well, in HTTP/2 this wasn't very clear, so:
by definition, the remote MAX_CONCURRENT_STREAMS setting will be used to
set the limit, unless the user explicitly passes the ":max_requests"
option. You can also pass `:max_requests => Float::INFINITY` if you know
that the server allows more requests than that on a connection.
### New plugin: `:expect`.
Although there was support for `expect: 100-continue` header already when
passed, this plugin can:
* automatically set the header on requests with body, and wait for the 100
response before sending it;
* recover from 417 status errors (i.e. try again without the header);
* send body after X seconds if no 100 response came (2 seconds by default);
HTTPX.plugin(:expect, expect_timeout: 6).post(....
### with_* options
Suport for `with_` methods for the session. As long as the suffix is a
valid option, it's just like that:
HTTPX.with_timeout(...).with_ssl(...) # same as: # HTTPX.with(timeout: ..., ssl: ...)
The following improvements on connections make the `persistent` plugin way
* Better balancing of HTTP/2 connections by distributing requests among X
connections depending of how many requests they can process;
* Exhausted connections can off-load to a new same-origin connection (such
as, when the server negotiates less `MAX_CONCURRENT_STREAMS` than what's
(Timeouts will be one of the main priorities from the 0.7.x series)
`:total_timeout` is now a connection-level directive, which means that this
feature will actually make more sense and account for all requests in a
block at the same time, instead of one-by-one. This will make it more
Option setters were being bypassed, therefore a lot of the type-checks
defined weren't effectively being picked upon, which could have led to
weird user errors.
* fixed the `push_promise` plugin integration (wasn't working well since
`http-2-next` was adopted);
Also, test coverage is now 91%.