From 6d827be26bf16c73cb9248f24b421369792e4ec7 Mon Sep 17 00:00:00 2001 From: Oliver Lee Date: Wed, 20 Mar 2024 21:45:09 +0000 Subject: [PATCH] [Local Dev DO NOT MERGE] Use HTTP instead of HTTPS --- .../avatica/remote/looker/LookerRemoteMeta.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/apache/calcite/avatica/remote/looker/LookerRemoteMeta.java b/core/src/main/java/org/apache/calcite/avatica/remote/looker/LookerRemoteMeta.java index 62df7bdd05..af5c788d32 100644 --- a/core/src/main/java/org/apache/calcite/avatica/remote/looker/LookerRemoteMeta.java +++ b/core/src/main/java/org/apache/calcite/avatica/remote/looker/LookerRemoteMeta.java @@ -37,6 +37,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.StandardCharsets; import java.security.KeyManagementException; @@ -51,7 +52,6 @@ import java.util.concurrent.ConcurrentMap; import java.util.stream.Collectors; import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; @@ -124,7 +124,7 @@ public static final LookerFrame create(Long sqlInterfaceQueryId) { /** * Helper to disable any SSL and hostname verification when `verifySSL` is false. */ - private void trustAllHosts(HttpsURLConnection connection) { + private void trustAllHosts(HttpURLConnection connection) { // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[]{ new X509TrustManager() { @@ -146,8 +146,8 @@ public void checkServerTrusted(java.security.cert.X509Certificate[] certs, try { SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); - connection.setSSLSocketFactory(sc.getSocketFactory()); - connection.setHostnameVerifier(trustAllHostNames); + // connection.setSSLSocketFactory(sc.getSocketFactory()); + // connection.setHostnameVerifier(trustAllHostNames); } catch (NoSuchAlgorithmException | KeyManagementException e) { throw new RuntimeException(e); } @@ -169,7 +169,7 @@ protected InputStream makeRunQueryRequest(String url) throws IOException, SQLExc // makes a proper URL from the API endpoint path as the SDK would. String endpoint = sdkTransport.makeUrl(url, Collections.emptyMap(), null); URL httpsUrl = new URL(endpoint); - HttpsURLConnection connection = (HttpsURLConnection) httpsUrl.openConnection(); + HttpURLConnection connection = (HttpURLConnection) httpsUrl.openConnection(); // WARNING: You should only set `verifySSL=false` for local/dev instances!! if (!sdkTransport.getOptions().getVerifySSL()) {