Adds utility functions to `hyper::body` to help asynchronously
collecting all the buffers of some `HttpBody` into one.
- `aggregate` will collect all into an `impl Buf` without copying the
contents. This is ideal if you don't need a contiguous buffer.
- `to_bytes` will copy all the data into a single contiguous `Bytes`
buffer.
Instead of returning a tuple `(impl AsyncRead + AsyncWrite, Connected)`,
this adds a new trait, `hyper::client::connect::Connection`, which
allows querying the connection type for a `Connected`.
BREAKING CHANGE: Connectors no longer return a tuple of
`(T, Connected)`, but a single `T: Connection`.
The `hyper::body::HttpBody` trait is a re-export from the `http-body`
crate. This allows libraries to accept "HTTP bodies" without needing to
depend on hyper.
BREAKING CHANGE: All usage of `hyper::body::Payload` should be replaced
with `hyper::body::HttpBody`.
Allows `local_addr` to work for any executor type, rather than just the default `Exec`. The
underlying `SpawnAll::local_addr()` is already similarly general, so no other changes are needed
other than adding the extra type parameter to the `impl`.
The `hyper::rt::Executor` trait allows defining custom executors to be
used with hyper's `Client` and `Server`.
Closes#1944
BREAKING CHANGE: Any type passed to the `executor` builder methods must
now implement `hyper::rt::Executor`.
`hyper::rt::spawn` usage should be replaced with `tokio::task::spawn`.
`hyper::rt::run` usage should be replaced with `#[tokio::main]` or
managing a `tokio::runtime::Runtime` manually.
It is not possible to connect to an IPv4 address from an IPv6 address or
vice-versa so don't waste time trying. If no remote addresses match then a
"missing connect error" will now occur.
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>`.
The only important trait for a user is the `tower::Service` trait, which
is now available also at `hyper::service::Service`. The other "trait
aliases" are no longer publicly exported, as people thought they had to
implement them.
Also removes dependency on `tower-make`, which is trivial but otherwise
shouldn't affect anyone.
Closes#1959
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.