2892 Commits

Author SHA1 Message Date
Sean McArthur
64d487aba8 feat(server): introduce http3 connections 2025-11-25 16:51:14 -05:00
Sean McArthur
fc53b03091 feat(rt): introduce quic traits 2025-11-25 16:51:14 -05:00
Sean McArthur
be18a92bb5 refactor(http1): replace many args of Chunked::step with struct (#3982)
It's kind of the same thing, but by using a struct, the arguments are
essentially named, instead of relying of position.
2025-11-25 16:50:07 -05:00
Sean McArthur
4bfe65af8f refactor(http1): use saturating_sub instead of manual impl (#3983) 2025-11-25 16:49:55 -05:00
Sean McArthur
9da1814439 refactor(http1): simplify match of Token parse error (#3981) 2025-11-24 14:10:16 -05:00
Michael Rodler
2968dbcd75 chore(ci): run cargo-audit weekly to check for known vulnerabilities in dependencies. (#3246)
`cargo audit` checks for dependencies with known issues. This PR adds a github workflow that runs `cargo audit` on a weekly basis on `HEAD` and whenever a dependency changes.

Signed-off-by: Michael Rodler <mrodler@amazon.de>
Co-authored-by: Michael Rodler <mrodler@amazon.de>
Co-authored-by: f0rki <m@mrodler.eu>
2025-11-24 10:37:31 -05:00
Sean McArthur
793af1ed2a docs(error): add more information about is_incomplete_message() (#3978) 2025-11-14 12:33:06 -05:00
Sean McArthur
166c6cacc7 v1.8.1 v1.8.1 2025-11-13 16:12:46 -05:00
Sean McArthur
4492f31e94 fix(http1): fix consuming extra CPU from previous change (#3977)
Revert "fix(http1): fix rare missed write wakeup on connections (#3952)"

This reverts commit 2377b893f6.
2025-11-13 16:11:36 -05:00
Sean McArthur
dbe6f25ba2 v1.8.0 v1.8.0 2025-11-11 08:44:41 -05:00
Sean McArthur
58e0e7dc70 fix(http2): fix internals of HTTP/2 CONNECT upgrades (#3967)
This refactors the way hyper handles HTTP/2 CONNECT / Extended CONNECT. Before,
an uninhabited enum was used to try to prevent sending of the `Buf` type once
the STREAM had been upgraded. However, the way it was originally written was
incorrect, and will eventually have compilation issues.

The change here is to spawn an extra task and use a channel to bridge the IO
operations of the `Upgraded` object to be `Cursor` buffers in the new task.

ref: https://github.com/rust-lang/rust/issues/147588
Closes #3966 

BREAKING CHANGE: The HTTP/2 client connection no longer allows an executor
  that can not spawn itself.
  
  This was an oversight originally. The client connection will now include spawning
  a future that keeps a copy of the executor to spawn other futures. Thus, if it is
  `!Send`, it needs to spawn `!Send` futures. The likelihood of executors that match
  the previously allowed behavior should be very remote.

  There is also technically a semver break in here, which is that the
  `Http2ClientConnExec` trait no longer dyn-compatible, because it now expects to
  be `Clone`. This should not break usage of the `conn` builder, because it already
  separately had `E: Clone` bounds. If someone were using `dyn Http2ClientConnExec`,
  that will break. However, there is no purpose for doing so, and it is not usable
  otherwise, since the trait only exists to propagate bounds into hyper. Thus, the
  breakage should not affect anyone.
2025-11-10 11:20:31 -05:00
Sean McArthur
0a37a8cd9d test(ready_stream): replace tracing with printlns (#3973) 2025-11-10 10:09:27 -05:00
Louis Thiery
2377b893f6 fix(http1): fix rare missed write wakeup on connections (#3952) 2025-11-10 09:51:16 -05:00
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
katelyn martin
f9f8f44058 tests(client): port tests to in-memory socket (#3947)
see https://github.com/hyperium/hyper/issues/3896.

this commit ports an assortment of test cases for the client to an
in-memory socket using `tokio::io::duplex()`.

this should help reduce test flakes related to TCP close behavior.

this supersedes https://github.com/hyperium/hyper/pull/3946.

Signed-off-by: katelyn martin <git@katelyn.world>
2025-09-08 12:39:18 -04:00
Will-Low
5803a9c059 docs(server): update default values for http1::Builder (#3938) 2025-08-29 14:32:20 -04:00
Name
e1e1f2b461 refactor(ffi): specify "C" ABI explicitly in ffi_fn! macro (#3937)
Co-authored-by: 1911860538 <alxps1911@gmail.com>
2025-08-27 09:05:13 -04:00
tottoto
64ab7ae339 chore(ci): update to actions/checkout@v5 (#3935) 2025-08-22 06:18:49 -04:00
Sean McArthur
400bdfdace v1.7.0 v1.7.0 2025-08-18 09:52:43 -04:00
Ryan
9749184f8a feat(server): add allow_multiple_spaces_in_request_line_delimiters http1 builder method (#3929) 2025-08-15 11:42:20 -04:00
Hanna Kruppe
caa166c756 chore(dependencies): avoid implicit cargo feature of futures-util (#3931)
Fix a mistake in commit e11b2ad: use the 'dep:' syntax for futures-util, so
that Cargo won't implicitly create a feature called 'futures-util'.
Removing features is semver-breaking, but said commit hasn't been in any
release yet, so it can still be fixed now.
2025-08-12 13:25:33 -04:00
Name
8ad2595c03 test(common): add missing assertion in full_rewind test (#3926)
Co-authored-by: 1911860538 <alxps1911@gmail.com>
2025-08-11 09:07:14 -04:00
tottoto
24f0da8636 chore(ci): update to cargo-check-external-types-0.3.0 (#3928) 2025-08-11 08:30:05 -04:00
Sean McArthur
974289fb3d docs(rt): improve rt module overview (#3920) 2025-07-28 08:11:30 -04:00
Sean McArthur
283fd2381d docs: improve ext module overview and Protocol docs (#3921) 2025-07-28 08:11:10 -04:00
Josh McKinney
b8affd8a2e feat(error): add Error::is_shutdown() (#3863)
Benchmarking tools often cause connections to be ungracefully shutdown.
This makes it possible to filter these errors out.

Closes #2745
2025-06-27 12:49:12 -04:00
Sean McArthur
c88df7886c docs(SECURITY): update policy to use GSA drafts when reporting vulnerabilities (#3894) 2025-05-26 14:55:09 -04:00
Patryk Wychowaniec
436cadd1ac fix(server): improve caching accuracy of Date header (#3887)
`CachedDate` gets updated every second, but the current logic doesn't
take into account milliseconds - if the application starts at
`12:00:00.600`, hyper will report `date: ...T120000` up until
`12:00:01.599`, which is overzealous.

We can sidestep this by subtracing the nanoseconds part (which includes
milliseconds) from the time passed to `CachedDate::update()`.
2025-05-19 16:39:39 -04:00
Hanna Kruppe
e11b2ad91c refactor(lib): drop futures-util except in ffi (#3890)
Make hyper usable for h1/h2 and client/server without this heavyweight
dependency. It's about 17k lines of code and takes up to 1.7 seconds to
compile on my machine, but hyper is only using a tiny fraction of it.
Larger applications probably still pull in futures-util by other means,
but it's no longer as unavoidable as in the early days of the ecosystem.

To remove futures-util without raising MSRV, I took these steps:

* When futures-util just re-exports something from its dependencies,
  use it directly from the source.
* Inline trivial helpers like `poll_unpin` that "only" communicate
  intent a little better but don't save any significant amount of code.
* Refactor the h2 client code to avoid `StreamFuture` for the "Client
  has been dropped" detection -- just poll the mpsc channel directly.
* Implement a couple of small helpers from scratch when they're
  straightforward and fit on one screen each. The majority of this is
  polyfills for standard library APIs that would require a higher MSRV.
* Use `AtomicWaker` from the `atomic-waker` crate, a separately
  published copy of the futures-util type of the same name. While the
  two crates are owned by different organizations (smol-rs vs.
  rust-lang), it's mostly the same people maintaining both copies.

The uses of future-util in hyper's tests/benches/examples and in the
`ffi` module seem much harder to remove entirely, so I did not touch
those modules at all.
2025-05-19 14:37:45 -04:00
Sam Praneis
42aff8726d refactor(http2): add decriptive error for non-empty body in CONNECT request (#3886)
Closes #3858
2025-05-06 17:17:39 -04:00
katelyn martin
efa0b26958 feat(client): add a TrySendError::error() method (#3885)
this commit introduces a new inherent method to
`hyper::client::conn::TrySendError<T>`.

this error type includes a `TrySendError::into_error()` method today
that will consume the `TrySendError<T>`, returning the inner error. this
commit introduces a new method that allows callers to inspect the error,
e.g. to update metrics, without needing to consume the error.

this is akin to #3884, which added the `TrySendError::message()` method
that returns a reference to the `T`-typed message when applicable.

Signed-off-by: katelyn martin <git@katelyn.world>
2025-05-06 10:51:36 -04:00
katelyn martin
03fd6aff88 feat(client): add a TrySendError::message() method (#3884)
this commit introduces a new inherent method to
`hyper::client::conn::TrySendError<T>`.

this error type includes a `TrySendError::take_message()` method today
that will return an owned instance of the inbound message, should the
underlying dispatch have been closed before serialization of the message
ever began.

this commit introduces a new method that allows callers to inspect the
message, e.g. to update metrics, without needing to take ownership of
the message.

Signed-off-by: katelyn martin <git@katelyn.world>
2025-05-05 22:43:22 -04:00
katelyn martin
12d9b55a03 chore(proto/h2): fix module-level documentation (#3881)
`proto::h2::ping` has some documentation that won't be rendered
properly, because it is written as documentation of an item rather than
documenting the enclosing submodule.

this commit updates this comment, using `//!` notation.

Signed-off-by: katelyn martin <git@katelyn.world>
2025-04-28 17:04:25 -04:00
Sean McArthur
0369f5e864 docs(MAINTAINERS): add katelyn martin as collaborator (#3878) 2025-04-21 10:09:14 -04:00
ZenTeaCC
ea5b49b7d4 docs(examples): alias Builder for clarity in http_proxy (#3873) 2025-04-07 08:17:10 -04:00
katelyn martin
ede24d2714 docs(service): add HttpService documentation (#3869)
this commit introduces some additional documentation to the
`HttpService` trait, and the `Service` trait.

notably, this commit introduces some intradoc links, so that rustdoc
will render links to types like `http::Request` and `http::Response`, or
to the `Body` trait.

additionally, mention of `hyper-util` is added to the `Service` trait,
to direct users to the glue implementations that they will likely need
to interact with e.g. `tower`.

Signed-off-by: katelyn martin <me+cratelyn@katelyn.world>
2025-04-04 14:54:23 -04:00
Hugo
c449528a33 test(body): add proper cfgs to body unit tests (#3864)
Running `cargo test` fails to compile because tests rely on types which
are behind a #[cfg(…)] which is disabled by default.

Add a #[cfg(…)] directive to tests which rely on types which are also
behind a #[cfg(…)] directive, so that these tests run only if the types
on which they depend exist.
2025-03-24 12:58:46 -04:00
jimmycathy
68bae2b53f docs(ffi): remove redundant backticks (#3855)
Signed-off-by: jimmycathy <clonecode@outlook.com>
2025-03-16 15:02:17 +00:00
Sean McArthur
621d8e4d77 v1.6.0 v1.6.0 2025-01-28 08:51:52 -05:00
Sean McArthur
83f45887e7 chore(LICENSE): update copyright year 2025-01-28 08:50:25 -05:00
Finn Bear
10b09ffc04 fix(server): start http1 header read timeout when conn is idle (#3828)
Currently, the header read timeout is started before any part of the first request is received. This allows closing the connection if no requests are received. However, after the first request, the connection can remain open indefinitely. This change ensures that the header read timeout is started immediately after the connection is idle, following the transmission of the response, before the first part of the subsequent request is received.

This change allows a potential future addition of an idle_timeout, which if set, would be used instead of the header_read_timeout. This behavior is matched in other servers, such as Golang.

Fixes #3780
Closes #3781
2025-01-27 15:23:46 -05:00
Sean McArthur
8ce1fcfae9 feat(ext): add ext::on_informational() callback extension (#3818)
This new function allows attaching a callback to a request, such that
when it is sent through a hyper client connection, and any 1xx
informational responses are received, they are passed to the callback.

This takes the unstable client informational feature (introduced in
#2594, tracking issue in #2565), and promotes it to a stable API.

Closes #2565
2025-01-27 14:15:58 -05:00
tottoto
de28b0e5b2 chore(ci): use msrv aware dependency resolver (#3831) 2025-01-20 10:20:34 -05:00
tottoto
5baf537b90 chore(ci): use yq to get rust-version in manifest (#3829) 2025-01-20 10:14:48 -05:00
Glen De Cauwsemaecker
3817a79b21 feat(server): add http1::Builder::ignore_invalid_headers(bool) option (#3824)
Enabling this option tells hyper to skip invalid header lines, instead of rejecting the request.
2025-01-14 16:01:04 -05:00
Finn Bear
e981a91e68 fix(server): change max_local_error_reset_streams function to &mut self (#3820)
BREAKING CHANGE: `http2::Builder::max_local_error_reset_streams()` now takes `&mut self` and returns `&mut Self`. In practice, this shouldn't break almost anyone. It was the wrong receiver and return types.
2025-01-07 09:05:13 -05:00
Sean McArthur
30f2961e89 v1.5.2 v1.5.2 2024-12-16 11:16:22 -05:00
Sean McArthur
a131111f9c fix(http1): fix intermitent panic parsing partial headers (#3812)
Closes #3811
2024-12-16 10:36:41 -05:00
Sean McArthur
a3bda62da3 docs(roadmap): update ROADMAP post v1.0 (#3763) 2024-12-10 11:55:08 -05:00
Jacob Su
115339d3df chore(benches): fix pin-project-lite not found (#3807) 2024-12-10 10:48:56 -05:00