This adds a `http_body::Body` impl for hypers `Body`. This should
allow us to start moving to a more generic body trait based on
`BufStream` and `http-body`.
- 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
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
This allows a client or server to indicate that the body should be cut off
in an abnormal fashion so the server doesn't simply get a "valid" but
truncated body.