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.
Add basic, module level example for the Builder performing a handshake,
spawning a task to run the Connection and sending a single request and
receiving the response.
Closes#2272
Closes#2326
BREAKING CHANGE: hyper no longer emits `log` records automatically.
If you need hyper to integrate with a `log` logger (as opposed to `tracing`),
you can add `tracing = { version = "0.1", features = ["log"] }` to activate them.
Tokio's `AsyncWrite` trait once again has support for vectored writes in
Tokio 0.3.4 (see tokio-rs/tokio#3149).
This branch re-enables vectored writes in Hyper for HTTP/1. Using
vectored writes in HTTP/2 will require an upstream change in the `h2`
crate as well.
I've removed the adaptive write buffer implementation
that attempts to detect whether vectored IO is or is not available,
since the Tokio 0.3.4 `AsyncWrite` trait exposes this directly via the
`is_write_vectored` method. Now, we just ask the IO whether or not it
supports vectored writes, and configure the buffer accordingly. This
makes the implementation somewhat simpler.
This also removes `http1_writev()` methods from the builders. These are
no longer necessary, as Hyper can now determine whether or not
to use vectored writes based on `is_write_vectored`, rather than trying
to auto-detect it.
Closes#2320
BREAKING CHANGE: Removed `http1_writev` methods from `client::Builder`,
`client::conn::Builder`, `server::Builder`, and `server::conn::Builder`.
Vectored writes are now enabled based on whether the `AsyncWrite`
implementation in use supports them, rather than though adaptive
detection. To explicitly disable vectored writes, users may wrap the IO
in a newtype that implements `AsyncRead` and `AsyncWrite` and returns
`false` from its `AsyncWrite::is_write_vectored` method.
This branch updates `bytes` and `http-body` to the latest versions. The
`http-body` version that uses `bytes` 0.6 hasn't been released yet, so
we depend on it via a git dep for now. Presumably Hyper and `http-body`
will synchronize their releases.
Other than that, this is a pretty mechanical update. Should fix the
build and unblock the `h2` update to use vectored writes.
cc #2223
BREAKING CHANGE: The HTTP server code is now an optional feature. To
enable the server, add `features = ["server"]` to the dependency in
your `Cargo.toml`.