mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
RfcParser rejects invalid IPv6 host
Closes gh-36787
This commit is contained in:
committed by
Brian Clozel
parent
224e647e1b
commit
ce90e4b11f
@@ -241,12 +241,16 @@ abstract class RfcUriParser {
|
||||
parser.index(++i);
|
||||
parser.captureHost();
|
||||
if (parser.hasNext()) {
|
||||
if (parser.charAtIndex() == ':') {
|
||||
char next = parser.charAtIndex();
|
||||
if (next == ':') {
|
||||
parser.advanceTo(PORT, i + 1);
|
||||
}
|
||||
else {
|
||||
else if (next == '/') {
|
||||
parser.advanceTo(PATH, i);
|
||||
}
|
||||
else {
|
||||
fail(parser, "Bad authority");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ':':
|
||||
|
||||
+4
-1
@@ -267,7 +267,10 @@ class UriComponentsBuilderTests {
|
||||
@EnumSource
|
||||
void fromUriStringInvalidIPv6Host(ParserType parserType) {
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
UriComponentsBuilder.fromUriString("http://[1abc:2abc:3abc::5ABC:6abc:8080/resource", parserType));
|
||||
UriComponentsBuilder.fromUriString("https://[1abc:2abc:3abc::5ABC:6abc:8080/resource", parserType));
|
||||
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
UriComponentsBuilder.fromUriString("https://[1abc:2abc:3abc::5ABC:6abc]resource", parserType));
|
||||
}
|
||||
|
||||
@ParameterizedTest // see SPR-11970
|
||||
|
||||
Reference in New Issue
Block a user