You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2022/11/12 15:57:56 UTC
[httpcomponents-client] branch master updated (5f5b70698 -> 6c9374f4c)
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
discard 5f5b70698 HTTPCLIENT-2247: More test cases
new 6c9374f4c HTTPCLIENT-2247: Test cases to document present assumptions about the correct handling of public domain suffixes
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (5f5b70698)
\
N -- N -- N refs/heads/master (6c9374f4c)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../hc/client5/http/ssl/TestDefaultHostnameVerifier.java | 10 ++++++++++
1 file changed, 10 insertions(+)
[httpcomponents-client] 01/01: HTTPCLIENT-2247: Test cases to document present assumptions about the correct handling of public domain suffixes
Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
commit 6c9374f4cf4865a6e705a59c81d9fb04374e300b
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sat Nov 12 16:56:18 2022 +0100
HTTPCLIENT-2247: Test cases to document present assumptions about the correct handling of public domain suffixes
---
.../client5/http/psl/TestPublicSuffixMatcher.java | 2 ++
.../http/ssl/TestDefaultHostnameVerifier.java | 32 +++++++++++++++++++++-
.../src/test/resources/suffixlistmatcher.txt | 6 ++++
3 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/psl/TestPublicSuffixMatcher.java b/httpclient5/src/test/java/org/apache/hc/client5/http/psl/TestPublicSuffixMatcher.java
index 03d5b5c86..25ba0f299 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/psl/TestPublicSuffixMatcher.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/psl/TestPublicSuffixMatcher.java
@@ -72,6 +72,8 @@ public class TestPublicSuffixMatcher {
Assertions.assertEquals("garbage", matcher.getDomainRoot("garbage.garbage"));
Assertions.assertEquals("garbage", matcher.getDomainRoot("*.garbage.garbage"));
Assertions.assertEquals("garbage", matcher.getDomainRoot("*.garbage.garbage.garbage"));
+
+ Assertions.assertEquals("*.compute-1.amazonaws.com", matcher.getDomainRoot("*.compute-1.amazonaws.com"));
}
@Test
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/ssl/TestDefaultHostnameVerifier.java b/httpclient5/src/test/java/org/apache/hc/client5/http/ssl/TestDefaultHostnameVerifier.java
index 67ae939d3..a38b85f6e 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/ssl/TestDefaultHostnameVerifier.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/ssl/TestDefaultHostnameVerifier.java
@@ -254,6 +254,18 @@ public class TestDefaultHostnameVerifier {
Assertions.assertFalse(DefaultHostnameVerifier.matchIdentity("a.b.c", "*.*.c"));
Assertions.assertFalse(DefaultHostnameVerifier.matchIdentityStrict("a.b.c", "*.*.c"));
+
+ Assertions.assertTrue(DefaultHostnameVerifier.matchIdentity("a.b.xxx.uk", "a.b.xxx.uk", publicSuffixMatcher));
+ Assertions.assertTrue(DefaultHostnameVerifier.matchIdentityStrict("a.b.xxx.uk", "a.b.xxx.uk", publicSuffixMatcher));
+
+ Assertions.assertTrue(DefaultHostnameVerifier.matchIdentity("a.b.xxx.uk", "*.b.xxx.uk", publicSuffixMatcher));
+ Assertions.assertTrue(DefaultHostnameVerifier.matchIdentityStrict("a.b.xxx.uk", "*.b.xxx.uk", publicSuffixMatcher));
+
+ Assertions.assertTrue(DefaultHostnameVerifier.matchIdentity("b.xxx.uk", "b.xxx.uk", publicSuffixMatcher));
+ Assertions.assertTrue(DefaultHostnameVerifier.matchIdentityStrict("b.xxx.uk", "b.xxx.uk", publicSuffixMatcher));
+
+ Assertions.assertFalse(DefaultHostnameVerifier.matchIdentity("b.xxx.uk", "*.xxx.uk", publicSuffixMatcher));
+ Assertions.assertFalse(DefaultHostnameVerifier.matchIdentityStrict("b.xxx.uk", "*.xxx.uk", publicSuffixMatcher));
}
@Test
@@ -426,6 +438,24 @@ public class TestDefaultHostnameVerifier {
"host.domain.com",
Collections.singletonList(SubjectName.DNS("some.other.com")),
publicSuffixMatcher));
+
+ DefaultHostnameVerifier.matchDNSName(
+ "host.ec2.compute-1.amazonaws.com",
+ Collections.singletonList(SubjectName.DNS("host.ec2.compute-1.amazonaws.com")),
+ publicSuffixMatcher);
+ DefaultHostnameVerifier.matchDNSName(
+ "host.ec2.compute-1.amazonaws.com",
+ Collections.singletonList(SubjectName.DNS("*.ec2.compute-1.amazonaws.com")),
+ publicSuffixMatcher);
+ DefaultHostnameVerifier.matchDNSName(
+ "ec2.compute-1.amazonaws.com",
+ Collections.singletonList(SubjectName.DNS("ec2.compute-1.amazonaws.com")),
+ publicSuffixMatcher);
+ Assertions.assertThrows(SSLException.class, () ->
+ DefaultHostnameVerifier.matchDNSName(
+ "ec2.compute-1.amazonaws.com",
+ Collections.singletonList(SubjectName.DNS("*.compute-1.amazonaws.com")),
+ publicSuffixMatcher));
}
-}
+}
\ No newline at end of file
diff --git a/httpclient5/src/test/resources/suffixlistmatcher.txt b/httpclient5/src/test/resources/suffixlistmatcher.txt
index e9377cb5f..5f82ba9a7 100644
--- a/httpclient5/src/test/resources/suffixlistmatcher.txt
+++ b/httpclient5/src/test/resources/suffixlistmatcher.txt
@@ -28,6 +28,12 @@ xx
lan
appspot.com
s3.eu-central-1.amazonaws.com
+*.compute.amazonaws.com
+*.compute-1.amazonaws.com
+*.compute.amazonaws.com.cn
+us-east-1.amazonaws.com
+*.xxx.uk
+
// ===END PRIVATE DOMAINS===
// ===BEGIN ICANN DOMAINS===