Default forwarded header handler should only using ConnectionInfo public API#2789
Merged
pderop merged 7 commits intoreactor:1.0.xfrom May 2, 2023
Conversation
…(InetSocketAddress hostAddress, String hostName, int hostPort); fixed DefaultHttpForwardedHeaderHandler using new withHostAddress method; all xForwarded tests are run with default header handler, as well aswith new CustomXForwardedHeadersHandler class.
….getHost() anymore.
violetagg
requested changes
May 2, 2023
reactor-netty-http/src/test/java/reactor/netty/http/server/ConnectionInfoTests.java
Show resolved
Hide resolved
...test/java/reactor/netty/http/server/forwardheaderhandler/CustomXForwardedHeadersHandler.java
Show resolved
Hide resolved
…hange for CustomXForwardedHeadersHandler
…tDefaultHostPort methods.
Contributor
Author
|
can you retake a look ? So, have added public visibility to ConnectionInfo getHostName/getHostPort/getDefaultHostPort: it will simplify life of people if they want to implement their own forwarded handler logic. |
violetagg
approved these changes
May 2, 2023
Contributor
Author
|
@violetagg , thanks for the review ! |
pderop
added a commit
that referenced
this pull request
May 2, 2023
ConnectionInfo public API
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.
Motivations:
reactor.netty.http.server.DefaultHttpForwardedHeaderHandlershould use only thereactor.netty.http.server.ConnectionInfopublic API if we want the custom parsers to have the same information as us. Now, in #2761 PR , the fix done in the DefaultHttpForwardedHeaderHandler method is using some private constructors from the ConnectionInfo when parsing a X-Forwarded-Port header. This breaks the contract because people cannot then do the same using their own custom handlers.Related to #2751
Modifications: