@Singleton @Provides X509HostnameVerifier newHostnameVerifier(HttpUtils utils) { return utils.relaxHostname() ? SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER : SSLSocketFactory.STRICT_HOSTNAME_VERIFIER; }
@Singleton @Provides final X509HostnameVerifier newHostnameVerifier(HttpUtils utils) { return utils.relaxHostname() ? SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER : SSLSocketFactory.STRICT_HOSTNAME_VERIFIER; }
@Singleton @Provides final X509HostnameVerifier newHostnameVerifier(HttpUtils utils) { return utils.relaxHostname() ? SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER : SSLSocketFactory.STRICT_HOSTNAME_VERIFIER; }
@Singleton @Provides X509HostnameVerifier newHostnameVerifier(HttpUtils utils) { return utils.relaxHostname() ? SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER : SSLSocketFactory.STRICT_HOSTNAME_VERIFIER; }
/** * Creates and initializes the connection. */ protected HttpURLConnection initConnection(HttpRequest request) throws IOException { URL url = request.getEndpoint().toURL(); HttpURLConnection connection = (HttpURLConnection) url.openConnection(proxyForURI.apply(request.getEndpoint())); if (connection instanceof HttpsURLConnection) { HttpsURLConnection sslCon = (HttpsURLConnection) connection; if (utils.relaxHostname()) sslCon.setHostnameVerifier(verifier); if (sslContextSupplier != null) { // used for providers which e.g. use certs for authentication (like FGCP) // Provider provides SSLContext impl (which inits context with key manager) sslCon.setSSLSocketFactory(sslContextSupplier.get().getSocketFactory()); } else if (utils.trustAllCerts()) { sslCon.setSSLSocketFactory(untrustedSSLContextProvider.get().getSocketFactory()); } } return connection; }
/** * Creates and initializes the connection. */ protected HttpURLConnection initConnection(HttpRequest request) throws IOException { URL url = request.getEndpoint().toURL(); HttpURLConnection connection = (HttpURLConnection) url.openConnection(proxyForURI.apply(request.getEndpoint())); if (connection instanceof HttpsURLConnection) { HttpsURLConnection sslCon = (HttpsURLConnection) connection; if (utils.relaxHostname()) sslCon.setHostnameVerifier(verifier); if (sslContextSupplier != null) { // used for providers which e.g. use certs for authentication (like FGCP) // Provider provides SSLContext impl (which inits context with key manager) sslCon.setSSLSocketFactory(sslContextSupplier.get().getSocketFactory()); } else if (utils.trustAllCerts()) { sslCon.setSSLSocketFactory(untrustedSSLContextProvider.get().getSocketFactory()); } } return connection; }
/** * Creates and initializes the connection. */ protected HttpURLConnection initConnection(HttpRequest request) throws IOException { URL url = request.getEndpoint().toURL(); HttpURLConnection connection = (HttpURLConnection) url.openConnection(proxyForURI.apply(request.getEndpoint())); if (connection instanceof HttpsURLConnection) { HttpsURLConnection sslCon = (HttpsURLConnection) connection; if (utils.relaxHostname()) sslCon.setHostnameVerifier(verifier); if (sslContextSupplier != null) { // used for providers which e.g. use certs for authentication (like FGCP) // Provider provides SSLContext impl (which inits context with key manager) sslCon.setSSLSocketFactory(sslContextSupplier.get().getSocketFactory()); } else if (utils.trustAllCerts()) { sslCon.setSSLSocketFactory(untrustedSSLContextProvider.get().getSocketFactory()); } } return connection; }
/** * Creates and initializes the connection. */ protected HttpURLConnection initConnection(HttpRequest request) throws IOException { URL url = request.getEndpoint().toURL(); HttpURLConnection connection = (HttpURLConnection) url.openConnection(proxyForURI.apply(request.getEndpoint())); if (connection instanceof HttpsURLConnection) { HttpsURLConnection sslCon = (HttpsURLConnection) connection; if (utils.relaxHostname()) sslCon.setHostnameVerifier(verifier); if (sslContextSupplier != null) { // used for providers which e.g. use certs for authentication (like FGCP) // Provider provides SSLContext impl (which inits context with key manager) sslCon.setSSLSocketFactory(sslContextSupplier.get().getSocketFactory()); } else if (utils.trustAllCerts()) { sslCon.setSSLSocketFactory(untrustedSSLContextProvider.get().getSocketFactory()); } } return connection; }
if (connection instanceof HttpsURLConnection) { HttpsURLConnection sslCon = (HttpsURLConnection) connection; if (utils.relaxHostname()) sslCon.setHostnameVerifier(verifier); if (sslContextSupplier != null) {
if (connection instanceof HttpsURLConnection) { HttpsURLConnection sslCon = (HttpsURLConnection) connection; if (utils.relaxHostname()) sslCon.setHostnameVerifier(verifier); if (sslContextSupplier != null) {
@Override public OkHttpClient get() { OkHttpClient client = clientSupplier.get(); client.setConnectTimeout(utils.getConnectionTimeout(), TimeUnit.MILLISECONDS); client.setReadTimeout(utils.getSocketOpenTimeout(), TimeUnit.MILLISECONDS); // do not follow redirects since https redirects don't work properly // ex. Caused by: java.io.IOException: HTTPS hostname wrong: should be // <adriancole.s3int0.s3-external-3.amazonaws.com> client.setFollowRedirects(false); if (utils.relaxHostname()) { client.setHostnameVerifier(verifier); } if (utils.trustAllCerts()) { client.setSslSocketFactory(untrustedSSLContextProvider.get().getSocketFactory()); } return client; } }
if (utils.relaxHostname() || utils.trustAllCerts()) options.doNotFollowRedirects(); options.setDeadline(10.0);
if (utils.relaxHostname() || utils.trustAllCerts()) options.doNotFollowRedirects(); options.setDeadline(10.0);