diff --git a/module-client/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java b/module-client/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java index ca01b4117..59b20f243 100644 --- a/module-client/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java +++ b/module-client/src/main/java/org/apache/http/conn/ssl/AbstractVerifier.java @@ -50,12 +50,12 @@ import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; /** - * Abstract base class for all standard {@link HostnameVerifier} + * Abstract base class for all standard {@link X509HostnameVerifier} * implementations. * * @author Julius Davies */ -public abstract class AbstractVerifier implements HostnameVerifier { +public abstract class AbstractVerifier implements X509HostnameVerifier { /** * This contains a list of 2nd-level domains that aren't allowed to diff --git a/module-client/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java b/module-client/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java index b9fec69ae..d46996a40 100644 --- a/module-client/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java +++ b/module-client/src/main/java/org/apache/http/conn/ssl/SSLSocketFactory.java @@ -141,13 +141,13 @@ public class SSLSocketFactory implements LayeredSocketFactory { public static final String SSL = "SSL"; public static final String SSLV2 = "SSLv2"; - public static final HostnameVerifier ALLOW_ALL_HOSTNAME_VERIFIER + public static final X509HostnameVerifier ALLOW_ALL_HOSTNAME_VERIFIER = new AllowAllHostnameVerifier(); - public static final HostnameVerifier BROWSER_COMPATIBLE_HOSTNAME_VERIFIER + public static final X509HostnameVerifier BROWSER_COMPATIBLE_HOSTNAME_VERIFIER = new BrowserCompatHostnameVerifier(); - public static final HostnameVerifier STRICT_HOSTNAME_VERIFIER + public static final X509HostnameVerifier STRICT_HOSTNAME_VERIFIER = new StrictHostnameVerifier(); /** * The factory using the default JVM settings for secure connections. @@ -164,7 +164,7 @@ public class SSLSocketFactory implements LayeredSocketFactory { private final SSLContext sslcontext; private final javax.net.ssl.SSLSocketFactory socketfactory; - private HostnameVerifier hostnameVerifier = BROWSER_COMPATIBLE_HOSTNAME_VERIFIER; + private X509HostnameVerifier hostnameVerifier = BROWSER_COMPATIBLE_HOSTNAME_VERIFIER; public SSLSocketFactory( String algorithm, @@ -360,14 +360,14 @@ public class SSLSocketFactory implements LayeredSocketFactory { return sslSocket; } - public void setHostnameVerifier(HostnameVerifier hostnameVerifier) { + public void setHostnameVerifier(X509HostnameVerifier hostnameVerifier) { if ( hostnameVerifier == null ) { throw new IllegalArgumentException("Hostname verifier may not be null"); } this.hostnameVerifier = hostnameVerifier; } - public HostnameVerifier getHostnameVerifier() { + public X509HostnameVerifier getHostnameVerifier() { return hostnameVerifier; } diff --git a/module-client/src/main/java/org/apache/http/conn/ssl/HostnameVerifier.java b/module-client/src/main/java/org/apache/http/conn/ssl/X509HostnameVerifier.java similarity index 96% rename from module-client/src/main/java/org/apache/http/conn/ssl/HostnameVerifier.java rename to module-client/src/main/java/org/apache/http/conn/ssl/X509HostnameVerifier.java index 38adb2d42..07e064e8a 100644 --- a/module-client/src/main/java/org/apache/http/conn/ssl/HostnameVerifier.java +++ b/module-client/src/main/java/org/apache/http/conn/ssl/X509HostnameVerifier.java @@ -31,6 +31,7 @@ package org.apache.http.conn.ssl; +import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLException; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; @@ -56,7 +57,7 @@ import java.security.cert.X509Certificate; * * @since 4.0 (8-Dec-2006) */ -public interface HostnameVerifier extends javax.net.ssl.HostnameVerifier { +public interface X509HostnameVerifier extends HostnameVerifier { boolean verify(String host, SSLSession session); diff --git a/module-client/src/test/java/org/apache/http/conn/ssl/TestHostnameVerifier.java b/module-client/src/test/java/org/apache/http/conn/ssl/TestHostnameVerifier.java index e6146cb0e..ffb78ea28 100644 --- a/module-client/src/test/java/org/apache/http/conn/ssl/TestHostnameVerifier.java +++ b/module-client/src/test/java/org/apache/http/conn/ssl/TestHostnameVerifier.java @@ -43,7 +43,7 @@ import junit.framework.TestCase; import junit.framework.TestSuite; /** - * Unit tests for {@link HostnameVerifier}. + * Unit tests for {@link X509HostnameVerifier}. * * @author Julius Davies * @since 11-Dec-2006 @@ -67,9 +67,9 @@ public class TestHostnameVerifier extends TestCase } public void testVerify() throws Exception { - HostnameVerifier DEFAULT = new BrowserCompatHostnameVerifier(); - HostnameVerifier STRICT = new StrictHostnameVerifier(); - HostnameVerifier ALLOW_ALL = new AllowAllHostnameVerifier(); + X509HostnameVerifier DEFAULT = new BrowserCompatHostnameVerifier(); + X509HostnameVerifier STRICT = new StrictHostnameVerifier(); + X509HostnameVerifier ALLOW_ALL = new AllowAllHostnameVerifier(); CertificateFactory cf = CertificateFactory.getInstance("X.509"); InputStream in; X509Certificate x509; @@ -210,7 +210,7 @@ public class TestHostnameVerifier extends TestCase //exceptionPlease(STRICT,"a.b.\u82b1\u5b50.co.jp", x509 ); } - private void exceptionPlease(HostnameVerifier hv, String host, + private void exceptionPlease(X509HostnameVerifier hv, String host, X509Certificate x509) { try { hv.verify(host, x509);