HTTPCLIENT-738: Renamed o.a.http.conn.ssl.HostnameVerifier to o.a.http.conn.ssl.X509HostnameVerifier
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@618309 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
137da8207d
commit
4f6599c959
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue