HTTPCLIENT-1997: Return the last domain segment instead of normalized domain name from PublicSuffixMatcher#getDomainRoot in case there is no match
This commit is contained in:
parent
9e6287c88b
commit
19a87e0c77
|
@ -171,7 +171,7 @@ public final class PublicSuffixMatcher {
|
|||
result = segment;
|
||||
segment = nextSegment;
|
||||
}
|
||||
return normalized;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,7 +69,9 @@ public class TestPublicSuffixMatcher {
|
|||
Assert.assertEquals("blah.blah.tokyo.jp", matcher.getDomainRoot("blah.blah.tokyo.jp"));
|
||||
Assert.assertEquals("blah.ac.jp", matcher.getDomainRoot("blah.blah.ac.jp"));
|
||||
Assert.assertEquals("garbage", matcher.getDomainRoot("garbage"));
|
||||
Assert.assertEquals("garbage.garbage", matcher.getDomainRoot("garbage.garbage"));
|
||||
Assert.assertEquals("garbage", matcher.getDomainRoot("garbage.garbage"));
|
||||
Assert.assertEquals("garbage", matcher.getDomainRoot("*.garbage.garbage"));
|
||||
Assert.assertEquals("garbage", matcher.getDomainRoot("*.garbage.garbage.garbage"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -275,6 +275,18 @@ public class TestDefaultHostnameVerifier {
|
|||
Assert.assertTrue(DefaultHostnameVerifier.matchIdentityStrict("mail.a.b.c.com", "m*.a.b.c.com"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHTTPCLIENT_1997() {
|
||||
Assert.assertTrue(DefaultHostnameVerifier.matchIdentity(
|
||||
"service.apps.dev.b.cloud.a", "*.apps.dev.b.cloud.a"));
|
||||
Assert.assertTrue(DefaultHostnameVerifier.matchIdentityStrict(
|
||||
"service.apps.dev.b.cloud.a", "*.apps.dev.b.cloud.a"));
|
||||
Assert.assertTrue(DefaultHostnameVerifier.matchIdentity(
|
||||
"service.apps.dev.b.cloud.a", "*.apps.dev.b.cloud.a", publicSuffixMatcher));
|
||||
Assert.assertTrue(DefaultHostnameVerifier.matchIdentityStrict(
|
||||
"service.apps.dev.b.cloud.a", "*.apps.dev.b.cloud.a", publicSuffixMatcher));
|
||||
}
|
||||
|
||||
@Test // Check compressed IPv6 hostname matching
|
||||
public void testHTTPCLIENT_1316() throws Exception{
|
||||
final String host1 = "2001:0db8:aaaa:bbbb:cccc:0:0:0001";
|
||||
|
|
Loading…
Reference in New Issue