Skip to content

Commit 24b13f9

Browse files
Fix for supplied SSLSocketFactory being ignored
It was checking if the connection is an instance of ```HttpURLConnection```, but since ```HttpsURLConnection``` extends ```HttpURLConnection``` it's always true and the else is never executed. #820
1 parent fb02867 commit 24b13f9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/DefaultHttpClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ HttpURLConnection openConnection(final URL finalURL)
9090
connection.setConnectTimeout(connectTimeout);
9191
connection.setReadTimeout(readTimeout);
9292

93-
if (connection instanceof HttpURLConnection) {
94-
return (HttpURLConnection) connection;
95-
} else {
93+
if (connection instanceof HttpsURLConnection) {
9694
HttpsURLConnection httpsConnection = (HttpsURLConnection) connection;
9795

9896
if (sslSocketFactory != null) {
9997
httpsConnection.setSSLSocketFactory(sslSocketFactory);
10098
}
10199

102100
return httpsConnection;
101+
} else {
102+
return (HttpURLConnection) connection;
103103
}
104104
}
105105

0 commit comments

Comments
 (0)