- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
435 lines
16 KiB
Java
435 lines
16 KiB
Java
package okhttp3;
|
|
|
|
import java.net.Proxy;
|
|
import java.net.ProxySelector;
|
|
import java.security.GeneralSecurityException;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.concurrent.TimeUnit;
|
|
import javax.net.SocketFactory;
|
|
import javax.net.ssl.HostnameVerifier;
|
|
import javax.net.ssl.SSLContext;
|
|
import javax.net.ssl.SSLSocket;
|
|
import javax.net.ssl.SSLSocketFactory;
|
|
import javax.net.ssl.TrustManager;
|
|
import javax.net.ssl.X509TrustManager;
|
|
import okhttp3.Call;
|
|
import okhttp3.EventListener;
|
|
import okhttp3.Headers;
|
|
import okhttp3.Response;
|
|
import okhttp3.internal.Internal;
|
|
import okhttp3.internal.Util;
|
|
import okhttp3.internal.cache.InternalCache;
|
|
import okhttp3.internal.connection.Exchange;
|
|
import okhttp3.internal.connection.RealConnectionPool;
|
|
import okhttp3.internal.platform.Platform;
|
|
import okhttp3.internal.proxy.NullProxySelector;
|
|
import okhttp3.internal.tls.CertificateChainCleaner;
|
|
import okhttp3.internal.tls.OkHostnameVerifier;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public class OkHttpClient implements Cloneable, Call.Factory {
|
|
public final Authenticator authenticator;
|
|
public final Cache cache;
|
|
public final int callTimeout;
|
|
public final CertificateChainCleaner certificateChainCleaner;
|
|
public final CertificatePinner certificatePinner;
|
|
public final int connectTimeout;
|
|
public final ConnectionPool connectionPool;
|
|
public final List connectionSpecs;
|
|
public final CookieJar cookieJar;
|
|
public final Dispatcher dispatcher;
|
|
public final Dns dns;
|
|
public final EventListener.Factory eventListenerFactory;
|
|
public final boolean followRedirects;
|
|
public final boolean followSslRedirects;
|
|
public final HostnameVerifier hostnameVerifier;
|
|
public final List interceptors;
|
|
public final InternalCache internalCache;
|
|
public final List networkInterceptors;
|
|
public final int pingInterval;
|
|
public final List protocols;
|
|
public final Proxy proxy;
|
|
public final Authenticator proxyAuthenticator;
|
|
public final ProxySelector proxySelector;
|
|
public final int readTimeout;
|
|
public final boolean retryOnConnectionFailure;
|
|
public final SocketFactory socketFactory;
|
|
public final SSLSocketFactory sslSocketFactory;
|
|
public final int writeTimeout;
|
|
public static final List DEFAULT_PROTOCOLS = Util.immutableList(Protocol.HTTP_2, Protocol.HTTP_1_1);
|
|
public static final List DEFAULT_CONNECTION_SPECS = Util.immutableList(ConnectionSpec.MODERN_TLS, ConnectionSpec.CLEARTEXT);
|
|
|
|
public Authenticator authenticator() {
|
|
return this.authenticator;
|
|
}
|
|
|
|
public int callTimeoutMillis() {
|
|
return this.callTimeout;
|
|
}
|
|
|
|
public CertificatePinner certificatePinner() {
|
|
return this.certificatePinner;
|
|
}
|
|
|
|
public int connectTimeoutMillis() {
|
|
return this.connectTimeout;
|
|
}
|
|
|
|
public ConnectionPool connectionPool() {
|
|
return this.connectionPool;
|
|
}
|
|
|
|
public List connectionSpecs() {
|
|
return this.connectionSpecs;
|
|
}
|
|
|
|
public CookieJar cookieJar() {
|
|
return this.cookieJar;
|
|
}
|
|
|
|
public Dispatcher dispatcher() {
|
|
return this.dispatcher;
|
|
}
|
|
|
|
public Dns dns() {
|
|
return this.dns;
|
|
}
|
|
|
|
public EventListener.Factory eventListenerFactory() {
|
|
return this.eventListenerFactory;
|
|
}
|
|
|
|
public boolean followRedirects() {
|
|
return this.followRedirects;
|
|
}
|
|
|
|
public boolean followSslRedirects() {
|
|
return this.followSslRedirects;
|
|
}
|
|
|
|
public HostnameVerifier hostnameVerifier() {
|
|
return this.hostnameVerifier;
|
|
}
|
|
|
|
public List interceptors() {
|
|
return this.interceptors;
|
|
}
|
|
|
|
public List networkInterceptors() {
|
|
return this.networkInterceptors;
|
|
}
|
|
|
|
public int pingIntervalMillis() {
|
|
return this.pingInterval;
|
|
}
|
|
|
|
public List protocols() {
|
|
return this.protocols;
|
|
}
|
|
|
|
public Proxy proxy() {
|
|
return this.proxy;
|
|
}
|
|
|
|
public Authenticator proxyAuthenticator() {
|
|
return this.proxyAuthenticator;
|
|
}
|
|
|
|
public ProxySelector proxySelector() {
|
|
return this.proxySelector;
|
|
}
|
|
|
|
public int readTimeoutMillis() {
|
|
return this.readTimeout;
|
|
}
|
|
|
|
public boolean retryOnConnectionFailure() {
|
|
return this.retryOnConnectionFailure;
|
|
}
|
|
|
|
public SocketFactory socketFactory() {
|
|
return this.socketFactory;
|
|
}
|
|
|
|
public SSLSocketFactory sslSocketFactory() {
|
|
return this.sslSocketFactory;
|
|
}
|
|
|
|
public int writeTimeoutMillis() {
|
|
return this.writeTimeout;
|
|
}
|
|
|
|
static {
|
|
Internal.instance = new Internal() { // from class: okhttp3.OkHttpClient.1
|
|
@Override // okhttp3.internal.Internal
|
|
public void addLenient(Headers.Builder builder, String str) {
|
|
builder.addLenient(str);
|
|
}
|
|
|
|
@Override // okhttp3.internal.Internal
|
|
public void addLenient(Headers.Builder builder, String str, String str2) {
|
|
builder.addLenient(str, str2);
|
|
}
|
|
|
|
@Override // okhttp3.internal.Internal
|
|
public RealConnectionPool realConnectionPool(ConnectionPool connectionPool) {
|
|
return connectionPool.delegate;
|
|
}
|
|
|
|
@Override // okhttp3.internal.Internal
|
|
public boolean equalsNonHost(Address address, Address address2) {
|
|
return address.equalsNonHost(address2);
|
|
}
|
|
|
|
@Override // okhttp3.internal.Internal
|
|
public int code(Response.Builder builder) {
|
|
return builder.code;
|
|
}
|
|
|
|
@Override // okhttp3.internal.Internal
|
|
public void apply(ConnectionSpec connectionSpec, SSLSocket sSLSocket, boolean z) {
|
|
connectionSpec.apply(sSLSocket, z);
|
|
}
|
|
|
|
@Override // okhttp3.internal.Internal
|
|
public void initExchange(Response.Builder builder, Exchange exchange) {
|
|
builder.initExchange(exchange);
|
|
}
|
|
|
|
@Override // okhttp3.internal.Internal
|
|
public Exchange exchange(Response response) {
|
|
return response.exchange;
|
|
}
|
|
};
|
|
}
|
|
|
|
public OkHttpClient() {
|
|
this(new Builder());
|
|
}
|
|
|
|
public OkHttpClient(Builder builder) {
|
|
boolean z;
|
|
this.dispatcher = builder.dispatcher;
|
|
this.proxy = builder.proxy;
|
|
this.protocols = builder.protocols;
|
|
List list = builder.connectionSpecs;
|
|
this.connectionSpecs = list;
|
|
this.interceptors = Util.immutableList(builder.interceptors);
|
|
this.networkInterceptors = Util.immutableList(builder.networkInterceptors);
|
|
this.eventListenerFactory = builder.eventListenerFactory;
|
|
this.proxySelector = builder.proxySelector;
|
|
this.cookieJar = builder.cookieJar;
|
|
this.cache = builder.cache;
|
|
this.internalCache = builder.internalCache;
|
|
this.socketFactory = builder.socketFactory;
|
|
Iterator it = list.iterator();
|
|
loop0: while (true) {
|
|
z = false;
|
|
while (it.hasNext()) {
|
|
z = (z || ((ConnectionSpec) it.next()).isTls()) ? true : z;
|
|
}
|
|
}
|
|
SSLSocketFactory sSLSocketFactory = builder.sslSocketFactory;
|
|
if (sSLSocketFactory != null || !z) {
|
|
this.sslSocketFactory = sSLSocketFactory;
|
|
this.certificateChainCleaner = builder.certificateChainCleaner;
|
|
} else {
|
|
X509TrustManager platformTrustManager = Util.platformTrustManager();
|
|
this.sslSocketFactory = newSslSocketFactory(platformTrustManager);
|
|
this.certificateChainCleaner = CertificateChainCleaner.get(platformTrustManager);
|
|
}
|
|
if (this.sslSocketFactory != null) {
|
|
Platform.get().configureSslSocketFactory(this.sslSocketFactory);
|
|
}
|
|
this.hostnameVerifier = builder.hostnameVerifier;
|
|
this.certificatePinner = builder.certificatePinner.withCertificateChainCleaner(this.certificateChainCleaner);
|
|
this.proxyAuthenticator = builder.proxyAuthenticator;
|
|
this.authenticator = builder.authenticator;
|
|
this.connectionPool = builder.connectionPool;
|
|
this.dns = builder.dns;
|
|
this.followSslRedirects = builder.followSslRedirects;
|
|
this.followRedirects = builder.followRedirects;
|
|
this.retryOnConnectionFailure = builder.retryOnConnectionFailure;
|
|
this.callTimeout = builder.callTimeout;
|
|
this.connectTimeout = builder.connectTimeout;
|
|
this.readTimeout = builder.readTimeout;
|
|
this.writeTimeout = builder.writeTimeout;
|
|
this.pingInterval = builder.pingInterval;
|
|
if (this.interceptors.contains(null)) {
|
|
throw new IllegalStateException("Null interceptor: " + this.interceptors);
|
|
}
|
|
if (this.networkInterceptors.contains(null)) {
|
|
throw new IllegalStateException("Null network interceptor: " + this.networkInterceptors);
|
|
}
|
|
}
|
|
|
|
public static SSLSocketFactory newSslSocketFactory(X509TrustManager x509TrustManager) {
|
|
try {
|
|
SSLContext sSLContext = Platform.get().getSSLContext();
|
|
sSLContext.init(null, new TrustManager[]{x509TrustManager}, null);
|
|
return sSLContext.getSocketFactory();
|
|
} catch (GeneralSecurityException e) {
|
|
throw new AssertionError("No System TLS", e);
|
|
}
|
|
}
|
|
|
|
public InternalCache internalCache() {
|
|
Cache cache = this.cache;
|
|
return cache != null ? cache.internalCache : this.internalCache;
|
|
}
|
|
|
|
@Override // okhttp3.Call.Factory
|
|
public Call newCall(Request request) {
|
|
return RealCall.newRealCall(this, request, false);
|
|
}
|
|
|
|
public Builder newBuilder() {
|
|
return new Builder(this);
|
|
}
|
|
|
|
public static final class Builder {
|
|
public Authenticator authenticator;
|
|
public Cache cache;
|
|
public int callTimeout;
|
|
public CertificateChainCleaner certificateChainCleaner;
|
|
public CertificatePinner certificatePinner;
|
|
public int connectTimeout;
|
|
public ConnectionPool connectionPool;
|
|
public List connectionSpecs;
|
|
public CookieJar cookieJar;
|
|
public Dispatcher dispatcher;
|
|
public Dns dns;
|
|
public EventListener.Factory eventListenerFactory;
|
|
public boolean followRedirects;
|
|
public boolean followSslRedirects;
|
|
public HostnameVerifier hostnameVerifier;
|
|
public final List interceptors;
|
|
public InternalCache internalCache;
|
|
public final List networkInterceptors;
|
|
public int pingInterval;
|
|
public List protocols;
|
|
public Proxy proxy;
|
|
public Authenticator proxyAuthenticator;
|
|
public ProxySelector proxySelector;
|
|
public int readTimeout;
|
|
public boolean retryOnConnectionFailure;
|
|
public SocketFactory socketFactory;
|
|
public SSLSocketFactory sslSocketFactory;
|
|
public int writeTimeout;
|
|
|
|
public Builder cache(Cache cache) {
|
|
this.cache = cache;
|
|
this.internalCache = null;
|
|
return this;
|
|
}
|
|
|
|
public Builder followRedirects(boolean z) {
|
|
this.followRedirects = z;
|
|
return this;
|
|
}
|
|
|
|
public Builder followSslRedirects(boolean z) {
|
|
this.followSslRedirects = z;
|
|
return this;
|
|
}
|
|
|
|
public Builder() {
|
|
this.interceptors = new ArrayList();
|
|
this.networkInterceptors = new ArrayList();
|
|
this.dispatcher = new Dispatcher();
|
|
this.protocols = OkHttpClient.DEFAULT_PROTOCOLS;
|
|
this.connectionSpecs = OkHttpClient.DEFAULT_CONNECTION_SPECS;
|
|
this.eventListenerFactory = EventListener.factory(EventListener.NONE);
|
|
ProxySelector proxySelector = ProxySelector.getDefault();
|
|
this.proxySelector = proxySelector;
|
|
if (proxySelector == null) {
|
|
this.proxySelector = new NullProxySelector();
|
|
}
|
|
this.cookieJar = CookieJar.NO_COOKIES;
|
|
this.socketFactory = SocketFactory.getDefault();
|
|
this.hostnameVerifier = OkHostnameVerifier.INSTANCE;
|
|
this.certificatePinner = CertificatePinner.DEFAULT;
|
|
Authenticator authenticator = Authenticator.NONE;
|
|
this.proxyAuthenticator = authenticator;
|
|
this.authenticator = authenticator;
|
|
this.connectionPool = new ConnectionPool();
|
|
this.dns = Dns.SYSTEM;
|
|
this.followSslRedirects = true;
|
|
this.followRedirects = true;
|
|
this.retryOnConnectionFailure = true;
|
|
this.callTimeout = 0;
|
|
this.connectTimeout = 10000;
|
|
this.readTimeout = 10000;
|
|
this.writeTimeout = 10000;
|
|
this.pingInterval = 0;
|
|
}
|
|
|
|
public Builder(OkHttpClient okHttpClient) {
|
|
ArrayList arrayList = new ArrayList();
|
|
this.interceptors = arrayList;
|
|
ArrayList arrayList2 = new ArrayList();
|
|
this.networkInterceptors = arrayList2;
|
|
this.dispatcher = okHttpClient.dispatcher;
|
|
this.proxy = okHttpClient.proxy;
|
|
this.protocols = okHttpClient.protocols;
|
|
this.connectionSpecs = okHttpClient.connectionSpecs;
|
|
arrayList.addAll(okHttpClient.interceptors);
|
|
arrayList2.addAll(okHttpClient.networkInterceptors);
|
|
this.eventListenerFactory = okHttpClient.eventListenerFactory;
|
|
this.proxySelector = okHttpClient.proxySelector;
|
|
this.cookieJar = okHttpClient.cookieJar;
|
|
this.internalCache = okHttpClient.internalCache;
|
|
this.cache = okHttpClient.cache;
|
|
this.socketFactory = okHttpClient.socketFactory;
|
|
this.sslSocketFactory = okHttpClient.sslSocketFactory;
|
|
this.certificateChainCleaner = okHttpClient.certificateChainCleaner;
|
|
this.hostnameVerifier = okHttpClient.hostnameVerifier;
|
|
this.certificatePinner = okHttpClient.certificatePinner;
|
|
this.proxyAuthenticator = okHttpClient.proxyAuthenticator;
|
|
this.authenticator = okHttpClient.authenticator;
|
|
this.connectionPool = okHttpClient.connectionPool;
|
|
this.dns = okHttpClient.dns;
|
|
this.followSslRedirects = okHttpClient.followSslRedirects;
|
|
this.followRedirects = okHttpClient.followRedirects;
|
|
this.retryOnConnectionFailure = okHttpClient.retryOnConnectionFailure;
|
|
this.callTimeout = okHttpClient.callTimeout;
|
|
this.connectTimeout = okHttpClient.connectTimeout;
|
|
this.readTimeout = okHttpClient.readTimeout;
|
|
this.writeTimeout = okHttpClient.writeTimeout;
|
|
this.pingInterval = okHttpClient.pingInterval;
|
|
}
|
|
|
|
public Builder connectTimeout(long j, TimeUnit timeUnit) {
|
|
this.connectTimeout = Util.checkDuration("timeout", j, timeUnit);
|
|
return this;
|
|
}
|
|
|
|
public Builder readTimeout(long j, TimeUnit timeUnit) {
|
|
this.readTimeout = Util.checkDuration("timeout", j, timeUnit);
|
|
return this;
|
|
}
|
|
|
|
public Builder proxySelector(ProxySelector proxySelector) {
|
|
if (proxySelector == null) {
|
|
throw new NullPointerException("proxySelector == null");
|
|
}
|
|
this.proxySelector = proxySelector;
|
|
return this;
|
|
}
|
|
|
|
public Builder addInterceptor(Interceptor interceptor) {
|
|
if (interceptor == null) {
|
|
throw new IllegalArgumentException("interceptor == null");
|
|
}
|
|
this.interceptors.add(interceptor);
|
|
return this;
|
|
}
|
|
|
|
public OkHttpClient build() {
|
|
return new OkHttpClient(this);
|
|
}
|
|
}
|
|
}
|