139 Commits

Author SHA1 Message Date
Ariel Ben-Yehuda
5509ebe615 feat(rt): add Timer::now() method to allow overriding the instant returned (#3965)
The new trait method has a default implementation just returning `Instant::now()`.

An implementer can override that, such as Tokio providing support for it's pausable clock.
2025-11-10 09:38:43 -05:00
Lin Yihai
0bd4adfed2 refactor(lib): reduce clippy warnings (#3805) 2024-12-06 11:04:54 -05:00
Sean McArthur
c86a6bcb4a fix(http1): send 'connection: close' when connection is ending (#3725)
This includes conditions where hyper knows the connection will end after the response, such as a request error that ruins the connection, or when graceful shutdown is triggered.

Closes #3720
2024-10-11 14:28:29 -04:00
krakow10
e77cefe3de fix(example): change TokioTimer usage to match hyper-util end-user experience (#3658) 2024-05-10 11:24:07 +08:00
Sean McArthur
7177770a66 chore(lib): update to 2021 edition 2024-01-24 09:50:02 -05:00
Sean McArthur
b6e3b1b79b test(benches): re-enable end-to-end http2 chunked benchmarks (#3517) 2024-01-08 13:32:53 -05:00
Dax Huiberts
bb818ccbf2 refactor(common): Remove unused TokioTimeout (#3464) 2023-12-08 13:07:12 -05:00
Sean McArthur
569a42d5c9 test(support): fix up unused lint (#3374) 2023-10-26 08:26:41 -04:00
tottoto
8aaede3645 refactor(rt): replace futures_util::Future with std::future::Future (#3341) 2023-10-11 15:07:49 -04:00
Sean McArthur
f9f65b7aa6 feat(rt): replace IO traits with hyper::rt ones (#3230)
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.
2023-07-10 14:11:06 -04:00
dswij
d92d3917d9 feat(rt): add downcast on Sleep trait (#3125)
This commit allows downcasting pinned `Sleep` object to support
implementations of `Timer::reset`.

One example where this is useful is when using `TokioSleep`, i.e.
`Sleep` provided by tokio.

Closes #3027
2023-07-06 09:34:42 -04:00
dswij
8068aa011f feat(client): http2 builder now requires an Executor (#3135)
This commit removes `common::Exec::Default` that just panics when used. We are
removing `tokio`, leaving `Exec::Default` with no implementation and
panics when `Exec::execute` is called.

Since `Exec::Default` has no purpose, it is being removed and user
should now provide an implementation of executor.

Closes #3128 

BREAKING CHANGE:  `hyper::client::conn::Http2::Builder::new` now requires an executor argument.
2023-01-31 15:18:30 -05:00
Sean McArthur
38689060b8 test(benches): re-enable end_to_end benchmarks 2023-01-05 09:46:44 -05:00
Steven Fackler
8790fee749 feat(rt): Clean up Timer trait (#3037)
Closes #3028 

BREAKING CHANGE: The return types of `Timer` have been changed.
2022-12-13 17:15:09 -05:00
Sean McArthur
0888623d37 feat(body): update Body trait to use Frames (#3020)
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`.
2022-10-24 18:07:45 -04:00
Sean McArthur
0766d3f78d feat(server): remove server::conn::{Http, Connection} types (#3013)
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`.
2022-10-17 13:23:47 -04:00
Oddbjørn Grødem
23a56005bd feat(client, server): remove runtime cargo feature (#2975)
- There is no longer a `runtime` feature to enable in the `Cargo.toml.`
- Forgetting to set an executor will now panic.

Closes #2857

BREAKING CHANGE: No longer need to enable a `runtime` feature. All connection builders should set an executor.
2022-09-15 11:23:45 -07:00
Sean McArthur
fae97ced3a feat(rt): add Timer trait (#2974)
This adds a `hyper::rt::Timer` trait, and it is used in connection
builders to configure a custom timer source for timeouts.

Co-authored-by: Robert Cunningham <robertvcunningham@gmail.com>
2022-09-02 13:26:55 -07:00
Sean McArthur
9e8fc8fca1 feat(body): remove "full" constructors from Body (#2958)
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>
2022-08-24 13:01:26 -07:00
Oddbjørn Grødem
c558647762 test(benches): re-enable pipeline and server bench (#2934)
re-enable the recently disabled pipeline and server bench using
`hyper::server::conn` instead of the removed higher-level `Server` api
2022-08-02 06:46:26 -07:00
Sean McArthur
0c8ee93d7f feat(client,server): remove tcp feature and code (#2929)
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>
2022-07-29 10:07:09 -07:00
Oddbjørn Grødem
ce72f73464 feat(lib): remove stream cargo feature (#2896)
Closes #2855
2022-06-23 15:12:24 -07:00
Sean McArthur
7f5e853dd8 refactor(benches): make benchmark names more consistent 2021-11-12 15:09:52 -08:00
Sean McArthur
2f2ceb2426 chore(ci): automatically publish benchmarks in a graph 2020-11-16 16:51:30 -08:00
Sean McArthur
1b9af22fa0 Tokio 0.3 Upgrade (#2319)
Co-authored-by: Urhengulas <johann.hemmann@code.berlin>
Co-authored-by: Eliza Weisman <eliza@buoyant.io>
2020-11-05 17:17:21 -08:00
Sean McArthur
f329ae0ff9 refactor(benches): add adaptive_window http2 benchmark 2020-03-30 16:28:58 -07:00
Sean McArthur
39a3bc0ea5 refactor(benches): change end_to_end response body default to empty 2020-03-30 16:13:46 -07:00
Sean McArthur
dd02254ae8 style(lib): apply latest rustfmt 2020-02-06 11:41:25 -08:00
danieleades
0eaf304644 style(lib): address most clippy lints 2020-01-03 09:40:32 -08:00
Sean McArthur
8ba9a8d2c4 feat(body): add body::aggregate and body::to_bytes functions
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.
2019-12-06 10:03:05 -08:00
Sean McArthur
0dc89680cd style(lib): run rustfmt and enforce in CI 2019-12-05 13:55:17 -08:00
Sean McArthur
a738d03fd3 chore(dependencies): update to http-body 0.3 2019-12-04 16:48:06 -08:00
Sean McArthur
319e8aee15 feat(client): remove Destination for http::Uri in connectors
BREAKING CHANGE: All usage of `hyper::client::connect::Destination`
  should be replaced with `http::Uri`.
2019-12-04 16:15:28 -08:00
Sean McArthur
cb3f39c2dc feat(lib): update Tokio, bytes, http, h2, and http-body 2019-12-04 10:56:34 -08:00
Sean McArthur
8b878a805a perf(client): change HttpConnecting to hold Arc<Config> instead of inlined fields 2019-10-23 16:21:51 -07:00
Sean McArthur
5cb95bdda4 test(benches): add http2 chunks benchmark with default window size 2019-10-15 18:29:33 -07:00
Sean McArthur
51cdbea826 test(benches): add end-to-end chunked benchmarks 2019-10-15 18:05:57 -07:00
Sean McArthur
22695968d2 perf(http2): improve default HTTP2 flow control settings
Set default HTTP2 window sizes much larger values than the spec default.

ref #1960
2019-10-08 15:39:35 -07:00
Sean McArthur
049b5132db feat(client): change GaiResolver to use a global blocking threadpool
BREAKING CHANGE: Calls to `GaiResolver::new` and `HttpConnector::new` no
  longer should pass an integer argument for the number of threads.
2019-08-29 14:16:43 -07:00
lzutao
ae75b3a732 chore(lib): remove async_await feature gate (#1909)
`async_await` is stabilized in rust-lang/rust#63209.
2019-08-21 11:09:14 -07:00
Sean McArthur
a22dabd093 fix(server): change Builder window size methods to be by-value
Closes #1814
2019-08-20 17:45:01 -07:00
Sean McArthur
41f4173615 refactor(http2): re-enable http2 client and server support 2019-08-19 15:55:49 -07:00
Weihang Lo
74195bc17b test(end_to_end): ignore unimplemented h2 benchmarks
Signed-off-by: Weihang Lo <me@weihanglo.tw>
2019-07-23 10:53:03 -07:00
Weihang Lo
4f2abd81e8 test(benches): update end to end benchmark to async/await
Signed-off-by: Weihang Lo <me@weihanglo.tw>
2019-07-23 10:53:03 -07:00
Weihang Lo
fb880c6295 test(benches): uncomment deny warning attr 2019-07-23 10:53:03 -07:00
Weihang Lo
db86e554d5 test(benches): update server benchmark to async/await 2019-07-17 10:57:51 -07:00
Weihang Lo
63a8f26583 test(benches): update pipeline benchmark to async/await 2019-07-17 10:57:51 -07:00
Sean McArthur
5da17df97f chore(lib): individually disable tests and examples that aren't updated 2019-07-12 13:44:03 -07:00
Sean McArthur
da9b0319ef refactor(lib): update to 2018 edition 2019-07-09 15:16:01 -07:00
Sean McArthur
8b45af7f31 feat(server): add initial window builder methods that take self by-val (#1817)
The current `Builder` methods `http2_initial_stream_window_size` and
`http2_initial_connection_window_size` take `&mut self`, while every
other builder method takes `self`. That breaks up the chaining of
options.

This patch adds two methods that configure the same option, but take
`self` instead, and have an underscore suffix (so,
`http2_initial_stream_window_size_`).

cc #1814
2019-05-16 14:34:28 -07:00