diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-01-10 14:18:57 +0100 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-01-10 14:30:34 +0100 |
commit | 0185e8a039281a1e12bab3c8c20399b75a0798f9 (patch) | |
tree | e334197f2d614165b0144400d04fbe99723cb172 /vespa-http-client | |
parent | 3e4b51c07bf72cb35e67dbb8b63c274ada397861 (diff) |
Upgrade Apache httpclient+httpcore to newest version
Use deprecated setSslcontext() in code that may run
outside JDisc.
Diffstat (limited to 'vespa-http-client')
-rw-r--r-- | vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java index 0e7488c8927..f59d4a4bbba 100644 --- a/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java +++ b/vespa-http-client/src/main/java/com/yahoo/vespa/http/client/core/communication/ApacheGatewayConnection.java @@ -23,6 +23,7 @@ import org.apache.http.entity.InputStreamEntity; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.message.BasicHeader; +import javax.net.ssl.SSLContext; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -413,7 +414,7 @@ class ApacheGatewayConnection implements GatewayConnection { } else { clientBuilder = HttpClientBuilder.create(); if (connectionParams.getSslContext() != null) { - clientBuilder.setSslcontext(connectionParams.getSslContext()); + setSslContext(clientBuilder, connectionParams.getSslContext()); } else { SslContextBuilder builder = new SslContextBuilder(); if (connectionParams.getPrivateKey() != null && connectionParams.getCertificate() != null) { @@ -422,7 +423,7 @@ class ApacheGatewayConnection implements GatewayConnection { if (connectionParams.getCaCertificates() != null) { builder.withTrustStore(connectionParams.getCaCertificates()); } - clientBuilder.setSslcontext(builder.build()); + setSslContext(clientBuilder, builder.build()); } if (connectionParams.getHostnameVerifier() != null) { clientBuilder.setSSLHostnameVerifier(connectionParams.getHostnameVerifier()); @@ -454,4 +455,10 @@ class ApacheGatewayConnection implements GatewayConnection { } } + // Note: Using deprecated setSslcontext() to allow httpclient 4.4 on classpath (e.g unexpected Maven dependency resolution for test classpath) + @SuppressWarnings("deprecation") + private static void setSslContext(HttpClientBuilder builder, SSLContext sslContext) { + builder.setSslcontext(sslContext); + } + } |