Skip to content

Commit 6542f7c

Browse files
committed
HttpsSupport: Omit public suffix matcher from default hostname verifier
The use of public suffix matching as part of hostname verification is nonstandard. I can't find anything in the TLS specifications that prescribe or even mention this behavior, having checked: * RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3 * RFC 9110: HTTP Semantics * RFC 9525: Service Identity in TLS There are of course rules for wildcard matching, but ultimately the question of whether to trust a certificate for `*.com` is up to the CAs in your trust store. Given the oddity of the PSL matching behavior and the non-trivial runtime overhead of loading and querying the PSL, I think it makes more sense for the default `HostnameVerifier` to not use this behavior.
1 parent 1f90c1a commit 6542f7c

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

httpclient5/src/main/java/org/apache/hc/client5/http/ssl/HttpsSupport.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
import javax.net.ssl.HostnameVerifier;
3434

35-
import org.apache.hc.client5.http.psl.PublicSuffixMatcherLoader;
3635
import org.apache.hc.core5.util.TextUtils;
3736

3837
/**
@@ -62,7 +61,7 @@ public static String[] getSystemCipherSuits() {
6261
}
6362

6463
public static HostnameVerifier getDefaultHostnameVerifier() {
65-
return new DefaultHostnameVerifier(PublicSuffixMatcherLoader.getDefault());
64+
return new DefaultHostnameVerifier();
6665
}
6766

6867
}

0 commit comments

Comments
 (0)