Repository navigation
HTTP/3 impl - #3985
Draft
Rafael-Conde wants to merge 57 commits into
Draft
HTTP/3 impl#3985Rafael-Conde wants to merge 57 commits into
Rafael-Conde wants to merge 57 commits into
Conversation
Author
|
@seanmonstar , I'm making my current implementation available here. Let me know if there is a better way do to this. I'm making this changes available to get feedback and improve the implementation! any feedback is welcome! |
Author
|
I plan on keep working on this and make more changes available as soon as I can |
|
May be this also will help you - https://crates.io/crates/axum-h3 axum-h3 - crates.io: Rust Package Registry |
…ad fast path (hyperium#4147) `is_complete_fast` recognizes `\r\n\r\n` and `\n\n` as head terminators but not `\n\r\n`, while the full parser (httparse) accepts all three. So a request whose head ends with `\n\r\n` parses fine when it arrives in a single read, but stalls when it arrives split across reads: the fast path never reports the head complete and the connection keeps waiting for more bytes. This extends the `\n` branch to also accept a following `\r\n`, using the same panic-safe slicing idiom as the `\r` branch. Added the `\n\r\n` witness and the `\n\r` negative to `test_is_complete_fast`, plus a parse-level test documenting that the full parser accepts this terminator. Closes hyperium#4145
Show how to process data and trailer frames while preserving back-pressure, and contrast that with intentionally collecting a bounded body in memory. Closes hyperium#2201
…rium#4167) The following lints no longer exist in recent clippy versions and cause `unknown lint` errors (promoted to errors by `-D warnings` / `-W unknown-lints`): - clippy::unnecessary_rest_pattern - clippy::rest_pattern_accessible_field - clippy::definition_in_module_root Remove them from the allowed lints list in Cargo.toml.
This was referenced Aug 28, 2026
The previous channel variant for `Incoming` used several individual channels to handle the various mechanisms: sending data, signaling error/abort, sending trailers, waiting for optional expect-101 polling. Each individual channel would allocate its own internal shared state in an Arc. Now the `Incoming` channel variant uses a single combined implementation, putting all the required shared pieces in a single Arc. This resulted in less allocations, and less places to potentially store wakers. The following performance improvements were noticed with microbenchmarks: | Benchmark | Before | After | Improvement | | --------------- | ------ | ---------- | ----------- | | Create/drop | 400 ns | 130–139 ns | ~66% | | Data handoff | 229 ns | 147–155 ns | ~34% | | Expect-101 wait | 492 ns | 267–298 ns | ~40–46% |
i stumbled across this while investigating a solution to hyperium#3914. in hyperium#2798, a documentation test was introduced that appears to have been broken since its inception. after spending some time figuring out how to run this documentation test, i found the following errors: ``` ; RUSTDOCFLAGS='--cfg hyper_unstable_ffi' RUSTFLAGS='--cfg hyper_unstable_ffi' cargo test --doc --features client,server,http1,http2,ffi get_in_order Compiling hyper v1.11.1 (/hyper) Finished `test` profile [unoptimized + debuginfo] target(s) in 1.39s Doc-tests hyper running 1 test test src/ext/mod.rs - ext::OriginalHeaderOrder::get_in_order (line 262) - compile ... FAILED failures: ---- src/ext/mod.rs - ext::OriginalHeaderOrder::get_in_order (line 262) stdout ---- error: expected item, found keyword `let` --> src/ext/mod.rs:266:1 | 266 | let mut h_order = OriginalHeaderOrder::default(); | ^^^ `let` cannot be used for global variables | = help: consider using `static` and a `Mutex` instead of `let mut` = note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html> error: aborting due to 1 previous error Couldn't compile the test. failures: src/ext/mod.rs - ext::OriginalHeaderOrder::get_in_order (line 262) ``` after wrapping the code in the example in a `fn main() {}` block: ``` ; RUSTDOCFLAGS='--cfg hyper_unstable_ffi' RUSTFLAGS='--cfg hyper_unstable_ffi' cargo test --doc --features client,server,http1,http2,ffi get_in_order Compiling hyper v1.11.1 (/hyper) Finished `test` profile [unoptimized + debuginfo] target(s) in 0.37s Doc-tests hyper running 1 test test src/ext/mod.rs - ext::OriginalHeaderOrder::get_in_order (line 262) - compile ... FAILED failures: ---- src/ext/mod.rs - ext::OriginalHeaderOrder::get_in_order (line 262) stdout ---- error: expected `;`, found keyword `let` --> src/ext/mod.rs:284:22 | 284 | h_order.append(name3) | ^ help: add `;` here 285 | 286 | let mut iter = h_order.get_in_order() | --- unexpected token error: expected `;`, found keyword `let` --> src/ext/mod.rs:286:38 | 286 | let mut iter = h_order.get_in_order() | ^ help: add `;` here 287 | 288 | let (name, idx) = iter.next(); | --- unexpected token error[E0603]: struct `OriginalHeaderOrder` is private --> src/ext/mod.rs:264:17 | 264 | use hyper::ext::OriginalHeaderOrder; | ^^^^^^^^^^^^^^^^^^^ private struct | note: the struct `OriginalHeaderOrder` is defined here --> src/ext/mod.rs:204:1 | 204 | pub(crate) struct OriginalHeaderOrder { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0433]: cannot find type `Headermap` in this scope --> src/ext/mod.rs:269:17 | 269 | let mut h_map = Headermap::new(); | ^^^^^^^^^ use of undeclared type `Headermap` | help: a struct with a similar name exists | 269 - let mut h_map = Headermap::new(); 269 + let mut h_map = HeaderMap::new(); | error: aborting due to 4 previous errors Some errors have detailed explanations: E0433, E0603. For more information about an error, try `rustc --explain E0433`. Couldn't compile the test. failures: src/ext/mod.rs - ext::OriginalHeaderOrder::get_in_order (line 262) ``` after addressing these errors, i observed: ``` error[E0277]: the trait bound `&[u8; 10]: IntoHeaderName` is not satisfied --> src/ext/mod.rs:273:14 | 273 | h_map.append(name1); | ------ ^^^^^ the trait `IntoHeaderName` is not implemented for `&[u8; 10]` | | | required by a bound introduced by this call | help: the following other types implement trait `IntoHeaderName` --> /.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/http-1.3.1/src/header/map.rs:3690:5 | 3690 | impl IntoHeaderName for HeaderName {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `HeaderName` ... 3712 | impl<'a> IntoHeaderName for &'a HeaderName {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'a HeaderName` ... 3734 | impl IntoHeaderName for &'static str {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'static str` note: required by a bound in `HeaderMap::<T>::append` --> /.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/http-1.3.1/src/header/map.rs:1373:12 | 1371 | pub fn append<K>(&mut self, key: K, value: T) -> bool | ------ required by a bound in this associated function 1372 | where 1373 | K: IntoHeaderName, | ^^^^^^^^^^^^^^ required by this bound in `HeaderMap::<T>::append` error[E0061]: this method takes 2 arguments but 1 argument was supplied --> src/ext/mod.rs:273:7 | 273 | h_map.append(name1); | ^^^^^^------- argument hyperium#2 of type `HeaderValue` is missing | note: method defined here --> /.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/http-1.3.1/src/header/map.rs:1371:12 | 1371 | pub fn append<K>(&mut self, key: K, value: T) -> bool | ^^^^^^ help: provide the argument | 273 | h_map.append(name1, /* HeaderValue */); | +++++++++++++++++++ ``` because these errors point to missing arguments and incorrect types, this commit removes this example altogether. i'm not convinced it was ever run. Signed-off-by: katelyn martin <git@katelyn.world>
…yperium#4201) When parsing a message with more than one `Connection` header line, the per-line logic keyed the branch off the current value of `keep_alive`, so a line that set `keep_alive` to false made the next line take the HTTP/1.0 arm and set it back to true. `Connection: close` followed by `Connection: keep-alive` therefore parsed as keep-alive, while the reverse order parsed correctly. Track whether any `Connection` line carried a `close` token and let that win for the rest of the loop, in both `Server::parse` and `Client::parse`. HTTP/1.0 messages that opt in with `Connection: keep-alive` are unchanged.
…request (hyperium#4208) The Receiver signals want when its queue reports Pending, and SendRequest::is_ready reports that want. A want signaled after finding the queue empty can land after the Sender's give() for the request that follows, and tokio's coop budget can make the queue report Pending with a request already queued. Either way the request is taken with want set, and the connection reports ready until the response completes. hyper-util's legacy pool returns connections on is_ready, so it hands a busy connection to the next request, which then waits behind the whole response. Withdraw the want with want::Taker::unwant when a request is taken. Want is signaled again once the dispatcher is idle. Requires want with Taker::unwant (seanmonstar/want#6).
- Make sure the bare links render as clickable. - Add a note to refrain from using AI/LLMs when writing a HIP.
…rium#4222) Keep the closed dispatch receiver alive until all in-progress sends have published and canceled their callbacks Preserve the connection result across drain polls and keep upgrade handoffs unchanged Closes hyperium#4202
…hyperium#4229) This should be able to run automatically even without our approving of new contributors PRs, so they will hopefully be alerted before we have to read some generated PR description that is overly long. Organization members are skipped, since there is already trust established.
see hyperium#4071. this commit addresses the `let_unit_value` clippy lint. only two sites are affected, relating to tracing spans. this commit introduces a `hyper::trace::Disabled` type to act as a ZST marker in places that can sometimes conditionally compile to a `tracing::span::Entered` guard. this is based upon experimenting in <https://github.com/cratelyn/hyper-span-macro-example>. to restate some of those learnings here: ### background hyper contains a `trace` submodule, introduced in hyperium#3326, that contains macros like the following: ```rust macro_rules! trace { ($($arg:tt)*) => { #[cfg(feature = "tracing")] { tracing::trace!($($arg)+); } } } macro_rules! trace_span { ($($arg:tt)*) => { { #[cfg(feature = "tracing")] { let _span = tracing::trace_span!($($arg)+); _span.entered() } } } } ``` these thinly wrap `tracing`'s macros, to account for the fact that tracing support in hyper is opt-in. it is gated behind a feature flag, and additionally mandates that the `hyper_unstable_tracing` flag be enabled. however, this leads to violations of clippy's `let_unit_value` rule when compiled without the `tracing` feature flag is enabled. this is because `trace_span!` only returns a `tracing::span::Entered` when that flag is active, otherwise it returns `()`. thus, we *must* bind these calls to a variable, so that we properly hold on to the span guard when the tracing flag is active. however, we must contend with the fact that when this flag is not active, strict clippy linting yields us warnings like this: ```text cargo clippy --no-default-features Checking hyper-span-macro-example v0.1.0 error: this let-binding has unit value --> src/main.rs:52:5 | 52 | let _entered = trace_span!("instrumented"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.99.0/index.html#let_unit_value ``` ### why not use `#[allow(..)]` one might try to selectively apply `#[allow(clippy::let_unit_value)]` attributes to stifle this. however, applying attributes to expressions is still a nightly feature we cannot rely on yet, so call-sites for our macros must be updated rather than modifying the code generated by the macro. see rust-lang/rust#15701. this would require us to do something like this throughout the codebase, wherever we create tracing spans: ```rust #[cfg_attr(not(feature = "tracing"), allow(clippy::let_unit_value))] let _entered = trace_span!("instrumented"); ``` `#[cfg_attr]` is a bit esoteric, and if we require that instrumenting code in hyper require this song and dance every time we create a span, it will generally discourage instrumentation. ### changes this commit introduce a `Disabled` type to replace the empty `()` when tracing instrumentation is disabled. this satisfies clippy's `let_unit_value` rule because macros like `trace_span!` will never return `()` no matter which feature flags are active. this _also_ prevents accidentally writing code that would drop span guards once the tracing flag is enabled, because an inert `#[must_use]` guard acts as a stand-in when the flag isn't present. Signed-off-by: katelyn martin <git@katelyn.world>
Rafael-Conde
force-pushed
the
rafael/http3-impl
branch
3 times, most recently
from
October 21, 2026 17:43
1534d21 to
ccdf2e9
Compare
…ium#4251) See hyperium#4071. Clippy lint documentation is at https://clippy.rust-lang.org/master/index.html#redundant_closure_for_method_calls. The rule checks for closures which only invoke a method on the closure argument and can be replaced by referencing the method directly. Only three closures matched this rule, which called a single method without arguments. They were replaced by referencing the method directly.
See hyperium#4071. Lint doc: https://clippy.rust-lang.org/master/index.html#trivially_copy_pass_by_ref The rule checks for functions taking arguments by reference, where the argument type is Copy and small enough to be more efficient to always pass by value. Only four functions were flagged by this rule, where `&self` was changed to `self`.
see hyperium#4071. Lint doc: https://clippy.rust-lang.org/master/index.html#unnested_or_patterns The rule rewrites patterns in disjunctive normal form (DNF) into conjunctive normal form (CNF). Four patterns were flagged by this rule, which were replaced with equivalent nested ones.
fixes hyperium#4232. in hyperium#4231, we found that we don't deny warnings when running cargo hack, because of the predicate that conditionally gates a crate-level `#![deny(warnings)]` attribute in `lib.rs`: ```rust // src/lib.rs #![cfg_attr(all(test, feature = "full"), deny(unreachable_pub))] #![cfg_attr(all(test, feature = "full"), deny(warnings))] #![cfg_attr(all(test, feature = "nightly"), feature(test))] ``` while this prevents warnings from existing when running `cargo test --features full`, it does not affect other builds. so, this would not be active in the commands run by the `features` step in CI, which runs the following two `cargo-hack` commands: ```sh RUSTFLAGS="-D dead_code -D unused_imports" \ cargo hack --no-dev-deps check \ --feature-powerset --depth 2 --skip ffi,tracing RUSTFLAGS="--cfg hyper_unstable_tracing -D dead_code -D unused_imports" \ cargo hack --no-dev-deps check \ --feature-powerset --depth 2 --features tracing --skip ffi ``` this commit introduces a new feature, intended for internal use in CI, called `__deny_warnings`. this provides another mechanism to deny warnings when building hyper. `cargo hack` invocations run in CI are updated to enable this flag. because `-D dead_code -D unused_imports` are now redundant, the `RUSTFLAGS` values passed to these steps are also accordingly simplified. Signed-off-by: katelyn martin <git@katelyn.world>
) `Builder::new(exec)` is the only constructor on either HTTP/2 builder and the executor cannot be read back, so a caller that needs it for work alongside a connection keeps a second copy with nothing relating the two. `impl<E> Builder<E>` is unconstrained, so the accessor needs no bound, and returning `&E` leaves cloning to the caller. Signed-off-by: katelyn martin <git@katelyn.world>
…oding (hyperium#4264) The HTTP/1 server decoder already removes Content-Length when Transfer-Encoding is present. The client decoder preferred Transfer-Encoding for the body length, but still exposed both headers. RFC 7230 §3.3.3 says Transfer-Encoding overrides Content-Length. Remove the Content-Length header from parsed responses so callers cannot treat it as authoritative. Closes hyperium#4263
Continue accepting streams after resetting a CONNECT request with a nonzero Content-Length. Returning from the server loop closes the entire HTTP/2 connection and interrupts unrelated requests. Add a regression test that keeps a GET in flight during the reset and then sends another GET over the same connection.
…ium#4271) HeaderMap::remove returns only the first value, so headers listed in a second Connection line were still sent over HTTP/2.
The chunked decoder read every size, CRLF and trailer byte through read_mem(1), paying a split_to().freeze() per byte. Add read_byte to MemRead and use it in the byte! macro. About 3x faster decoding for small chunks.
hyperium#4270) A body whose only frame ends the stream goes through write_body_and_end, which ignored a short write and just closed the writer. The client then waited forever for a response. Return the same BodyWriteAborted error that end_body already returns for streamed bodies.
…yperium#4275) When the h2 connection drops while a request is still waiting for a stream slot, the parked callback was left to drop, and the caller got a misleading DispatchGone user error. Fail it with the connection error instead: canceled on a clean GOAWAY, the h2 reason otherwise. Adds a regression test with a server that only allows one concurrent stream and closes while the second request is parked. Fixes hyperium#4269
…4248) Do not append Connection: close to an HTTP/1.1 101 response when HTTP keep-alive is disabled The connection is handed off to the upgraded protocol rather than closed Extend the existing upgrade test to cover a request with Connection: close, Upgrade Verify the response headers while retaining the buffered-byte and upgraded-I/O checks Fixes hyperium#4244
…t is pending (hyperium#4247) Represent the initial buffer slot with a want and signal each subsequent want only once per receive cycle Do not restore readiness on Pending or withdraw a grant when dequeuing a request Extend the existing regression to check readiness while the request is still queued Fixes hyperium#4246
Rafael-Conde
force-pushed
the
rafael/http3-impl
branch
from
November 17, 2026 14:53
ccdf2e9 to
6b7673f
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm creating this as a draft to make my attempt so far available.
I haven't done much but I already got a lot of questions, I got time in my hands and I would like to keep contributing, but I would appreciate feedback to whether I'm going in the right direction or not and how could I improve my current attempt.
I'm looking to improve myself and the contribution in general!
I intend to keep working on it and make more changes available as I feel like input could greatly benefit the end result.