-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(http2): gate server Builder
keep-alive interfaces
#3816
Merged
seanmonstar
merged 1 commit into
hyperium:0.14.x
from
cratelyn:kate/http2-server-backport-runtime-cfg
Dec 18, 2024
Merged
fix(http2): gate server Builder
keep-alive interfaces
#3816
seanmonstar
merged 1 commit into
hyperium:0.14.x
from
cratelyn:kate/http2-server-backport-runtime-cfg
Dec 18, 2024
Conversation
This file contains 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
currently, dependents of hyper 0.14 that enable the `server` and `http2` feature flags will see an error if they enable the `backports` flag. building hyper like so... ```sh cargo check --features server,http2,backports ``` ...will yield the following errors (shown in "short" format here for brevity): ```text src/server/conn.rs:75:9: warning: unused import: `tracing::trace` src/server/conn/http2.rs:185:25: error[E0609]: no field `keep_alive_interval` on type `h2::server::Config` src/server/conn/http2.rs:199:25: error[E0609]: no field `keep_alive_timeout` on type `h2::server::Config` warning: `hyper` (lib) generated 1 warning error: could not compile `hyper` (lib) due to 2 previous errors; 1 warning emitted ``` this stems from the fact that the deprecated connection builder `hyper::server::conn::Builder` and the backported `hyper::server::conn::http2::Builder` both operate on the same internal `Config` structure. this structure has changed slightly between 0.14 and 1.0 however. see: ```sh ; git diff 0.14.x master -- src/proto/h2/server.rs | grep 'struct Config' -A 11 ``` ```diff @@ -51,12 +51,11 @@ pub(crate) struct Config { pub(crate) max_concurrent_streams: Option<u32>, pub(crate) max_pending_accept_reset_streams: Option<usize>, pub(crate) max_local_error_reset_streams: Option<usize>, - #[cfg(feature = "runtime")] pub(crate) keep_alive_interval: Option<Duration>, - #[cfg(feature = "runtime")] pub(crate) keep_alive_timeout: Duration, pub(crate) max_send_buffer_size: usize, pub(crate) max_header_list_size: u32, + pub(crate) date_header: bool, } ``` the `runtime` feature flag has seen been removed. see: <https://docs.rs/hyper/1.5.1/hyper/#optional-features> the backported code, consequently, does not include these conditional compilation attributes. i was able to recreate this as far back as v0.14.25, when these backported types were first released. this commit proposes the addition of `#[cfg(feature = "runtime")]` attributes to the `keep_alive_timeout(..)` and `keep_alive_interval(..)` methods of the backported http/2 server connection `Builder`. this will allow hyper users that only require the `server` and `http2` feature flags to address deprecations and prepare to upgrade to hyper 1.0, _without_ having to opt into previously disabled feature flags. Signed-off-by: katelyn martin <[email protected]>
seanmonstar
approved these changes
Dec 18, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the write-up and fix!
cratelyn
added a commit
to linkerd/linkerd2-proxy
that referenced
this pull request
Mar 10, 2025
note: this commit will not compile, code changes are intentionally elided from this commit. this commit upgrades hyper, http, tonic, prost, related dependencies, and their assorted cargo features. see <linkerd/linkerd2#8733>. see also: * #3379 * #3380 * #3382 * #3405 * hyperium/hyper#3796 * #3411 * #3421 * #3427 * #3428 * #3432 * #3433 * #3444 * #3445 * #3454 * #3455 * #3456 * #3457 * #3461 * #3459 * #3465 * #3466 * #3467 * #3468 * linkerd/linkerd2-proxy-api#421 * linkerd/linkerd2#13492 * linkerd/linkerd2#13493 * hyperium/hyper#3816 * #3472 * #3473 * #3479 * tokio-rs/tokio#7059 * #3509 * hyperium/http-body#140 * #3515 * hyperium/http-body#141 * #3530 * #3531 * #3540 * #3556 * #3558 * #3559 * #3564 * #3567 * #3573 * #3583 * hyperium/http-body#144 * #3585 * #3586 * #3597 * #3598 * #3611 * #3614 * #3615 * #3616 * #3647 * #3651 * #3653 * #3654 * #3655 * #3656 * #3657 * #3660 * #3671 * #3672 * #3673 * #3676 * hyperium/http-body#147 * #3692 * #3699 * #3700 * #3701 * #3708 * linkerd/drain-rs#36 * #3715 * #3717 * eminence/procfs#340 --- squash: chore(deps): add hyper-util workspace dependency chore(deps): add http-body-util workspace dependency chore(deps): upgrade linkerd2-proxy-api this commit represents main as of linkerd/linkerd2-proxy-api#421. Signed-off-by: katelyn martin <[email protected]>
cratelyn
added a commit
to linkerd/linkerd2-proxy
that referenced
this pull request
Mar 11, 2025
note: this commit will not compile, code changes are intentionally elided from this commit. this commit upgrades hyper, http, tonic, prost, related dependencies, and their assorted cargo features. see <linkerd/linkerd2#8733>. see also: * #3379 * #3380 * #3382 * #3405 * hyperium/hyper#3796 * #3411 * #3421 * #3427 * #3428 * #3432 * #3433 * #3444 * #3445 * #3454 * #3455 * #3456 * #3457 * #3461 * #3459 * #3465 * #3466 * #3467 * #3468 * linkerd/linkerd2-proxy-api#421 * linkerd/linkerd2#13492 * linkerd/linkerd2#13493 * hyperium/hyper#3816 * #3472 * #3473 * #3479 * tokio-rs/tokio#7059 * #3509 * hyperium/http-body#140 * #3515 * hyperium/http-body#141 * #3530 * #3531 * #3540 * #3556 * #3558 * #3559 * #3564 * #3567 * #3573 * #3583 * hyperium/http-body#144 * #3585 * #3586 * #3597 * #3598 * #3611 * #3614 * #3615 * #3616 * #3647 * #3651 * #3653 * #3654 * #3655 * #3656 * #3657 * #3660 * #3671 * #3672 * #3673 * #3676 * hyperium/http-body#147 * #3692 * #3699 * #3700 * #3701 * #3708 * linkerd/drain-rs#36 * #3715 * #3717 * eminence/procfs#340 --- squash: chore(deps): add hyper-util workspace dependency chore(deps): add http-body-util workspace dependency chore(deps): upgrade linkerd2-proxy-api this commit represents main as of linkerd/linkerd2-proxy-api#421. Signed-off-by: katelyn martin <[email protected]>
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.
currently, dependents of hyper 0.14 that enable the
server
andhttp2
feature flags will see an error if they enable thebackports
flag.building hyper like so...
...will yield the following errors (shown in "short" format here for brevity):
this stems from the fact that the deprecated connection builder
hyper::server::conn::Builder
and the backportedhyper::server::conn::http2::Builder
both operate on the same internalConfig
structure. this structure has changed slightly between 0.14 and 1.0 however. see:the
runtime
feature flag has since been removed. see: https://docs.rs/hyper/1.5.1/hyper/#optional-featuresthe backported code, consequently, does not include these conditional compilation attributes. i was able to recreate this as far back as v0.14.25, when these backported types were first released.
this commit proposes the addition of
#[cfg(feature = "runtime")]
attributes to thekeep_alive_timeout(..)
andkeep_alive_interval(..)
methods of the backported http/2 server connectionBuilder
.this will allow hyper users that only require the
server
andhttp2
feature flags to address deprecations and prepare to upgrade to hyper 1.0, without having to opt into previously disabled feature flags.