Support ipV6 Host addresses in HttpHeaders
This commit parses the "Host" HTTP request header as an `InetSocketAddress`, while supporting IPv6 addresses like `[::1]`. This host string contains `:` chars even though it has no port information. Issue: SPR-15799
This commit is contained in:
@@ -971,7 +971,12 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
int idx = value.lastIndexOf(':');
|
||||
final int idx;
|
||||
if (value.startsWith("[")) {
|
||||
idx = value.indexOf(':', value.indexOf(']'));
|
||||
} else {
|
||||
idx = value.lastIndexOf(':');
|
||||
}
|
||||
String hostname = null;
|
||||
int port = 0;
|
||||
if (idx != -1 && idx < value.length() - 1) {
|
||||
|
||||
Reference in New Issue
Block a user