Upgrade to HttpClient5 5.3
Closes gh-39007
This commit is contained in:
@@ -21,6 +21,7 @@ import java.net.URI;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.time.Duration;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
@@ -40,11 +41,11 @@ import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuil
|
||||
import org.apache.hc.client5.http.protocol.HttpClientContext;
|
||||
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
|
||||
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder;
|
||||
import org.apache.hc.client5.http.ssl.TrustSelfSignedStrategy;
|
||||
import org.apache.hc.core5.http.io.SocketConfig;
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
import org.apache.hc.core5.http.ssl.TLS;
|
||||
import org.apache.hc.core5.ssl.SSLContextBuilder;
|
||||
import org.apache.hc.core5.ssl.TrustStrategy;
|
||||
|
||||
import org.springframework.boot.web.client.ClientHttpRequestFactorySettings;
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
@@ -993,7 +994,7 @@ public class TestRestTemplate {
|
||||
ENABLE_REDIRECTS,
|
||||
|
||||
/**
|
||||
* Use a {@link SSLConnectionSocketFactory} with {@link TrustSelfSignedStrategy}.
|
||||
* Use a {@link SSLConnectionSocketFactory} that trusts self-signed certificates.
|
||||
*/
|
||||
SSL
|
||||
|
||||
@@ -1085,4 +1086,13 @@ public class TestRestTemplate {
|
||||
|
||||
}
|
||||
|
||||
private static class TrustSelfSignedStrategy implements TrustStrategy {
|
||||
|
||||
@Override
|
||||
public boolean isTrusted(X509Certificate[] chain, String authType) {
|
||||
return chain.length == 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user