this is achieved by a rework of the upgrade plugin, and the addition of
an h2 upgrade plugin. The idea is the following: if a response carries
an Upgrade header, and there's a handler for it, we should go for it.
The difference is:
* when the response is 101, this means that the negotiation must take
place before the actual response comes in;
* when the response is 200, upgrading means reconnecting to the channel,
and assume the new protocol for subsequent requests only.
server not being processed
While introducing yet another test to catch frame processing errors, in
this case with the SETTINGS_TIMEOUT error, another loop was found. It
was caused by two reasons:
* connection was signaling it was "closing" on such an error, which is
not really true (server already closed the stream, so no need to
close it again); it should be marked as closed instead.
* write buffer was still full (with the handshake in this case), so the
connection was still trying to write;
While adding the test, the code to recover from an exhausted HTTP/1.1
connection proved not to be reliable, as it wasn't taking inflight
requests nor update-once keep-alive max requests counters into
account.
This has been fixed by implementing our own test dummy using
webrick.
While adding a test, a bug was found, where an HTTP/2 connection
receiving a 421 response wasn't redirecting the request well to an
HTTP/1.1 one. This has been fixed by changing the way a new connection
is instantiated.
When persistent and retries are loaded separately, the options won't be
just overwritten; instead, changes will be kept, and max_retries will be
the max value of what both plugins load (in case the user sets its own
option)
header;
this was wrongly closing connections for HTTP/1.1 connections which
didn't send a "Connection" header; according to spec, the default is
"Keep-Alive", contrary to HTTP/1.0
This logic was extracted from the vanilla httpx build to a plugin to
make the gem "leaner", by removing "http_form_data" as a hard
dependency.
The multipart plugin still requires one to install it though, but if you
don't need to upload files, you don't have to install the gem anymore