Skip to content
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 value accumulation for case-sensitive keys in NettyHeadersAdapter #33730

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

qnnn
Copy link

@qnnn qnnn commented Oct 17, 2024

The current NettyHeaders supports case-sensitive storage of entry values when using the add method. This causes the NettyHeadersAdapter to accumulate the values for the corresponding key when retrieving headers(see unit test).

Add a unit test testHeadersOutput to verify the final output of the headers.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 17, 2024
@qnnn
Copy link
Author

qnnn commented Oct 17, 2024

addAll has the same issue, and it has also been addressed.

@qnnn qnnn marked this pull request as draft October 17, 2024 12:04
@qnnn qnnn marked this pull request as ready for review October 17, 2024 12:43
@simonbasle simonbasle self-assigned this Oct 17, 2024
@simonbasle
Copy link
Contributor

hey @qnnn thanks for the PR. Can you elaborate on the use case that lead you to come up with this change? I'm guessing this is a matter of enumerating the headers or representing them as a whole?

@simonbasle simonbasle added the status: waiting-for-feedback We need additional information before we can continue label Oct 18, 2024
@qnnn
Copy link
Author

qnnn commented Oct 18, 2024

hey @qnnn thanks for the PR. Can you elaborate on the use case that lead you to come up with this change? I'm guessing this is a matter of enumerating the headers or representing them as a whole?

@simonbasle I discovered this problem while using the AddRequestHeader GatewayFilter in Spring Cloud Gateway. Through network packet capture, it can be seen that the HTTP requests sent by the Gateway aggregate the values of case-sensitive keys in the HTTP headers.
The expected request header should be testheader=first, second, but the actual result is testheader=first, second, first, second (the same as the output in the unit test).

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged or decided on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants