UriComponentsBuilder handles invalid port numbers correctly#26905
Closed
glqdlt wants to merge 1 commit intospring-projects:mainfrom
Closed
UriComponentsBuilder handles invalid port numbers correctly#26905glqdlt wants to merge 1 commit intospring-projects:mainfrom
glqdlt wants to merge 1 commit intospring-projects:mainfrom
Conversation
4e11755 to
fd6659e
Compare
Contributor
Author
|
Sorry. I made a mistake. (before) Fix bug when 'UriComponentsBuilder#fromUriString()' port was not numer. |
rstoyanchev
pushed a commit
that referenced
this pull request
May 7, 2021
Contributor
Author
|
Hello @rstoyanchev |
Contributor
|
This has broken a Boot test case with a URL such as |
Contributor
|
@glqdlt my apologies, I saw your comment but missed the fact you had opened a separate PR. For future reference, simply push your changes to the same branch in order to update the PR. |
Contributor
Author
|
@rstoyanchev thank you very much for the comments. |
bclozel
added a commit
that referenced
this pull request
Jun 8, 2021
This commit revisits the recently updated `PORT_PATTERN` in `UriComponentsBuilder`. The fix introduced in gh-26905 fails with ambiguous URL patterns, especially when the port and path parts of the pattern are hard to differentiate, for example "https://localhost:{port}{path}". This commit reinstates the previous behavior without undoing the actual fix. The only limitation introduced here is the fact that only a single pattern variable is allowed for the port pattern part. Fixes gh-27039
lxbzmy
pushed a commit
to lxbzmy/spring-framework
that referenced
this pull request
Mar 26, 2022
lxbzmy
pushed a commit
to lxbzmy/spring-framework
that referenced
this pull request
Mar 26, 2022
lxbzmy
pushed a commit
to lxbzmy/spring-framework
that referenced
this pull request
Mar 26, 2022
The pattern was changed in 65797d0 to check for characters up until "/", instead of for digits, but now also checks up until "?" and "#". Closes spring-projectsgh-26905
lxbzmy
pushed a commit
to lxbzmy/spring-framework
that referenced
this pull request
Mar 26, 2022
This commit revisits the recently updated `PORT_PATTERN` in `UriComponentsBuilder`. The fix introduced in spring-projectsgh-26905 fails with ambiguous URL patterns, especially when the port and path parts of the pattern are hard to differentiate, for example "https://localhost:{port}{path}". This commit reinstates the previous behavior without undoing the actual fix. The only limitation introduced here is the fact that only a single pattern variable is allowed for the port pattern part. Fixes spring-projectsgh-27039
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.
Hello.
Fixed a bug in the'UriComponentBuilder' class.
The bug occurs in'UriComponentBuilder#fromUriString()'.
A bug occurs when the port of the argument is not a number.
This issue occurs with the 'PORT_PATTERN' regular expression.
If port is not a number, the regular expression is not captured.
This is a good regex, but it causes problems.
You can check the issue in the test code below.
'PORT' that is not captured is captured by'PATH_PATTERN'.
private static final String PATH_PATTERN = "([^?#]*)";I have fixed this bug.
Thank you.