Skip to content

Commit

Permalink
[CALCITE-4298] Avoid disabling hostname verification on HTTPS connect…
Browse files Browse the repository at this point in the history
…ions
  • Loading branch information
zabetak authored and julianhyde committed Sep 30, 2020
1 parent ab19f98 commit 43eeafc
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions core/src/main/java/org/apache/calcite/runtime/HttpUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@
import java.io.Writer;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;

/**
* Utilities for connecting to REST services such as Splunk via HTTP.
Expand All @@ -37,20 +35,7 @@ private HttpUtils() {}

public static HttpURLConnection getURLConnection(String url)
throws IOException {
URLConnection conn = new URL(url).openConnection();
final HttpURLConnection httpConn = (HttpURLConnection) conn;

// take care of https stuff - most of the time it's only needed to
// secure client/server comm
// not to establish the identity of the server
if (httpConn instanceof HttpsURLConnection) {
HttpsURLConnection httpsConn = (HttpsURLConnection) httpConn;
httpsConn.setSSLSocketFactory(
TrustAllSslSocketFactory.createSSLSocketFactory());
httpsConn.setHostnameVerifier((arg0, arg1) -> true);
}

return httpConn;
return (HttpURLConnection) new URL(url).openConnection();
}

public static void appendURLEncodedArgs(
Expand Down

0 comments on commit 43eeafc

Please sign in to comment.