Re-use core URIScheme instead of String.
This commit is contained in:
parent
238401731b
commit
bc7aae743a
|
@ -118,9 +118,9 @@ public class SystemDefaultCredentialsProvider implements CredentialsStore {
|
|||
// https.proxyUser/https.proxyPassword. We cannot simply use the protocol from
|
||||
// the origin since a proxy retrieved from https.proxyHost/https.proxyPort will
|
||||
// still use http as protocol
|
||||
systemcreds = getProxyCredentials("http", authScope);
|
||||
systemcreds = getProxyCredentials(URIScheme.HTTP.getId(), authScope);
|
||||
if (systemcreds == null) {
|
||||
systemcreds = getProxyCredentials("https", authScope);
|
||||
systemcreds = getProxyCredentials(URIScheme.HTTPS.getId(), authScope);
|
||||
}
|
||||
}
|
||||
if (systemcreds != null) {
|
||||
|
|
|
@ -60,6 +60,7 @@ import org.apache.hc.core5.function.Resolver;
|
|||
import org.apache.hc.core5.http.HttpHost;
|
||||
import org.apache.hc.core5.http.HttpVersion;
|
||||
import org.apache.hc.core5.http.ProtocolVersion;
|
||||
import org.apache.hc.core5.http.URIScheme;
|
||||
import org.apache.hc.core5.http.config.Lookup;
|
||||
import org.apache.hc.core5.http.config.RegistryBuilder;
|
||||
import org.apache.hc.core5.http.nio.AsyncClientExchangeHandler;
|
||||
|
@ -128,7 +129,7 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
|
|||
|
||||
public PoolingAsyncClientConnectionManager() {
|
||||
this(RegistryBuilder.<TlsStrategy>create()
|
||||
.register("https", DefaultClientTlsStrategy.getDefault())
|
||||
.register(URIScheme.HTTPS.getId(), DefaultClientTlsStrategy.getDefault())
|
||||
.build());
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.apache.hc.client5.http.ssl.ConscryptClientTlsStrategy;
|
|||
import org.apache.hc.client5.http.ssl.DefaultClientTlsStrategy;
|
||||
import org.apache.hc.core5.function.Resolver;
|
||||
import org.apache.hc.core5.http.HttpHost;
|
||||
import org.apache.hc.core5.http.URIScheme;
|
||||
import org.apache.hc.core5.http.config.RegistryBuilder;
|
||||
import org.apache.hc.core5.http.io.SocketConfig;
|
||||
import org.apache.hc.core5.http.nio.ssl.TlsStrategy;
|
||||
|
@ -247,7 +248,7 @@ public class PoolingAsyncClientConnectionManagerBuilder {
|
|||
}
|
||||
final PoolingAsyncClientConnectionManager poolingmgr = new PoolingAsyncClientConnectionManager(
|
||||
RegistryBuilder.<TlsStrategy>create()
|
||||
.register("https", tlsStrategyCopy)
|
||||
.register(URIScheme.HTTPS.getId(), tlsStrategyCopy)
|
||||
.build(),
|
||||
poolConcurrencyPolicy,
|
||||
poolReusePolicy,
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.apache.hc.core5.annotation.ThreadingBehavior;
|
|||
import org.apache.hc.core5.http.HttpException;
|
||||
import org.apache.hc.core5.http.HttpHost;
|
||||
import org.apache.hc.core5.http.ProtocolException;
|
||||
import org.apache.hc.core5.http.URIScheme;
|
||||
import org.apache.hc.core5.http.protocol.HttpContext;
|
||||
|
||||
/**
|
||||
|
@ -75,7 +76,7 @@ public class DefaultRoutePlanner implements HttpRoutePlanner {
|
|||
if (target.getPort() < 0) {
|
||||
throw new ProtocolException("Unroutable protocol scheme: " + target);
|
||||
}
|
||||
final boolean secure = target.getSchemeName().equalsIgnoreCase("https");
|
||||
final boolean secure = target.getSchemeName().equalsIgnoreCase(URIScheme.HTTPS.getId());
|
||||
if (proxy == null) {
|
||||
return new HttpRoute(target, determineLocalAddress(target, context), secure);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue