Upgrade to HttpClient5 5.3.1

Closes gh-39703
This commit is contained in:
Andy Wilkinson
2024-02-22 07:58:49 +00:00
parent a52cc64701
commit 102215ee96
4 changed files with 28 additions and 13 deletions

View File

@@ -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 final class TrustSelfSignedStrategy implements TrustStrategy {
@Override
public boolean isTrusted(X509Certificate[] chain, String authType) {
return chain.length == 1;
}
}
}