-
Notifications
You must be signed in to change notification settings - Fork 274
refactor(http/upgrade): remove HttpConnect
extension
#3779
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
Merged
Merged
Conversation
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
`linkerd-http-upgrade` provides a `HttpConnect` type that is intended for use as a response extension. this commit performs a refactor, removing this type. we use this extension in a single piece of tower middleware. typically, these sorts of extensions are intended for e.g. passing state between distinct layers of tower middleware, or otherwise facilitating extensions to the HTTP family of protocols. this extension is only constructed and subsequently referenced within a single file, in the `linkerd_proxy_http::http::h1::Client`. we can perform the same task by using the `is_http_connect` boolean we use to conditionally insert this extension. Signed-off-by: katelyn martin <[email protected]>
this removes a helper function for a computation whose amortization is no longer as helpful. now that we are passing `is_http_connect` down into this function, we are no longer inspecting the response's extensions. because of that, the only work to do is to check the status code, which is a very cheap comparison. Signed-off-by: katelyn martin <[email protected]>
this commit refactors a sequence of conditional blocks in a helper function used to identity HTTP/1.1 upgrades. this commit replaces this sequence of conditional blocks with a match statement. Signed-off-by: katelyn martin <[email protected]>
we follow a convention where we tend to name responses `rsp`, not `res` or `resp`. this commit applies that convention to this helper function. Signed-off-by: katelyn martin <[email protected]>
Signed-off-by: katelyn martin <[email protected]>
this restates an `if version != HTTP_11 { .. }` conditional block as a match statement. this is a code motion change, none of the inner blocks are changed. Signed-off-by: katelyn martin <[email protected]>
this commit adds a brief comment noting that upgrades are a concept specific to http/1.1. Signed-off-by: katelyn martin <[email protected]>
olix0r
approved these changes
Mar 18, 2025
for posterity, i've run the linkerd/linkerd2 test suite against this branch, as of linkerd/linkerd2@57dd7f4. |
for posterity, this is also related to #3540. |
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.
this branch is motivated by review feedback from #3504. see
linkerd/linkerd2#8733 for more information on upgrading
hyper
. there,we asked:
linkerd-http-upgrade
provides aHttpConnect
type that is intendedfor use as a response extension. this commit performs a refactor,
removing this type.
we use this extension in a single piece of tower middleware. typically,
these sorts of extensions are intended for e.g. passing state between
distinct layers of tower middleware, or otherwise facilitating
extensions to the HTTP family of protocols.
this extension is only constructed and subsequently referenced within a
single file, in the
linkerd_proxy_http::http::h1::Client
. we canperform the same task by using the
is_http_connect
boolean we use toconditionally insert this extension.
then, this branch removes a helper function for a computation whose
amortization is no longer as helpful. now that we are passing
is_http_connect
down into this function, we are no longer inspectingthe response's extensions. because of that, the only work to do is to
check the status code, which is a very cheap comparison.
this also restates an
if version != HTTP_11 { .. }
conditional block asa match statement. this is a code motion change, none of the inner blocks
are changed.
reviewers are encouraged to examine this branch commit-by-commit; because
of the sensitivity of this change, this refactor is performed in small,
methodical changes.