This removes the following types and methods from hyper:
- `Client`
- `Error::is_connect()`
BREAKING CHANGE: A pooling client is in the hyper-util crate.
This removes the `tcp` feature from hyper's `Cargo.toml`, and the code it enabled:
- `HttpConnector`
- `GaiResolver`
- `AddrStream`
And parts of `Client` and `Server` that used those types. Alternatives will be available in the `hyper-util` crate.
Closes#2856
Co-authored-by: MrGunflame <mrgunflame@protonmail.com>
An HTTP/2 stream may include a set of headers, and a flag signalling
END-STREAM, even if a `content-length` isn't included. hyper wouldn't
notice, and so the `Body` would report a size-hint of `0..MAX`. hyper
now notices that the stream is ended, and couldn't possibly include any
bytes for the body, and thus will give a size-hint of `0` exactly.
Move state required for protocol upgrades to head
representations, instead of associating it with the body.
Closes#2340.
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
cc #2223
BREAKING CHANGE: The HTTP server code is now an optional feature. To
enable the server, add `features = ["server"]` to the dependency in
your `Cargo.toml`.
cc #2223
BREAKING CHANGE: The HTTP client of hyper is now an optional feature. To
enable the client, add `features = ["client"]` to the dependency in
your `Cargo.toml`.
cc #2251
BREAKING CHANGE: This puts all HTTP/1 methods and support behind an
`http1` cargo feature, which will not be enabled by default. To use
HTTP/1, add `features = ["http1"]` to the hyper dependency in your
`Cargo.toml`.
cc #2251
BREAKING CHANGE: This puts all HTTP/2 methods and support behind an
`http2` cargo feature, which will not be enabled by default. To use
HTTP/2, add `features = ["http2"]` to the hyper dependency in your
`Cargo.toml`.
A stream wrapped into a Body previously needed to implement `Sync` so
that the Body type implements this autotrait as well (which is needed
due to limitations in async/await). Since a stream only offers one
method that is called with an exclusive reference, this type is
statically proven to be Sync already. In theory it should be fine to add
an `unsafe impl Sync`, but this commit instead adds a SyncWrapper to
enlist the compiler’s help in proving that this is (and remains) correct.
This makes it easier to construct response bodies for client code.
This adds HTTP2 keep-alive support to client and server connections
based losely on GRPC keep-alive. When enabled, after no data has been
received for some configured interval, an HTTP2 PING frame is sent. If
the PING is not acknowledged with a configured timeout, the connection
is closed.
Clients have an additional option to enable keep-alive while the
connection is otherwise idle. When disabled, keep-alive PINGs are only
used while there are open request/response streams. If enabled, PINGs
are sent even when there are no active streams.
For now, since these features use `tokio::time::Delay`, the `runtime`
cargo feature is required to use them.
This adds support for calculating the Bandwidth-delay product when using
HTTP2. When a DATA frame is received, a PING is sent to the remote.
While the PING acknoledgement is outstanding, the amount of bytes of all
received DATA frames is accumulated. Once we receive the PING
acknowledgement, we calculate the BDP based on the number of received
bytes and the round-trip-time of the PING. If we are near the current
maximum window size, the size is doubled.
It's disabled by default until tested more extensively.
Before, if a client request included an `Expect: 100-continue` header,
the `100 Continue` response was sent immediately. However, this is
problematic if the service is going to reply with some 4xx status code
and reject the body.
This change delays the automatic sending of the `100 Continue` status
until the service has call `poll_data` on the request body once.
When the body type of a `Request` or `Response` implements `HttpBody`,
the `Request` or `Response` itself now implements `HttpBody`.
This allows writing things like `hyper::body::aggregate(req)` instead of
`hyper::body::aggregate(req.into_body())`.
Closes#2067
The previous version is renamed to `try_send_data`.
BREAKING CHANGE: Usage of `send_data` should either be changed to
async/await or use `try_send_data`.
These tests were temporarily disabled during the migration to the
`std::future::Future` type that's part of the stable Rust now.
This commit updates the tests after the breaking changes and makes them
pass again.