Closes#1903
BREAKING CHANGE: The `Resolve` trait is gone. All custom resolves should
implement `tower::Service` instead.
The error type of `HttpConnector` has been changed away from
`std::io::Error`.
The `Connect` trait is now essentially an alias for
`Service<Destination>`, with a blanket implementation as such, and is
sealed.
Closes#1902
BREAKING CHANGE: Any manual implementations of `Connect` must instead
implement `tower::Service<Destination>`.
Detecting a read hangup is a useful way to determine that a connection
has closed. It's also possible that a client shuts down its read half
without closing the connection, but this is rarer. Thus, by default,
hyper will now assume a read EOF means the connection has closed.
BREAKING CHANGE: The server's behavior will now by default close
connections when receiving a read EOF. To allow for clients to close
the read half, call `http1_half_close(true)` when configuring a
server.
The `Accept` trait is used by the server types to asynchronously accept
incoming connections. This replaces the previous usage of `Stream`.
BREAKING CHANGE: Passing a `Stream` to `Server::builder` or
`Http::serve_incoming` must be changed to pass an `Accept` instead. The
`stream` optional feature can be enabled, and the a stream can be
converted using `hyper::server:🉑:from_stream`.
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.
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.
- 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::source()` is searched for an `h2::Error` to allow sending
different error codes in the GOAWAY. If none is found, it defaults to
`INTERNAL_ERROR`.
This option determines whether a read EOF should close the connection
automatically. The behavior was to always allow read EOF while waiting
to respond, so this option has a default of `true`.
Setting this option to `false` will allow Service futures to be canceled
as soon as disconnect is noticed.
Closes#1716
If the Response was received and the body finished while the Request
body was still streaming, the connection could get into a state where it
was never polled again, thus never re-inserting into the connection pool
or being dropped.
Closes#1717
- Adds `Connected::negotiated_h2()` method to signal the connection must
use HTTP2. `Connect` implementations should set this if using ALPN.
If a connection to a host is detected to have been upgraded via ALPN,
any other oustanding connect futures will be canceled, and the waiting
requests will make use of the single HTTP2 connection.
The `http2_only` builder configuration still works the same, not
requiring ALPN at all, and always using only a single connection.
This introduces a `Resolve` trait to describe asynchronous DNS
resolution. The `HttpConnector` can be configured with a resolver,
allowing a user to still use all the functionality of the
`HttpConnector`, while customizing the DNS resolution.
To prevent a breaking change, the `HttpConnector` has its `Resolve`
generic set by default to `GaiResolver`. This is same as the existing
resolver, which uses `getaddrinfo` inside a thread pool.
Closes#1517
- Adds `client::connect::Connected::extra()`, which allows connectors to
specify arbitrary custom information about a connected transport.
If a connector provides this extra value, it will be set in the
`Response` extensions.
Closes#1402
Change behaviour of connection or server response when the request is
version 1.0 and the Connection: keep-alive header is not present.
1. If the response is also version 1.0, then connection is closed if the
server keep-alive header is not present.
2. If the response is version 1.1, then the keep-alive header is added
when downgrading to version 1.0.
Closes#1614