`tower` 0.4.5 introduced `Shared` which is a `MakeService` that produces
services by cloning an inner service. This works quite well with `hyper`
if your service doesn't need the incoming connection and implements
`Clone`.
However that might not be entirely obvious so I thought it made sense to
add an example to the docs.
I wasn't quite sure if the example should go in the server or service
module docs but since there already is an example using
`make_service_fn` in the server docs I opted to add it there. Let me
know if you'd rather have it somewhere else.
* 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
This is required to surface the required feature (`tcp`) in the generated docs
for `hyper::server::conn::{AddrIncoming, AddrStream}`. Before this change,
their docs only mentioned the features needed for the `hyper::server::conn` mod
itself.
Fixes#2425
This adds an internal ability to copy the HTTP/1 reason-phrase and place
it in the `http::Extensions` of a response, if it doesn't match the
canonical reason. This could be exposed in the Rust API later, but for
now it is only used by the C API.
Make it possible to refer to Connected, Connection, HttpConnector, etc.
without enabling either of the http1/http2 features. This makes feature
selection work better for downstream libraries like hyper-openssl, which
don't want to commit to any particular protocol.
Fix#2376.
Previously, hyper returned an "Invalid chunk end CR" error on chunked
responses with trailers, as described in RFC 7230 Section 4.1.2. This
commit adds code to ignore the trailers.
Closes#2171
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>
We use hyper in a proxy-like way where an incoming HTTP/2 request is
proxied to a HTTP/1 backend and it was reported that the protocol
coercion warnings were a limiting factor in the total throughput
of the system.
While it can be worked around by explicitly setting the request version
to HTTP_11, it seems likely other people also hit this performance snag.
That's why this commit changes them from warnings to debug messages.
The DNS resolver part of `HttpConnector` used to require resolving to
`IpAddr`s, and this changes it so that they resolve to `SocketAddr`s.
The main benefit here is allowing for resolvers to set the IPv6 zone ID
when resolving, but it also just more closely matches
`std::net::ToSocketAddrs`.
Closes#1937
BREAKING CHANGE: Custom resolvers used with `HttpConnector` must change
to resolving to an iterator of `SocketAddr`s instead of `IpAddr`s.