Skip to content

Commit

Permalink
[Local Dev DO NOT MERGE] Use HTTP instead of HTTPS
Browse files Browse the repository at this point in the history
  • Loading branch information
olivrlee authored and tanclary committed Nov 14, 2024
1 parent 7275790 commit 6d827be
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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() {
Expand All @@ -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);
}
Expand All @@ -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()) {
Expand Down

0 comments on commit 6d827be

Please sign in to comment.