Request headers whose value matches the request URI host are dropped from curl and HTTPie snippets - #1056
Open
harrisleesh wants to merge 1 commit into
Open
Request headers whose value matches the request URI host are dropped from curl and HTTPie snippets#1056harrisleesh wants to merge 1 commit into
harrisleesh wants to merge 1 commit into
Conversation
The HostHeaderFilter is meant to elide an implicit Host header, but its allow method never inspected the header name. Any header whose first value matched the request URI's host - such as X-Forwarded-Host on a request to the same host - was silently dropped from the generated curl and HTTPie commands, as was any header with an empty value list. Fixes spring-projectsgh-1053 Signed-off-by: seonghun lee <harrisleesh@gmail.com>
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.
Fixes gh-1053
HostHeaderFilter.allow(name, value)never inspected the header name, so any header whose first value matched the request URI's host (e.g.X-Forwarded-Host: localhoston a request tohttp://localhost/foo) was silently dropped from generated curl/HTTPie commands, as was any header with an empty value list.The filter now passes every header except
Hostthrough untouched. Added a regression test that fails onmainand passes with the fix;spring-restdocs-corechecks (tests, checkstyle, spring-javaformat) pass.