http: Strip illegal headers from CONNECT responses#1698
Merged
Conversation
When the proxy transports `CONNECT` requests, the client silently ignores `content-length` and `transport-encoding` response headers, as it should. When the proxy passees these headers to the hyper server, it errors (as is dictated by the RFC). This change updates the HTTP client to remove these headers from responses so that the proxy no longer propagates these illegal headers. Fixes linkerd/linkerd2#8539 Signed-off-by: Oliver Gould <[email protected]>
011e574 to
b836f89
Compare
f2bf43a to
f7dadad
Compare
hawkw
approved these changes
May 23, 2022
Contributor
hawkw
left a comment
There was a problem hiding this comment.
looks good to me! tiny nit on the test
| } | ||
|
|
||
| /// Tests that the proxy drops headers that can't be used in CONNECT responses. | ||
| /// |
Contributor
There was a problem hiding this comment.
nit/tioli: maybe also worth having a
Suggested change
| /// | |
| /// | |
| /// Reproduces https://github.com/linkerd/linkerd2/issues/8539 | |
| /// |
here?
Comment on lines
+765
to
+768
| .map(|res: std::io::Result<()>| match res { | ||
| Ok(()) => {} | ||
| Err(e) => panic!("tcp server error: {}", e), | ||
| }) |
Contributor
There was a problem hiding this comment.
tiny nit, TIOLI: i believe this could avoid matching the Ok(()) case if it used the unwrap_or_elsecombinator rather than map:
Suggested change
| .map(|res: std::io::Result<()>| match res { | |
| Ok(()) => {} | |
| Err(e) => panic!("tcp server error: {}", e), | |
| }) | |
| .unwrap_or_else(|e| panic!("tcp server error: {}", e)) |
Member
Author
There was a problem hiding this comment.
this is copy/paste from above. would love help cleaning up the tests in a separate PR
Member
Author
|
ugh this was based on the wrong branch :/. will resubmit |
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.
When the proxy transports
CONNECTrequests, the client silentlyignores
content-lengthandtransport-encodingresponse headers, asit should. When the proxy passees these headers to the hyper server, it
errors (as is dictated by the RFC).
This change updates the HTTP client to remove these headers from
responses so that the proxy no longer propagates these illegal headers.
Fixes linkerd/linkerd2#8539
Signed-off-by: Oliver Gould [email protected]