Commit Graph

2479 Commits

Author SHA1 Message Date
Jonas Platte
43412a950f refactor(lib): Switch from pin-project to pin-project-lite 2021-01-28 14:09:53 -08:00
Jonas Platte
9dff00425d refactor(lib): Use cfg(all(...)) instead of multiple cfg attributes 2021-01-28 14:09:53 -08:00
Ivan Nikulin
2c8121f173 fix(client): HTTP/1 client "Transfer-Encoding" repair code would panic (#2410)
Closes #2409
2021-01-26 10:36:58 -08:00
Sean McArthur
1928682b33 feat(ffi): add HYPERE_INVALID_PEER_MESSAGE error code for parse errors 2021-01-20 15:10:19 -08:00
Paolo Barbolini
237b2ce083 refactor(lib): Remove useless uses of Pin (#2405) 2021-01-19 14:51:34 -08:00
erikdesjardins
9956587f83 feat(body): reexport hyper::body::SizeHint (#2404) 2021-01-19 14:50:07 -08:00
Mike Roelens
ec2fd4a15f docs(client): fix typo in httpbin.org domain (#2406) 2021-01-19 08:30:17 -08:00
nickelc
f821ecdd19 docs(body): set doc_cfg attribute for Body::wrap_stream (#2403) 2021-01-15 16:24:03 -08:00
Abdullah Eryuzlu
bf8d74ad1c feat(body): add send_trailers to Body channel's Sender (#2387)
Closes #2260
2021-01-15 10:14:21 -08:00
nickelc
257d6a9919 docs(server): set doc_cfg attributes for tcp feature gated Server methods (#2401) 2021-01-14 13:56:49 -08:00
Taiki Endo
f0ddb66932 refactor(lib): apply unreachable_pub lint (#2400)
Closes #2390
2021-01-14 09:57:55 -08:00
Markus Westerlind
a15f3f7f0f refactor(client): minimize the amount of instantiated code (#2391)
* Halve the amount of conn_task instantiations
* Extract non-generic parts of client::handshake
* Extract the non-generic parts of call_async
2021-01-12 16:18:22 -08:00
Sean McArthur
446dd2f0c7 chore(security): add a SECURITY.md policy (#2395) 2021-01-12 14:45:10 -08:00
Sean McArthur
c9c46ed60b refactor(ffi): Add Reason-Phrase API
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.
2021-01-08 10:25:53 -08:00
Sean McArthur
4c32daeea0 refactor(ffi): Add HeaderCaseMap preserving http1 header casing 2021-01-08 10:25:53 -08:00
Sean McArthur
3ae1581a53 feat(ffi): Initial C API for hyper 2021-01-08 10:25:53 -08:00
Sean McArthur
8861f9a786 v0.14.2 2020-12-29 10:51:50 -08:00
Kirill Fomichev
a6d4fcbee6 feat(server): expose Accept without httpX features (#2382) 2020-12-29 10:19:57 -08:00
Maxim Zhukov
510b998ff3 chore(dev-dependencies): bump url to 2.2 (#2379) 2020-12-28 15:52:28 -08:00
Nikhil Benesch
73a59e5fc7 feat(client): expose connect types without proto feature (#2377)
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.
2020-12-28 15:50:28 -08:00
Sean McArthur
3d6bdbe850 v0.14.1 2020-12-23 13:01:14 -08:00
Sean McArthur
c97a106125 docs(lib): enable doc_cfg on docs.rs builds (#2372) 2020-12-23 12:55:28 -08:00
Sean McArthur
c784a10174 v0.14.0 2020-12-23 10:58:04 -08:00
Sean McArthur
fad42acc79 feat(lib): Upgrade to Tokio 1.0 (#2369)
Closes #2370
2020-12-23 10:36:12 -08:00
Abdullah Eryuzlu
dad5c8792f fix(client): log socket option errors instead of returning error (#2361)
Closes #2359
2020-12-23 07:41:04 -08:00
Pankaj Chaudhary
3b3077da1f refactor(http1): updated Encoder/Decoder match with the matches macro (#2368) 2020-12-22 10:50:57 -08:00
Pawan Singh Bisht
6c593c2925 refactor(error): use matches! macro in Error::is_* methods (#2367) 2020-12-21 12:25:47 -08:00
Alex Rebert
1dd761c87d fix(http1): ignore chunked trailers (#2357)
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
2020-12-15 14:23:07 -08:00
Arve Knudsen
ede3a6bd9d refactor(http1): move upgrade state from body to head (#2353)
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>
2020-12-15 07:31:48 -08:00
Ben Noordhuis
7d9a5806e1 refactor(http1): change HTTP2->1.1 warning to debug (#2354)
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.
2020-12-14 13:57:32 -08:00
Sean McArthur
b4e24332a0 feat(client): change DNS Resolver to resolve to SocketAddrs (#2346)
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.
2020-12-03 14:21:19 -08:00
Jim Holmström
3cb6b4e840 docs(examples): gateway: remove extra slash for uri (#2351)
The PathAndQuery already contains the leading slash, which erroneously
sets the proxied path to "//.." and not "/..".
2020-12-03 13:36:32 -08:00
Chris Campbell
f8641733be docs(client): add example of client conn usage (#2350)
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
2020-12-01 15:58:28 -08:00
Linus Färnstrand
21dea21145 chore(dependencies): upgrade socket2 (#2349)
Upgrades to a version not making invalid assumptions about
the memory layout of std::net::SocketAddr
2020-11-30 05:48:28 -08:00
Robert Clipsham
1ba2a141a6 test(client): Upgrade libpnet depedency to 0.27.2 [#2347] (#2348)
Additionally, only depend on pnet_datalink to reduce compile times.

Closes #2347
2020-11-27 21:55:03 -08:00
Sean McArthur
a470446deb chore(error): remove undocumented public error module (#2344) 2020-11-25 12:52:07 -08:00
Michael Hewson
db32e1050c feat(lib): remove dependency on tracing's log feature (#2342)
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.
2020-11-25 12:41:58 -08:00
Eliza Weisman
d6aadb8300 perf(lib): re-enable writev support (#2338)
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.
2020-11-24 10:31:48 -08:00
Sean McArthur
121c33132c feat(upgrade): Moved HTTP upgrades off Body to a new API (#2337)
Closes #2086

BREAKING CHANGE: The method `Body::on_upgrade()` is gone. It is
  essentially replaced with `hyper::upgrade::on(msg)`.
2020-11-19 16:36:12 -08:00
Eliza Weisman
751c122589 feat(lib): update bytes to 0.6, update http-body (#2339)
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.
2020-11-19 16:23:32 -08:00
Sean McArthur
ed2b22a7f6 feat(lib): disable all optional features by default (#2336)
BREAKING CHANGE: All optional features have been disabled by default.
2020-11-19 10:05:39 -08:00
Eliza Weisman
abb6471690 refactor(client): use tokio's TcpSocket for more sockopts (#2335)
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2020-11-18 14:45:45 -08:00
Sean McArthur
bdb5e5d694 feat(server): Make the server code an optional feature (#2334)
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`.
2020-11-18 11:02:20 -08:00
Sean McArthur
4e55583d30 feat(client): Make client an optional feature
cc #2223

BREAKING CHANGE: The HTTP client of hyper is now an optional feature. To
  enable the client, add `features = ["client"]` to the dependency in
  your `Cargo.toml`.
2020-11-17 17:06:25 -08:00
Sean McArthur
eb092a7b8c chore(ci): check all feature combinations in CI 2020-11-17 14:30:27 -08:00
Sean McArthur
2a19ab74ed feat(http1): Make HTTP/1 support an optional feature
cc #2251

BREAKING CHANGE: This puts all HTTP/1 methods and support behind an
  `http1` cargo feature, which will not be enabled by default. To use
  HTTP/1, add `features = ["http1"]` to the hyper dependency in your
  `Cargo.toml`.
2020-11-17 10:42:20 -08:00
Sean McArthur
2f2ceb2426 chore(ci): automatically publish benchmarks in a graph 2020-11-16 16:51:30 -08:00
Eliza Weisman
b3b8010e1c refactor(server): simplify drain (#2328)
The current implementation of `drain` uses a `tokio::sync::watch`
channel to send the shutdown signal, and a `tokio::sync::mpsc` to signal
when all draining tasks have completed. No data is ever actually sent on
the MPSC; instead, it is simply used to notify the task that signalled
the drain when all draining tasks have been dropped.

Tokio 0.3's `watch::Sender` has a `closed` method that can be used to
await the dropping of all receivers. This can be used instead of the
MPSC channel. This commit updates `drain` to use `watch::Sender::closed`
instead. This has fewer moving parts, and may have slightly less
overhead (as it doesn't require additional allocation forthe MPSC which
is never actually used).

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
2020-11-12 13:34:19 -08:00
Sean McArthur
b819b428d3 feat(http2): Make HTTP/2 support an optional feature
cc #2251

BREAKING CHANGE: This puts all HTTP/2 methods and support behind an
  `http2` cargo feature, which will not be enabled by default. To use
  HTTP/2, add `features = ["http2"]` to the hyper dependency in your
  `Cargo.toml`.
2020-11-10 13:40:34 -08:00
Evan Cameron
5438e9b7bf docs(example): fix http_proxy comment (#2324) 2020-11-09 08:07:12 -08:00