Update tests that require the server feature to only be compiled when the feature is enabled.
After updating these tests, the server feature is no longer required for the ffi job when
running tests.
Closes#3790
There was a comment in the service_struct_impl.rs example indicating
that the default match arm would somehow return a 404 and not increment
the counter. This wasn't the case. That arm also had a redundant return.
This removes the requirement of the IO type from being `Send` for the
HTTP/1 client connection. To do so, the ability to perform
`hyper::upgrade`s had to be moved to a separate type which does require
the `Send` bound. This mirrors how the server types do it.
The `Connection` type now has a `with_upgrades()` method to convert.
Closes#3363
BREAKING CHANGE: If you use client HTTP/1 upgrades, you must call
`Connection::with_upgrades()` to still work the same.
This replaces the usage of `tokio::io::{AsyncRead, AsyncWrite}` in hyper's public API with new traits in the `hyper::rt` module.
Closes#3110
BREAKING CHANGE: Any IO transport type provided must not implement `hyper::rt::{Read, Write}` instead of
`tokio::io` traits. You can grab a helper type from `hyper-util` to wrap Tokio types, or implement the traits yourself,
if it's a custom type.
Closes#3017
BREAKING CHANGE: `client::conn::http2` types now use another generic for an `Executor`.
Code that names `Connection` needs to include the additional generic parameter.
change Service::call to take &self instead of &mut self.
Because of this change, the trait bound in the service::util::service_fn and
the trait bound in the impl for the ServiceFn struct were changed from FnMut to Fn.
This change was decided on for the following reasons:
- It prepares the way for async fn,
since then the future only borrows &self, and thus a Service can concurrently handle
multiple outstanding requests at once.
- It's clearer that Services can likely be cloned
- To share state across clones you generally need Arc<Mutex<_>>
that means you're not really using the &mut self and could do with a &self
Closes#3040
BREAKING CHANGE: The Service::call function no longer takes a mutable reference to self.
The FnMut trait bound on the service::util::service_fn function and the trait bound
on the impl for the ServiceFn struct were changed from FnMut to Fn.
* docs(examples): update dependencies (#3099)
Tested by dropping this batch of dependencies into a freshly gen'd cargo project and copying in every example in turn and making sure it runs.
* Also some spelling and formatting corrections ❤️
* fix(examples): most examples require --features="full" (#3099)
The `Body` trait was adjusted to be forwards compatible with adding new
frame types. That resulted in changing from `poll_data` and `poll_trailers`
to a single `poll_frame` function. More can be learned from the proposal
in https://github.com/hyperium/hyper/issues/2840.
Closes#3010
BREAKING CHANGE: The polling functions of the `Body` trait have been
redesigned.
The free functions `hyper::body::to_bytes` and `aggregate` have been
removed. Similar functionality is on
`http_body_util::BodyExt::collect`.
The connection types have been split into version-specific types, in the
`server::conn::{http1, http2}` modules.
Closes#3012
BREAKING CHANGE: Either choose a version-specific `Connection` type, or
look for the auto-version type in `hyper-util`.
This removes the dependency on `tower-service`, and simplifies the `Service` trait to be used by hyper's server connections.
Closes#2853
BREAKING CHANGE: Change any manual `impl tower::Service` to implement `hyper::service::Service` instead. The `poll_ready` method has been removed.
Now that the concrete `Body` type has been temporarily replaced with `Recv` in #2966,
we can rename and export `http_body::Body` as just `Body` instead of `HttpBody`.
Closes#2839
BREAKING CHANGE: The trait has been renamed.
The constructors of `hyper::Body` from a full bytes are removed. Along
with `Body::empty()`.
BREAKING CHANGE: Use the types from `http-body-util`.
Co-authored-by: Xuanwo <github@xuanwo.io>
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>
The default Body type is used in the client in a Pool, so it has to be
Send. On the server, we can use a !Send type if the executor is single
threaded.
Expand the existing example to show that.