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>
* refactor: Use async/await in client.rs
* refactor: Simplify client.rs a bit more
* refactor: Allow !Unpin in Lazy
* Remove some impl Future
* Remove some combinator use
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`.
- Placed all cases of "unexpected bytes" errors into the
`UnexpectedMessage` variant.
- Placed all cases of "unexpected EOF" errors into the
`IncompleteMessage` variant. Description is now generic about
"connection closed before message completed", instead of mentioning
"request" or "response.
- Added `Error::is_incomplete_message()` accessor to help checking for
unexpected closures.
- Renamed some variants to be clearer when viewing the `Debug` format.
- Collected all "user" errors into an internal `User` enum, to prevent
forgetting to update the `is_user()` method.
**The `Error` is now an opaque struct**, which allows for more variants to
be added freely, and the internal representation to change without being
breaking changes.
For inspecting an `Error`, there are several `is_*` methods to check for
certain classes of errors, such as `Error::is_parse()`. The `cause` can
also be inspected, like before. This likely seems like a downgrade, but
more inspection can be added as needed!
The `Error` now knows about more states, which gives much more context
around when a certain error occurs. This is also expressed in the
description and `fmt` messages.
**Most places where a user would provide an error to hyper can now pass
any error type** (`E: Into<Box<std::error::Error>>`). This error is passed
back in relevant places, and can be useful for logging. This should make
it much clearer about what error a user should provide to hyper: any it
feels is relevant!
Closes#1128Closes#1130Closes#1431Closes#1338
BREAKING CHANGE: `Error` is no longer an enum to pattern match over, or
to construct. Code will need to be updated accordingly.
For body streams or `Service`s, inference might be unable to determine
what error type you mean to return. Starting in Rust 1.26, you could
just label that as `!` if you never return an error.
If a request sees an error on a pooled connection before ever writing
any bytes, it will now retry with a new connection.
This can be configured with `Config::retry_canceled_requests(bool)`.
Currently, if the remote closes the connection at the same time that the
pool selects it to use for a new request, the connection may actually
hang. This fix will now more allow the keep-alive read to check the
socket even when the `Conn` think it's busy.
If the connection was closed before the request write happened, returns
back an `Error::Cancel`, letting the user know they could safely retry
it.
Closes#1439