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:
@@ -168,6 +168,14 @@ public class HttpHeadersTests {
|
||||
assertEquals("Invalid Host header", "localhost", headers.getFirst("Host"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ipv6Host() {
|
||||
InetSocketAddress host = InetSocketAddress.createUnresolved("[::1]", 0);
|
||||
headers.setHost(host);
|
||||
assertEquals("Invalid Host header", host, headers.getHost());
|
||||
assertEquals("Invalid Host header", "[::1]", headers.getFirst("Host"));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void illegalETag() {
|
||||
String eTag = "v2.6";
|
||||
|
||||
Reference in New Issue
Block a user