From 79b1eae93be3d8e7531db4dfd401e3b90525dba7 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Tue, 19 Aug 2014 14:19:21 +0000 Subject: [PATCH] Deprecated BrowserCompatHostnameVerifier and StrictHostnameVerifier in favor of DefaultHostnameVerifier git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1618870 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/http/conn/ssl/BrowserCompatHostnameVerifier.java | 4 +++- .../org/apache/http/conn/ssl/SSLConnectionSocketFactory.java | 4 ++-- .../java/org/apache/http/conn/ssl/StrictHostnameVerifier.java | 3 +++ .../java/org/apache/http/conn/ssl/TestHostnameVerifier.java | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.java b/httpclient/src/main/java/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.java index 53b12f428..9ba529091 100644 --- a/httpclient/src/main/java/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.java +++ b/httpclient/src/main/java/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.java @@ -41,10 +41,12 @@ import org.apache.http.annotation.Immutable; * (such as "*.foo.com") with BROWSER_COMPATIBLE matches all subdomains, * including "a.b.foo.com". * - * * @since 4.0 + * + * @deprecated (4.4) Use {@link org.apache.http.conn.ssl.DefaultHostnameVerifier} */ @Immutable +@Deprecated public class BrowserCompatHostnameVerifier extends AbstractVerifier { public static final BrowserCompatHostnameVerifier INSTANCE = new BrowserCompatHostnameVerifier(); diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java b/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java index 12cfdac40..164819665 100644 --- a/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java +++ b/httpclient/src/main/java/org/apache/http/conn/ssl/SSLConnectionSocketFactory.java @@ -123,7 +123,7 @@ import org.apache.http.util.TextUtils; * * @since 4.3 */ -@ThreadSafe +@ThreadSafe @SuppressWarnings("deprecation") public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactory { public static final String TLS = "TLS"; @@ -146,7 +146,7 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor * @since 4.4 */ public static HostnameVerifier getDefaultHostnameVerifier() { - return BrowserCompatHostnameVerifier.INSTANCE; + return DefaultHostnameVerifier.INSTANCE; } /** diff --git a/httpclient/src/main/java/org/apache/http/conn/ssl/StrictHostnameVerifier.java b/httpclient/src/main/java/org/apache/http/conn/ssl/StrictHostnameVerifier.java index 6d233c618..db529b1a3 100644 --- a/httpclient/src/main/java/org/apache/http/conn/ssl/StrictHostnameVerifier.java +++ b/httpclient/src/main/java/org/apache/http/conn/ssl/StrictHostnameVerifier.java @@ -50,8 +50,11 @@ import org.apache.http.annotation.Immutable; * * * @since 4.0 + * + * @deprecated (4.4) Use {@link org.apache.http.conn.ssl.DefaultHostnameVerifier} */ @Immutable +@Deprecated public class StrictHostnameVerifier extends AbstractVerifier { public static final StrictHostnameVerifier INSTANCE = new StrictHostnameVerifier(); diff --git a/httpclient/src/test/java/org/apache/http/conn/ssl/TestHostnameVerifier.java b/httpclient/src/test/java/org/apache/http/conn/ssl/TestHostnameVerifier.java index a346a6eae..657f8df93 100644 --- a/httpclient/src/test/java/org/apache/http/conn/ssl/TestHostnameVerifier.java +++ b/httpclient/src/test/java/org/apache/http/conn/ssl/TestHostnameVerifier.java @@ -188,7 +188,7 @@ public class TestHostnameVerifier { final InputStream in = new ByteArrayInputStream(CertificatesToPlayWith.X509_MULTIPLE_SUBJECT_ALT); final X509Certificate x509 = (X509Certificate) cf.generateCertificate(in); - final X509HostnameVerifier verifier = SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER; + final X509HostnameVerifier verifier = BrowserCompatHostnameVerifier.INSTANCE; Assert.assertEquals("CN=localhost, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=CH", x509.getSubjectDN().getName());