If a user makes use of `Body::is_end_stream` to optimize so as to not
need to do make a final poll just to receive `None`, previously the
connection would not have progressed its reading state to a finished
body, and so the connection would be closed.
Now, upon reading any chunk, the connection state will check if it
can know that the body would be finished, and progresses to a body
finished state sooner.
The integration tests were amplified by adding a naive hyper proxy
as a secondary test, which happens to make use of that optimization,
and thus caught the issue.
Update client connector to attempt a parallel connection using
alternative address family, if connection using preferred address family
takes too long.
Closes: #1316
However, you probably shouldn't use it! It's `doc(hidden)`, since it
isn't the truest pipeline support. Instead, it just prevents flushing
until read buffer has been consumed.
It's only real use is for silly pipeline benchmarks.
If a checkout wins, meaning an idle connection became available before
a connect future completed, instead of just dropping the connect future,
it spawns it into the background executor to allow being placed into
the pool on completion.
While the upgrades feature enabled HTTP upgrades in both and the server and client, and the goal was for `CONNECT` requests to work as well, only the server could use them for `CONNECT`. The `Client` had some specific code rejecting `CONNECT` requests, and this removes it and prepares the `Client` to handle them correctly.
If executing an internal task fails, a new variant of `hyper::Error` is
returned to the user, with improved messaging.
If a non-critical task fails to spawn, it no longer panics, instead just
logging a warning.
Closes#1566
- Add `Body::Kind::H2` to contain the content length of the body.
- Update `Body::content_length` to return the content length if `Body::Kind` is `H2`, instead of returning `None`.
Reference: #1556, #1557Closes#1546
- Adds `Body::on_upgrade()` that returns an `OnUpgrade` future.
- Adds `hyper::upgrade` module containing types for dealing with
upgrades.
- Adds `server::conn::Connection::with_upgrades()` method to enable
these upgrades when using lower-level API (because of a missing
`Send` bound on the transport generic).
- Client connections are automatically enabled.
- Optimizes request parsing, to make up for extra work to look for
upgrade requests.
- Returns a smaller `DecodedLength` type instead of the fatter
`Decoder`, which should also allow a couple fewer branches.
- Removes the `Decode::Ignore` wrapper enum, and instead ignoring
1xx responses is handled directly in the response parsing code.
Ref #1563Closes#1395
Automatically removes "connection" headers before sending over HTTP2.
These headers are illegal in HTTP2, and would otherwise cause errors.
Closes: #1551
When getting a `Body` from hyper, such as in a client response,
the method `Body::content_length()` now returns a value if the header
was present.
Closes#1545
- In the higher-level `Server` API, since connection upgrades aren't yet
supported, returning a 2xx response to a `CONNECT` request is a user
error. A 500 response is written to the client, the connection is
closed, and an error is reported back to the user.
- In the lower-level `server::Connection` API, where upgrades *are*
supported, a 2xx response correctly marks the response as the final
one, instead of trying to parse more requests afterwards.
- The `cause2` method adds a `'static` bound, allowing to downcast the error type.
- The `into_cause` method converts an `Error` into its optional cause.
Closes#1542