Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit c4e162f

Browse files
authored
Merge pull request #542 from mariosmeim-db/fix-for-keepalivesocketfactory-regression
Fix for keepalivesocketfactory regression
2 parents 20d19f7 + 283fe48 commit c4e162f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

microsoft-azure-storage/src/com/microsoft/azure/storage/core/BaseRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ protected PasswordAuthentication getPasswordAuthentication() {
230230
*/
231231
if (retConnection instanceof HttpsURLConnection && !options.disableHttpsSocketKeepAlive()) {
232232
HttpsURLConnection httpsConnection = ((HttpsURLConnection) retConnection);
233-
httpsConnection.setSSLSocketFactory(new KeepAliveSocketFactory(httpsConnection.getSSLSocketFactory()));
233+
httpsConnection.setSSLSocketFactory(KeepAliveSocketFactory.getInstance());
234234
}
235235

236236
/*

microsoft-azure-storage/src/com/microsoft/azure/storage/core/KeepAliveSocketFactory.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
package com.microsoft.azure.storage.core;
1717

18+
import javax.net.ssl.HttpsURLConnection;
1819
import javax.net.ssl.SSLSocketFactory;
1920
import java.io.IOException;
2021
import java.net.InetAddress;
@@ -39,10 +40,16 @@
3940
public class KeepAliveSocketFactory extends SSLSocketFactory {
4041
private SSLSocketFactory delegate;
4142

43+
private static final KeepAliveSocketFactory singletonKeepAliveSocketFactory = new KeepAliveSocketFactory(HttpsURLConnection.getDefaultSSLSocketFactory());
44+
4245
KeepAliveSocketFactory(SSLSocketFactory delegate) {
4346
this.delegate = delegate;
4447
}
4548

49+
public static KeepAliveSocketFactory getInstance() {
50+
return singletonKeepAliveSocketFactory;
51+
}
52+
4653
@Override
4754
public String[] getDefaultCipherSuites() {
4855
return delegate.getDefaultCipherSuites();

0 commit comments

Comments
 (0)