mirror of
https://github.com/apache/httpcomponents-client.git
synced 2025-02-20 08:56:02 +00:00
Fixed initialization of SSL supported protocols and cipher suites
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1528736 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
08140864e3
commit
75937296d9
@ -35,6 +35,7 @@
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.SSLSocketFactory;
|
||||||
|
|
||||||
import org.apache.http.ConnectionReuseStrategy;
|
import org.apache.http.ConnectionReuseStrategy;
|
||||||
import org.apache.http.Header;
|
import org.apache.http.Header;
|
||||||
@ -699,19 +700,22 @@ public CloseableHttpClient build() {
|
|||||||
if (connManager == null) {
|
if (connManager == null) {
|
||||||
LayeredConnectionSocketFactory sslSocketFactory = this.sslSocketFactory;
|
LayeredConnectionSocketFactory sslSocketFactory = this.sslSocketFactory;
|
||||||
if (sslSocketFactory == null) {
|
if (sslSocketFactory == null) {
|
||||||
|
final String[] supportedProtocols = systemProperties ? split(
|
||||||
|
System.getProperty("https.protocols")) : null;
|
||||||
|
final String[] supportedCipherSuites = systemProperties ? split(
|
||||||
|
System.getProperty("https.cipherSuites")) : null;
|
||||||
X509HostnameVerifier hostnameVerifier = this.hostnameVerifier;
|
X509HostnameVerifier hostnameVerifier = this.hostnameVerifier;
|
||||||
if (hostnameVerifier == null) {
|
if (hostnameVerifier == null) {
|
||||||
hostnameVerifier = SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER;
|
hostnameVerifier = SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER;
|
||||||
}
|
}
|
||||||
if (sslcontext != null) {
|
if (sslcontext != null) {
|
||||||
sslSocketFactory = new SSLConnectionSocketFactory(sslcontext, hostnameVerifier);
|
sslSocketFactory = new SSLConnectionSocketFactory(
|
||||||
|
sslcontext, supportedProtocols, supportedCipherSuites, hostnameVerifier);
|
||||||
} else {
|
} else {
|
||||||
if (systemProperties) {
|
if (systemProperties) {
|
||||||
sslSocketFactory = new SSLConnectionSocketFactory(
|
sslSocketFactory = new SSLConnectionSocketFactory(
|
||||||
(javax.net.ssl.SSLSocketFactory) javax.net.ssl.SSLSocketFactory.getDefault(),
|
(SSLSocketFactory) SSLSocketFactory.getDefault(),
|
||||||
split(System.getProperty("https.protocols")),
|
supportedProtocols, supportedCipherSuites, hostnameVerifier);
|
||||||
split(System.getProperty("https.cipherSuites")),
|
|
||||||
hostnameVerifier);
|
|
||||||
} else {
|
} else {
|
||||||
sslSocketFactory = new SSLConnectionSocketFactory(
|
sslSocketFactory = new SSLConnectionSocketFactory(
|
||||||
SSLContexts.createDefault(),
|
SSLContexts.createDefault(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user