HTTPCLIENT-1595: respect SSL protocols disabled by default by the provider

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1650758 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2015-01-10 15:50:04 +00:00
parent a0dee0cb50
commit bc2b4930bd
1 changed files with 4 additions and 2 deletions

View File

@ -370,14 +370,16 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor
sslsock.setEnabledProtocols(supportedProtocols);
} else {
// If supported protocols are not explicitly set, remove all SSL protocol versions
final String[] allProtocols = sslsock.getSupportedProtocols();
final String[] allProtocols = sslsock.getEnabledProtocols();
final List<String> enabledProtocols = new ArrayList<String>(allProtocols.length);
for (String protocol: allProtocols) {
if (!protocol.startsWith("SSL")) {
enabledProtocols.add(protocol);
}
}
sslsock.setEnabledProtocols(enabledProtocols.toArray(new String[enabledProtocols.size()]));
if (!enabledProtocols.isEmpty()) {
sslsock.setEnabledProtocols(enabledProtocols.toArray(new String[enabledProtocols.size()]));
}
}
if (supportedCipherSuites != null) {
sslsock.setEnabledCipherSuites(supportedCipherSuites);