first commit

This commit is contained in:
tmarschutz
2025-10-03 11:45:17 +02:00
parent 09821c1c43
commit 5da3f1e071
10571 changed files with 1386578 additions and 1 deletions
@@ -0,0 +1,203 @@
package okhttp3;
import com.google.android.gms.common.internal.ImagesContract;
import java.net.Proxy;
import java.net.ProxySelector;
import java.util.List;
import java.util.Objects;
import javax.net.SocketFactory;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSocketFactory;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.HttpUrl;
import okhttp3.internal.Util;
/* compiled from: Address.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000h\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u000b\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u000f\u0018\u00002\u00020\u0001By\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\t\u0012\b\u0010\n\u001a\u0004\u0018\u00010\u000b\u0012\b\u0010\f\u001a\u0004\u0018\u00010\r\u0012\b\u0010\u000e\u001a\u0004\u0018\u00010\u000f\u0012\u0006\u0010\u0010\u001a\u00020\u0011\u0012\b\u0010\u0012\u001a\u0004\u0018\u00010\u0013\u0012\f\u0010\u0014\u001a\b\u0012\u0004\u0012\u00020\u00160\u0015\u0012\f\u0010\u0017\u001a\b\u0012\u0004\u0012\u00020\u00180\u0015\u0012\u0006\u0010\u0019\u001a\u00020\u001a¢\u0006\u0002\u0010\u001bJ\u000f\u0010\u000e\u001a\u0004\u0018\u00010\u000fH\u0007¢\u0006\u0002\b(J\u0013\u0010\u0017\u001a\b\u0012\u0004\u0012\u00020\u00180\u0015H\u0007¢\u0006\u0002\b)J\r\u0010\u0006\u001a\u00020\u0007H\u0007¢\u0006\u0002\b*J\u0013\u0010+\u001a\u00020,2\b\u0010-\u001a\u0004\u0018\u00010\u0001H\u0096\u0002J\u0015\u0010.\u001a\u00020,2\u0006\u0010/\u001a\u00020\u0000H\u0000¢\u0006\u0002\b0J\b\u00101\u001a\u00020\u0005H\u0016J\u000f\u0010\f\u001a\u0004\u0018\u00010\rH\u0007¢\u0006\u0002\b2J\u0013\u0010\u0014\u001a\b\u0012\u0004\u0012\u00020\u00160\u0015H\u0007¢\u0006\u0002\b3J\u000f\u0010\u0012\u001a\u0004\u0018\u00010\u0013H\u0007¢\u0006\u0002\b4J\r\u0010\u0010\u001a\u00020\u0011H\u0007¢\u0006\u0002\b5J\r\u0010\u0019\u001a\u00020\u001aH\u0007¢\u0006\u0002\b6J\r\u0010\b\u001a\u00020\tH\u0007¢\u0006\u0002\b7J\u000f\u0010\n\u001a\u0004\u0018\u00010\u000bH\u0007¢\u0006\u0002\b8J\b\u00109\u001a\u00020\u0003H\u0016J\r\u0010%\u001a\u00020&H\u0007¢\u0006\u0002\b:R\u0015\u0010\u000e\u001a\u0004\u0018\u00010\u000f8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u000e\u0010\u001cR\u0019\u0010\u0017\u001a\b\u0012\u0004\u0012\u00020\u00180\u00158G¢\u0006\b\n\u0000\u001a\u0004\b\u0017\u0010\u001dR\u0013\u0010\u0006\u001a\u00020\u00078\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u001eR\u0015\u0010\f\u001a\u0004\u0018\u00010\r8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\f\u0010\u001fR\u0019\u0010\u0014\u001a\b\u0012\u0004\u0012\u00020\u00160\u00158G¢\u0006\b\n\u0000\u001a\u0004\b\u0014\u0010\u001dR\u0015\u0010\u0012\u001a\u0004\u0018\u00010\u00138\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0012\u0010 R\u0013\u0010\u0010\u001a\u00020\u00118\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0010\u0010!R\u0013\u0010\u0019\u001a\u00020\u001a8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0019\u0010\"R\u0013\u0010\b\u001a\u00020\t8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010#R\u0015\u0010\n\u001a\u0004\u0018\u00010\u000b8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010$R\u0013\u0010%\u001a\u00020&8G¢\u0006\b\n\u0000\u001a\u0004\b%\u0010'¨\u0006;"}, m238d2 = {"Lokhttp3/Address;", "", "uriHost", "", "uriPort", "", "dns", "Lokhttp3/Dns;", "socketFactory", "Ljavax/net/SocketFactory;", "sslSocketFactory", "Ljavax/net/ssl/SSLSocketFactory;", "hostnameVerifier", "Ljavax/net/ssl/HostnameVerifier;", "certificatePinner", "Lokhttp3/CertificatePinner;", "proxyAuthenticator", "Lokhttp3/Authenticator;", "proxy", "Ljava/net/Proxy;", "protocols", "", "Lokhttp3/Protocol;", "connectionSpecs", "Lokhttp3/ConnectionSpec;", "proxySelector", "Ljava/net/ProxySelector;", "(Ljava/lang/String;ILokhttp3/Dns;Ljavax/net/SocketFactory;Ljavax/net/ssl/SSLSocketFactory;Ljavax/net/ssl/HostnameVerifier;Lokhttp3/CertificatePinner;Lokhttp3/Authenticator;Ljava/net/Proxy;Ljava/util/List;Ljava/util/List;Ljava/net/ProxySelector;)V", "()Lokhttp3/CertificatePinner;", "()Ljava/util/List;", "()Lokhttp3/Dns;", "()Ljavax/net/ssl/HostnameVerifier;", "()Ljava/net/Proxy;", "()Lokhttp3/Authenticator;", "()Ljava/net/ProxySelector;", "()Ljavax/net/SocketFactory;", "()Ljavax/net/ssl/SSLSocketFactory;", ImagesContract.URL, "Lokhttp3/HttpUrl;", "()Lokhttp3/HttpUrl;", "-deprecated_certificatePinner", "-deprecated_connectionSpecs", "-deprecated_dns", "equals", "", "other", "equalsNonHost", "that", "equalsNonHost$okhttp", "hashCode", "-deprecated_hostnameVerifier", "-deprecated_protocols", "-deprecated_proxy", "-deprecated_proxyAuthenticator", "-deprecated_proxySelector", "-deprecated_socketFactory", "-deprecated_sslSocketFactory", "toString", "-deprecated_url", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Address {
private final CertificatePinner certificatePinner;
private final List<ConnectionSpec> connectionSpecs;
private final Dns dns;
private final HostnameVerifier hostnameVerifier;
private final List<Protocol> protocols;
private final Proxy proxy;
private final Authenticator proxyAuthenticator;
private final ProxySelector proxySelector;
private final SocketFactory socketFactory;
private final SSLSocketFactory sslSocketFactory;
private final HttpUrl url;
public Address(String uriHost, int uriPort, Dns dns, SocketFactory socketFactory, SSLSocketFactory sslSocketFactory, HostnameVerifier hostnameVerifier, CertificatePinner certificatePinner, Authenticator proxyAuthenticator, Proxy proxy, List<? extends Protocol> protocols, List<ConnectionSpec> connectionSpecs, ProxySelector proxySelector) {
Intrinsics.checkNotNullParameter(uriHost, "uriHost");
Intrinsics.checkNotNullParameter(dns, "dns");
Intrinsics.checkNotNullParameter(socketFactory, "socketFactory");
Intrinsics.checkNotNullParameter(proxyAuthenticator, "proxyAuthenticator");
Intrinsics.checkNotNullParameter(protocols, "protocols");
Intrinsics.checkNotNullParameter(connectionSpecs, "connectionSpecs");
Intrinsics.checkNotNullParameter(proxySelector, "proxySelector");
this.dns = dns;
this.socketFactory = socketFactory;
this.sslSocketFactory = sslSocketFactory;
this.hostnameVerifier = hostnameVerifier;
this.certificatePinner = certificatePinner;
this.proxyAuthenticator = proxyAuthenticator;
this.proxy = proxy;
this.proxySelector = proxySelector;
this.url = new HttpUrl.Builder().scheme(sslSocketFactory != null ? "https" : "http").host(uriHost).port(uriPort).build();
this.protocols = Util.toImmutableList(protocols);
this.connectionSpecs = Util.toImmutableList(connectionSpecs);
}
public final Dns dns() {
return this.dns;
}
public final SocketFactory socketFactory() {
return this.socketFactory;
}
public final SSLSocketFactory sslSocketFactory() {
return this.sslSocketFactory;
}
public final HostnameVerifier hostnameVerifier() {
return this.hostnameVerifier;
}
public final CertificatePinner certificatePinner() {
return this.certificatePinner;
}
public final Authenticator proxyAuthenticator() {
return this.proxyAuthenticator;
}
public final Proxy proxy() {
return this.proxy;
}
public final ProxySelector proxySelector() {
return this.proxySelector;
}
public final HttpUrl url() {
return this.url;
}
public final List<Protocol> protocols() {
return this.protocols;
}
public final List<ConnectionSpec> connectionSpecs() {
return this.connectionSpecs;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = ImagesContract.URL, imports = {}))
/* renamed from: -deprecated_url, reason: not valid java name and from getter */
public final HttpUrl getUrl() {
return this.url;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "dns", imports = {}))
/* renamed from: -deprecated_dns, reason: not valid java name and from getter */
public final Dns getDns() {
return this.dns;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "socketFactory", imports = {}))
/* renamed from: -deprecated_socketFactory, reason: not valid java name and from getter */
public final SocketFactory getSocketFactory() {
return this.socketFactory;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "proxyAuthenticator", imports = {}))
/* renamed from: -deprecated_proxyAuthenticator, reason: not valid java name and from getter */
public final Authenticator getProxyAuthenticator() {
return this.proxyAuthenticator;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "protocols", imports = {}))
/* renamed from: -deprecated_protocols, reason: not valid java name */
public final List<Protocol> m1612deprecated_protocols() {
return this.protocols;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "connectionSpecs", imports = {}))
/* renamed from: -deprecated_connectionSpecs, reason: not valid java name */
public final List<ConnectionSpec> m1609deprecated_connectionSpecs() {
return this.connectionSpecs;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "proxySelector", imports = {}))
/* renamed from: -deprecated_proxySelector, reason: not valid java name and from getter */
public final ProxySelector getProxySelector() {
return this.proxySelector;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "proxy", imports = {}))
/* renamed from: -deprecated_proxy, reason: not valid java name and from getter */
public final Proxy getProxy() {
return this.proxy;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "sslSocketFactory", imports = {}))
/* renamed from: -deprecated_sslSocketFactory, reason: not valid java name and from getter */
public final SSLSocketFactory getSslSocketFactory() {
return this.sslSocketFactory;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "hostnameVerifier", imports = {}))
/* renamed from: -deprecated_hostnameVerifier, reason: not valid java name and from getter */
public final HostnameVerifier getHostnameVerifier() {
return this.hostnameVerifier;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "certificatePinner", imports = {}))
/* renamed from: -deprecated_certificatePinner, reason: not valid java name and from getter */
public final CertificatePinner getCertificatePinner() {
return this.certificatePinner;
}
public boolean equals(Object other) {
return (other instanceof Address) && Intrinsics.areEqual(this.url, ((Address) other).url) && equalsNonHost$okhttp((Address) other);
}
public int hashCode() {
int result = (17 * 31) + this.url.hashCode();
return (((((((((((((((((result * 31) + this.dns.hashCode()) * 31) + this.proxyAuthenticator.hashCode()) * 31) + this.protocols.hashCode()) * 31) + this.connectionSpecs.hashCode()) * 31) + this.proxySelector.hashCode()) * 31) + Objects.hashCode(this.proxy)) * 31) + Objects.hashCode(this.sslSocketFactory)) * 31) + Objects.hashCode(this.hostnameVerifier)) * 31) + Objects.hashCode(this.certificatePinner);
}
public final boolean equalsNonHost$okhttp(Address that) {
Intrinsics.checkNotNullParameter(that, "that");
return Intrinsics.areEqual(this.dns, that.dns) && Intrinsics.areEqual(this.proxyAuthenticator, that.proxyAuthenticator) && Intrinsics.areEqual(this.protocols, that.protocols) && Intrinsics.areEqual(this.connectionSpecs, that.connectionSpecs) && Intrinsics.areEqual(this.proxySelector, that.proxySelector) && Intrinsics.areEqual(this.proxy, that.proxy) && Intrinsics.areEqual(this.sslSocketFactory, that.sslSocketFactory) && Intrinsics.areEqual(this.hostnameVerifier, that.hostnameVerifier) && Intrinsics.areEqual(this.certificatePinner, that.certificatePinner) && this.url.port() == that.url.port();
}
public String toString() {
StringBuilder sb;
Object obj;
StringBuilder sb2 = new StringBuilder();
sb2.append("Address{");
sb2.append(this.url.host());
sb2.append(':');
sb2.append(this.url.port());
sb2.append(", ");
if (this.proxy != null) {
sb = new StringBuilder();
sb.append("proxy=");
obj = this.proxy;
} else {
sb = new StringBuilder();
sb.append("proxySelector=");
obj = this.proxySelector;
}
sb.append(obj);
sb2.append(sb.toString());
sb2.append("}");
return sb2.toString();
}
}
@@ -0,0 +1,43 @@
package okhttp3;
import java.io.IOException;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.internal.authenticator.JavaNetAuthenticator;
/* compiled from: Authenticator.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\\u0080\u0001\u0018\u0000 \b2\u00020\u0001:\u0001\bJ\u001c\u0010\u0002\u001a\u0004\u0018\u00010\u00032\b\u0010\u0004\u001a\u0004\u0018\u00010\u00052\u0006\u0010\u0006\u001a\u00020\u0007H&¨\u0006\t"}, m238d2 = {"Lokhttp3/Authenticator;", "", "authenticate", "Lokhttp3/Request;", "route", "Lokhttp3/Route;", "response", "Lokhttp3/Response;", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public interface Authenticator {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
public static final Authenticator NONE = new Companion.AuthenticatorNone();
public static final Authenticator JAVA_NET_AUTHENTICATOR = new JavaNetAuthenticator(null, 1, null);
Request authenticate(Route route, Response response) throws IOException;
/* compiled from: Authenticator.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001:\u0001\u0006B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0016\u0010\u0003\u001a\u00020\u00048\u0006X\u0087\u0004ø\u0001\u0000¢\u0006\u0002\n\u0000¨\u0006\u0001R\u0016\u0010\u0005\u001a\u00020\u00048\u0006X\u0087\u0004ø\u0001\u0000¢\u0006\u0002\n\u0000¨\u0006\u0001\u0082\u0002\u0007\n\u0005\b\u0091F0\u0001¨\u0006\u0007"}, m238d2 = {"Lokhttp3/Authenticator$Companion;", "", "()V", "JAVA_NET_AUTHENTICATOR", "Lokhttp3/Authenticator;", "NONE", "AuthenticatorNone", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
static final /* synthetic */ Companion $$INSTANCE = null;
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
/* compiled from: Authenticator.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0002\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u001c\u0010\u0003\u001a\u0004\u0018\u00010\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0016¨\u0006\t"}, m238d2 = {"Lokhttp3/Authenticator$Companion$AuthenticatorNone;", "Lokhttp3/Authenticator;", "()V", "authenticate", "Lokhttp3/Request;", "route", "Lokhttp3/Route;", "response", "Lokhttp3/Response;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private static final class AuthenticatorNone implements Authenticator {
@Override // okhttp3.Authenticator
public Request authenticate(Route route, Response response) {
Intrinsics.checkNotNullParameter(response, "response");
return null;
}
}
}
}
@@ -0,0 +1,75 @@
package okhttp3;
import java.io.IOException;
import java.util.Iterator;
import java.util.NoSuchElementException;
import kotlin.Metadata;
import kotlin.io.CloseableKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.markers.KMutableIterator;
import okhttp3.internal.cache.DiskLruCache;
import okio.BufferedSource;
import okio.Okio;
/* compiled from: Cache.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000'\n\u0000\n\u0002\u0010)\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0000*\u0001\u0000\b\n\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001J\t\u0010\t\u001a\u00020\u0004H\u0096\u0002J\t\u0010\n\u001a\u00020\u0002H\u0096\u0002J\b\u0010\u000b\u001a\u00020\fH\u0016R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u0018\u0010\u0005\u001a\f\u0012\b\u0012\u00060\u0006R\u00020\u00070\u0001X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\b\u001a\u0004\u0018\u00010\u0002X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\r"}, m238d2 = {"okhttp3/Cache$urls$1", "", "", "canRemove", "", "delegate", "Lokhttp3/internal/cache/DiskLruCache$Snapshot;", "Lokhttp3/internal/cache/DiskLruCache;", "nextUrl", "hasNext", "next", "remove", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Cache$urls$1 implements Iterator<String>, KMutableIterator {
private boolean canRemove;
private final Iterator<DiskLruCache.Snapshot> delegate;
private String nextUrl;
final /* synthetic */ Cache this$0;
Cache$urls$1(Cache this$0) {
this.this$0 = this$0;
this.delegate = this$0.getCache().snapshots();
}
@Override // java.util.Iterator
public boolean hasNext() {
if (this.nextUrl != null) {
return true;
}
this.canRemove = false;
while (this.delegate.hasNext()) {
try {
DiskLruCache.Snapshot next = this.delegate.next();
try {
continue;
DiskLruCache.Snapshot snapshot = next;
BufferedSource metadata = Okio.buffer(snapshot.getSource(0));
this.nextUrl = metadata.readUtf8LineStrict();
CloseableKt.closeFinally(next, null);
return true;
} finally {
try {
continue;
} catch (Throwable th) {
}
}
} catch (IOException e) {
}
}
return false;
}
@Override // java.util.Iterator
public String next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
String result = this.nextUrl;
Intrinsics.checkNotNull(result);
this.nextUrl = null;
this.canRemove = true;
return result;
}
@Override // java.util.Iterator
public void remove() {
if (!this.canRemove) {
throw new IllegalStateException("remove() before next()".toString());
}
this.delegate.remove();
}
}
@@ -0,0 +1,697 @@
package okhttp3;
import com.google.android.gms.common.internal.ImagesContract;
import com.google.common.net.HttpHeaders;
import java.io.Closeable;
import java.io.File;
import java.io.Flushable;
import java.io.IOException;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.collections.SetsKt;
import kotlin.io.CloseableKt;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.text.StringsKt;
import kotlin.text.Typography;
import okhttp3.Headers;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.internal.Util;
import okhttp3.internal.cache.CacheRequest;
import okhttp3.internal.cache.CacheStrategy;
import okhttp3.internal.cache.DiskLruCache;
import okhttp3.internal.concurrent.TaskRunner;
import okhttp3.internal.http.HttpMethod;
import okhttp3.internal.http.StatusLine;
import okhttp3.internal.io.FileSystem;
import okhttp3.internal.platform.Platform;
import okio.Buffer;
import okio.BufferedSink;
import okio.BufferedSource;
import okio.ByteString;
import okio.ForwardingSink;
import okio.ForwardingSource;
import okio.Okio;
import okio.Sink;
import okio.Source;
/* compiled from: Cache.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000r\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0002\b\f\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010)\n\u0002\u0010\u000e\n\u0002\b\u0005\u0018\u0000 C2\u00020\u00012\u00020\u0002:\u0004BCDEB\u0017\b\u0016\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\u0006\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u0007B\u001f\b\u0000\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\u0006\u0010\u0005\u001a\u00020\u0006\u0012\u0006\u0010\b\u001a\u00020\\u0006\u0002\u0010\nJ\u0016\u0010\u001f\u001a\u00020 2\f\u0010!\u001a\b\u0018\u00010\"R\u00020\fH\u0002J\b\u0010#\u001a\u00020 H\u0016J\u0006\u0010$\u001a\u00020 J\r\u0010\u0003\u001a\u00020\u0004H\u0007¢\u0006\u0002\b%J\u0006\u0010&\u001a\u00020 J\b\u0010'\u001a\u00020 H\u0016J\u0017\u0010(\u001a\u0004\u0018\u00010)2\u0006\u0010*\u001a\u00020+H\u0000¢\u0006\u0002\b,J\u0006\u0010\u0010\u001a\u00020\u0011J\u0006\u0010-\u001a\u00020 J\u0006\u0010\u0005\u001a\u00020\u0006J\u0006\u0010\u0015\u001a\u00020\u0011J\u0017\u0010.\u001a\u0004\u0018\u00010/2\u0006\u00100\u001a\u00020)H\u0000¢\u0006\u0002\b1J\u0015\u00102\u001a\u00020 2\u0006\u0010*\u001a\u00020+H\u0000¢\u0006\u0002\b3J\u0006\u0010\u0016\u001a\u00020\u0011J\u0006\u00104\u001a\u00020\u0006J\r\u00105\u001a\u00020 H\u0000¢\u0006\u0002\b6J\u0015\u00107\u001a\u00020 2\u0006\u00108\u001a\u000209H\u0000¢\u0006\u0002\b:J\u001d\u0010;\u001a\u00020 2\u0006\u0010<\u001a\u00020)2\u0006\u0010=\u001a\u00020)H\u0000¢\u0006\u0002\b>J\f\u0010?\u001a\b\u0012\u0004\u0012\u00020A0@J\u0006\u0010\u0017\u001a\u00020\u0011J\u0006\u0010\u001c\u001a\u00020\u0011R\u0014\u0010\u000b\u001a\u00020\fX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u000eR\u0011\u0010\u0003\u001a\u00020\u00048G¢\u0006\u0006\u001a\u0004\b\u0003\u0010\u000fR\u000e\u0010\u0010\u001a\u00020\u0011X\u0082\u000e¢\u0006\u0002\n\u0000R\u0011\u0010\u0012\u001a\u00020\u00138F¢\u0006\u0006\u001a\u0004\b\u0012\u0010\u0014R\u000e\u0010\u0015\u001a\u00020\u0011X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0016\u001a\u00020\u0011X\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010\u0017\u001a\u00020\u0011X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0018\u0010\u0019\"\u0004\b\u001a\u0010\u001bR\u001a\u0010\u001c\u001a\u00020\u0011X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001d\u0010\u0019\"\u0004\b\u001e\u0010\u001b¨\u0006F"}, m238d2 = {"Lokhttp3/Cache;", "Ljava/io/Closeable;", "Ljava/io/Flushable;", "directory", "Ljava/io/File;", "maxSize", "", "(Ljava/io/File;J)V", "fileSystem", "Lokhttp3/internal/io/FileSystem;", "(Ljava/io/File;JLokhttp3/internal/io/FileSystem;)V", "cache", "Lokhttp3/internal/cache/DiskLruCache;", "getCache$okhttp", "()Lokhttp3/internal/cache/DiskLruCache;", "()Ljava/io/File;", "hitCount", "", "isClosed", "", "()Z", "networkCount", "requestCount", "writeAbortCount", "getWriteAbortCount$okhttp", "()I", "setWriteAbortCount$okhttp", "(I)V", "writeSuccessCount", "getWriteSuccessCount$okhttp", "setWriteSuccessCount$okhttp", "abortQuietly", "", "editor", "Lokhttp3/internal/cache/DiskLruCache$Editor;", "close", "delete", "-deprecated_directory", "evictAll", "flush", "get", "Lokhttp3/Response;", "request", "Lokhttp3/Request;", "get$okhttp", "initialize", "put", "Lokhttp3/internal/cache/CacheRequest;", "response", "put$okhttp", "remove", "remove$okhttp", "size", "trackConditionalCacheHit", "trackConditionalCacheHit$okhttp", "trackResponse", "cacheStrategy", "Lokhttp3/internal/cache/CacheStrategy;", "trackResponse$okhttp", "update", "cached", "network", "update$okhttp", "urls", "", "", "CacheResponseBody", "Companion", "Entry", "RealCacheRequest", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Cache implements Closeable, Flushable {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private static final int ENTRY_BODY = 1;
private static final int ENTRY_COUNT = 2;
private static final int ENTRY_METADATA = 0;
private static final int VERSION = 201105;
private final DiskLruCache cache;
private int hitCount;
private int networkCount;
private int requestCount;
private int writeAbortCount;
private int writeSuccessCount;
@JvmStatic
public static final String key(HttpUrl httpUrl) {
return INSTANCE.key(httpUrl);
}
public Cache(File directory, long maxSize, FileSystem fileSystem) {
Intrinsics.checkNotNullParameter(directory, "directory");
Intrinsics.checkNotNullParameter(fileSystem, "fileSystem");
this.cache = new DiskLruCache(fileSystem, directory, VERSION, 2, maxSize, TaskRunner.INSTANCE);
}
/* renamed from: getCache$okhttp, reason: from getter */
public final DiskLruCache getCache() {
return this.cache;
}
/* renamed from: getWriteSuccessCount$okhttp, reason: from getter */
public final int getWriteSuccessCount() {
return this.writeSuccessCount;
}
public final void setWriteSuccessCount$okhttp(int i) {
this.writeSuccessCount = i;
}
/* renamed from: getWriteAbortCount$okhttp, reason: from getter */
public final int getWriteAbortCount() {
return this.writeAbortCount;
}
public final void setWriteAbortCount$okhttp(int i) {
this.writeAbortCount = i;
}
public final boolean isClosed() {
return this.cache.isClosed();
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public Cache(File directory, long maxSize) {
this(directory, maxSize, FileSystem.SYSTEM);
Intrinsics.checkNotNullParameter(directory, "directory");
}
public final Response get$okhttp(Request request) {
Intrinsics.checkNotNullParameter(request, "request");
String key = INSTANCE.key(request.url());
try {
DiskLruCache.Snapshot snapshot = this.cache.get(key);
if (snapshot == null) {
return null;
}
try {
Entry entry = new Entry(snapshot.getSource(0));
Response response = entry.response(snapshot);
if (!entry.matches(request, response)) {
ResponseBody body = response.body();
if (body != null) {
Util.closeQuietly(body);
}
return null;
}
return response;
} catch (IOException e) {
Util.closeQuietly(snapshot);
return null;
}
} catch (IOException e2) {
return null;
}
}
public final CacheRequest put$okhttp(Response response) {
Intrinsics.checkNotNullParameter(response, "response");
String requestMethod = response.request().method();
if (HttpMethod.INSTANCE.invalidatesCache(response.request().method())) {
try {
remove$okhttp(response.request());
} catch (IOException e) {
}
return null;
}
if (!Intrinsics.areEqual(requestMethod, "GET")) {
return null;
}
Companion companion = INSTANCE;
if (companion.hasVaryAll(response)) {
return null;
}
Entry entry = new Entry(response);
DiskLruCache.Editor editor = (DiskLruCache.Editor) null;
try {
DiskLruCache.Editor edit$default = DiskLruCache.edit$default(this.cache, companion.key(response.request().url()), 0L, 2, null);
if (edit$default == null) {
return null;
}
editor = edit$default;
entry.writeTo(editor);
return new RealCacheRequest(this, editor);
} catch (IOException e2) {
abortQuietly(editor);
return null;
}
}
public final void remove$okhttp(Request request) throws IOException {
Intrinsics.checkNotNullParameter(request, "request");
this.cache.remove(INSTANCE.key(request.url()));
}
public final void update$okhttp(Response cached, Response network) {
Intrinsics.checkNotNullParameter(cached, "cached");
Intrinsics.checkNotNullParameter(network, "network");
Entry entry = new Entry(network);
ResponseBody body = cached.body();
if (body == null) {
throw new NullPointerException("null cannot be cast to non-null type okhttp3.Cache.CacheResponseBody");
}
DiskLruCache.Snapshot snapshot = ((CacheResponseBody) body).getSnapshot();
DiskLruCache.Editor editor = (DiskLruCache.Editor) null;
try {
DiskLruCache.Editor edit = snapshot.edit();
if (edit == null) {
return;
}
editor = edit;
entry.writeTo(editor);
editor.commit();
} catch (IOException e) {
abortQuietly(editor);
}
}
private final void abortQuietly(DiskLruCache.Editor editor) {
if (editor != null) {
try {
editor.abort();
} catch (IOException e) {
}
}
}
public final void initialize() throws IOException {
this.cache.initialize();
}
public final void delete() throws IOException {
this.cache.delete();
}
public final void evictAll() throws IOException {
this.cache.evictAll();
}
public final Iterator<String> urls() throws IOException {
return new Cache$urls$1(this);
}
public final synchronized int writeAbortCount() {
return this.writeAbortCount;
}
public final synchronized int writeSuccessCount() {
return this.writeSuccessCount;
}
public final long size() throws IOException {
return this.cache.size();
}
public final long maxSize() {
return this.cache.getMaxSize();
}
@Override // java.io.Flushable
public void flush() throws IOException {
this.cache.flush();
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
this.cache.close();
}
public final File directory() {
return this.cache.getDirectory();
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "directory", imports = {}))
/* renamed from: -deprecated_directory, reason: not valid java name */
public final File m1619deprecated_directory() {
return this.cache.getDirectory();
}
public final synchronized void trackResponse$okhttp(CacheStrategy cacheStrategy) {
Intrinsics.checkNotNullParameter(cacheStrategy, "cacheStrategy");
this.requestCount++;
if (cacheStrategy.getNetworkRequest() != null) {
this.networkCount++;
} else if (cacheStrategy.getCacheResponse() != null) {
this.hitCount++;
}
}
public final synchronized void trackConditionalCacheHit$okhttp() {
this.hitCount++;
}
public final synchronized int networkCount() {
return this.networkCount;
}
public final synchronized int hitCount() {
return this.hitCount;
}
public final synchronized int requestCount() {
return this.requestCount;
}
/* compiled from: Cache.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\b\u0082\u0004\u0018\u00002\u00020\u0001B\u0011\u0012\n\u0010\u0002\u001a\u00060\u0003R\u00020\u0004¢\u0006\u0002\u0010\u0005J\b\u0010\u000f\u001a\u00020\u0010H\u0016J\b\u0010\u0006\u001a\u00020\u0007H\u0016R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010\t\u001a\u00020\nX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000b\u0010\f\"\u0004\b\r\u0010\u000eR\u0012\u0010\u0002\u001a\u00060\u0003R\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0011"}, m238d2 = {"Lokhttp3/Cache$RealCacheRequest;", "Lokhttp3/internal/cache/CacheRequest;", "editor", "Lokhttp3/internal/cache/DiskLruCache$Editor;", "Lokhttp3/internal/cache/DiskLruCache;", "(Lokhttp3/Cache;Lokhttp3/internal/cache/DiskLruCache$Editor;)V", "body", "Lokio/Sink;", "cacheOut", "done", "", "getDone", "()Z", "setDone", "(Z)V", "abort", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private final class RealCacheRequest implements CacheRequest {
private final Sink body;
private final Sink cacheOut;
private boolean done;
private final DiskLruCache.Editor editor;
final /* synthetic */ Cache this$0;
public RealCacheRequest(Cache this$0, DiskLruCache.Editor editor) {
Intrinsics.checkNotNullParameter(editor, "editor");
this.this$0 = this$0;
this.editor = editor;
Sink newSink = editor.newSink(1);
this.cacheOut = newSink;
this.body = new ForwardingSink(newSink) { // from class: okhttp3.Cache.RealCacheRequest.1
@Override // okio.ForwardingSink, okio.Sink, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
synchronized (RealCacheRequest.this.this$0) {
if (RealCacheRequest.this.getDone()) {
return;
}
RealCacheRequest.this.setDone(true);
Cache cache = RealCacheRequest.this.this$0;
cache.setWriteSuccessCount$okhttp(cache.getWriteSuccessCount() + 1);
super.close();
RealCacheRequest.this.editor.commit();
}
}
};
}
public final boolean getDone() {
return this.done;
}
public final void setDone(boolean z) {
this.done = z;
}
@Override // okhttp3.internal.cache.CacheRequest
public void abort() {
synchronized (this.this$0) {
if (this.done) {
return;
}
this.done = true;
Cache cache = this.this$0;
cache.setWriteAbortCount$okhttp(cache.getWriteAbortCount() + 1);
Util.closeQuietly(this.cacheOut);
try {
this.editor.abort();
} catch (IOException e) {
}
}
}
@Override // okhttp3.internal.cache.CacheRequest
/* renamed from: body, reason: from getter */
public Sink getBody() {
return this.body;
}
}
/* compiled from: Cache.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0080\u0001\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0002\u0018\u0000 .2\u00020\u0001:\u0001.B\u000f\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004B\u000f\b\u0016\u0012\u0006\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u0007J\u0016\u0010\u001b\u001a\u00020\r2\u0006\u0010\u001c\u001a\u00020\u001d2\u0006\u0010\u0005\u001a\u00020\u0006J\u0016\u0010\u001e\u001a\b\u0012\u0004\u0012\u00020 0\u001f2\u0006\u0010!\u001a\u00020\"H\u0002J\u0012\u0010\u0005\u001a\u00020\u00062\n\u0010#\u001a\u00060$R\u00020%J\u001e\u0010&\u001a\u00020'2\u0006\u0010(\u001a\u00020)2\f\u0010*\u001a\b\u0012\u0004\u0012\u00020 0\u001fH\u0002J\u0012\u0010+\u001a\u00020'2\n\u0010,\u001a\u00060-R\u00020%R\u000e\u0010\b\u001a\u00020\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\n\u001a\u0004\u0018\u00010\u000bX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\f\u001a\u00020\r8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\f\u0010\u000eR\u000e\u0010\u000f\u001a\u00020\u0010X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0012X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0013\u001a\u00020\u0014X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0015\u001a\u00020\u0010X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0016\u001a\u00020\u0017X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0018\u001a\u00020\u0014X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0019\u001a\u00020\u0010X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u001a\u001a\u00020\u0017X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006/"}, m238d2 = {"Lokhttp3/Cache$Entry;", "", "rawSource", "Lokio/Source;", "(Lokio/Source;)V", "response", "Lokhttp3/Response;", "(Lokhttp3/Response;)V", "code", "", "handshake", "Lokhttp3/Handshake;", "isHttps", "", "()Z", "message", "", "protocol", "Lokhttp3/Protocol;", "receivedResponseMillis", "", "requestMethod", "responseHeaders", "Lokhttp3/Headers;", "sentRequestMillis", ImagesContract.URL, "varyHeaders", "matches", "request", "Lokhttp3/Request;", "readCertificateList", "", "Ljava/security/cert/Certificate;", "source", "Lokio/BufferedSource;", "snapshot", "Lokhttp3/internal/cache/DiskLruCache$Snapshot;", "Lokhttp3/internal/cache/DiskLruCache;", "writeCertList", "", "sink", "Lokio/BufferedSink;", "certificates", "writeTo", "editor", "Lokhttp3/internal/cache/DiskLruCache$Editor;", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private static final class Entry {
private final int code;
private final Handshake handshake;
private final String message;
private final Protocol protocol;
private final long receivedResponseMillis;
private final String requestMethod;
private final Headers responseHeaders;
private final long sentRequestMillis;
private final String url;
private final Headers varyHeaders;
private static final String SENT_MILLIS = Platform.INSTANCE.get().getPrefix() + "-Sent-Millis";
private static final String RECEIVED_MILLIS = Platform.INSTANCE.get().getPrefix() + "-Received-Millis";
private final boolean isHttps() {
return StringsKt.startsWith$default(this.url, "https://", false, 2, (Object) null);
}
public Entry(Source rawSource) throws IOException {
boolean z;
TlsVersion tlsVersion;
Intrinsics.checkNotNullParameter(rawSource, "rawSource");
try {
BufferedSource source = Okio.buffer(rawSource);
this.url = source.readUtf8LineStrict();
this.requestMethod = source.readUtf8LineStrict();
Headers.Builder varyHeadersBuilder = new Headers.Builder();
int varyRequestHeaderLineCount = Cache.INSTANCE.readInt$okhttp(source);
int i = 0;
while (true) {
z = true;
if (i >= varyRequestHeaderLineCount) {
break;
}
varyHeadersBuilder.addLenient$okhttp(source.readUtf8LineStrict());
i++;
}
this.varyHeaders = varyHeadersBuilder.build();
StatusLine statusLine = StatusLine.INSTANCE.parse(source.readUtf8LineStrict());
this.protocol = statusLine.protocol;
this.code = statusLine.code;
this.message = statusLine.message;
Headers.Builder responseHeadersBuilder = new Headers.Builder();
int responseHeaderLineCount = Cache.INSTANCE.readInt$okhttp(source);
for (int i2 = 0; i2 < responseHeaderLineCount; i2++) {
responseHeadersBuilder.addLenient$okhttp(source.readUtf8LineStrict());
}
String str = SENT_MILLIS;
String sendRequestMillisString = responseHeadersBuilder.get(str);
String str2 = RECEIVED_MILLIS;
String receivedResponseMillisString = responseHeadersBuilder.get(str2);
responseHeadersBuilder.removeAll(str);
responseHeadersBuilder.removeAll(str2);
this.sentRequestMillis = sendRequestMillisString != null ? Long.parseLong(sendRequestMillisString) : 0L;
this.receivedResponseMillis = receivedResponseMillisString != null ? Long.parseLong(receivedResponseMillisString) : 0L;
this.responseHeaders = responseHeadersBuilder.build();
if (isHttps()) {
String blank = source.readUtf8LineStrict();
if (blank.length() <= 0) {
z = false;
}
if (z) {
throw new IOException("expected \"\" but was \"" + blank + Typography.quote);
}
String cipherSuiteString = source.readUtf8LineStrict();
CipherSuite cipherSuite = CipherSuite.INSTANCE.forJavaName(cipherSuiteString);
List peerCertificates = readCertificateList(source);
List localCertificates = readCertificateList(source);
if (!source.exhausted()) {
tlsVersion = TlsVersion.INSTANCE.forJavaName(source.readUtf8LineStrict());
} else {
tlsVersion = TlsVersion.SSL_3_0;
}
this.handshake = Handshake.INSTANCE.get(tlsVersion, cipherSuite, peerCertificates, localCertificates);
} else {
this.handshake = null;
}
} finally {
rawSource.close();
}
}
public Entry(Response response) {
Intrinsics.checkNotNullParameter(response, "response");
this.url = response.request().url().getUrl();
this.varyHeaders = Cache.INSTANCE.varyHeaders(response);
this.requestMethod = response.request().method();
this.protocol = response.protocol();
this.code = response.code();
this.message = response.message();
this.responseHeaders = response.headers();
this.handshake = response.handshake();
this.sentRequestMillis = response.sentRequestAtMillis();
this.receivedResponseMillis = response.receivedResponseAtMillis();
}
public final void writeTo(DiskLruCache.Editor editor) throws IOException {
Intrinsics.checkNotNullParameter(editor, "editor");
BufferedSink buffer = Okio.buffer(editor.newSink(0));
try {
BufferedSink sink = buffer;
sink.writeUtf8(this.url).writeByte(10);
sink.writeUtf8(this.requestMethod).writeByte(10);
sink.writeDecimalLong(this.varyHeaders.size()).writeByte(10);
int size = this.varyHeaders.size();
for (int i = 0; i < size; i++) {
sink.writeUtf8(this.varyHeaders.name(i)).writeUtf8(": ").writeUtf8(this.varyHeaders.value(i)).writeByte(10);
}
sink.writeUtf8(new StatusLine(this.protocol, this.code, this.message).toString()).writeByte(10);
sink.writeDecimalLong(this.responseHeaders.size() + 2).writeByte(10);
int size2 = this.responseHeaders.size();
for (int i2 = 0; i2 < size2; i2++) {
sink.writeUtf8(this.responseHeaders.name(i2)).writeUtf8(": ").writeUtf8(this.responseHeaders.value(i2)).writeByte(10);
}
sink.writeUtf8(SENT_MILLIS).writeUtf8(": ").writeDecimalLong(this.sentRequestMillis).writeByte(10);
sink.writeUtf8(RECEIVED_MILLIS).writeUtf8(": ").writeDecimalLong(this.receivedResponseMillis).writeByte(10);
if (isHttps()) {
sink.writeByte(10);
Handshake handshake = this.handshake;
Intrinsics.checkNotNull(handshake);
sink.writeUtf8(handshake.cipherSuite().javaName()).writeByte(10);
writeCertList(sink, this.handshake.peerCertificates());
writeCertList(sink, this.handshake.localCertificates());
sink.writeUtf8(this.handshake.tlsVersion().javaName()).writeByte(10);
}
Unit unit = Unit.INSTANCE;
CloseableKt.closeFinally(buffer, null);
} finally {
}
}
private final List<Certificate> readCertificateList(BufferedSource source) throws IOException {
int length = Cache.INSTANCE.readInt$okhttp(source);
if (length == -1) {
return CollectionsKt.emptyList();
}
try {
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
ArrayList result = new ArrayList(length);
for (int i = 0; i < length; i++) {
String line = source.readUtf8LineStrict();
Buffer bytes = new Buffer();
ByteString decodeBase64 = ByteString.INSTANCE.decodeBase64(line);
Intrinsics.checkNotNull(decodeBase64);
bytes.write(decodeBase64);
result.add(certificateFactory.generateCertificate(bytes.inputStream()));
}
return result;
} catch (CertificateException e) {
throw new IOException(e.getMessage());
}
}
private final void writeCertList(BufferedSink sink, List<? extends Certificate> certificates) throws IOException {
try {
sink.writeDecimalLong(certificates.size()).writeByte(10);
int size = certificates.size();
for (int i = 0; i < size; i++) {
byte[] bytes = certificates.get(i).getEncoded();
ByteString.Companion companion = ByteString.INSTANCE;
Intrinsics.checkNotNullExpressionValue(bytes, "bytes");
String line = ByteString.Companion.of$default(companion, bytes, 0, 0, 3, null).base64();
sink.writeUtf8(line).writeByte(10);
}
} catch (CertificateEncodingException e) {
throw new IOException(e.getMessage());
}
}
public final boolean matches(Request request, Response response) {
Intrinsics.checkNotNullParameter(request, "request");
Intrinsics.checkNotNullParameter(response, "response");
return Intrinsics.areEqual(this.url, request.url().getUrl()) && Intrinsics.areEqual(this.requestMethod, request.method()) && Cache.INSTANCE.varyMatches(response, this.varyHeaders, request);
}
public final Response response(DiskLruCache.Snapshot snapshot) {
Intrinsics.checkNotNullParameter(snapshot, "snapshot");
String contentType = this.responseHeaders.get(HttpHeaders.CONTENT_TYPE);
String contentLength = this.responseHeaders.get(HttpHeaders.CONTENT_LENGTH);
Request cacheRequest = new Request.Builder().url(this.url).method(this.requestMethod, null).headers(this.varyHeaders).build();
return new Response.Builder().request(cacheRequest).protocol(this.protocol).code(this.code).message(this.message).headers(this.responseHeaders).body(new CacheResponseBody(snapshot, contentType, contentLength)).handshake(this.handshake).sentRequestAtMillis(this.sentRequestMillis).receivedResponseAtMillis(this.receivedResponseMillis).build();
}
}
/* compiled from: Cache.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\t\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0002\u0018\u00002\u00020\u0001B%\u0012\n\u0010\u0002\u001a\u00060\u0003R\u00020\u0004\u0012\b\u0010\u0005\u001a\u0004\u0018\u00010\u0006\u0012\b\u0010\u0007\u001a\u0004\u0018\u00010\u0006¢\u0006\u0002\u0010\bJ\b\u0010\u0007\u001a\u00020\rH\u0016J\n\u0010\u0005\u001a\u0004\u0018\u00010\u000eH\u0016J\b\u0010\u000f\u001a\u00020\nH\u0016R\u000e\u0010\t\u001a\u00020\nX\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0007\u001a\u0004\u0018\u00010\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0005\u001a\u0004\u0018\u00010\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u0015\u0010\u0002\u001a\u00060\u0003R\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\\u0006\u0010"}, m238d2 = {"Lokhttp3/Cache$CacheResponseBody;", "Lokhttp3/ResponseBody;", "snapshot", "Lokhttp3/internal/cache/DiskLruCache$Snapshot;", "Lokhttp3/internal/cache/DiskLruCache;", "contentType", "", "contentLength", "(Lokhttp3/internal/cache/DiskLruCache$Snapshot;Ljava/lang/String;Ljava/lang/String;)V", "bodySource", "Lokio/BufferedSource;", "getSnapshot", "()Lokhttp3/internal/cache/DiskLruCache$Snapshot;", "", "Lokhttp3/MediaType;", "source", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private static final class CacheResponseBody extends ResponseBody {
private final BufferedSource bodySource;
private final String contentLength;
private final String contentType;
private final DiskLruCache.Snapshot snapshot;
public CacheResponseBody(DiskLruCache.Snapshot snapshot, String contentType, String contentLength) {
Intrinsics.checkNotNullParameter(snapshot, "snapshot");
this.snapshot = snapshot;
this.contentType = contentType;
this.contentLength = contentLength;
final Source source = snapshot.getSource(1);
this.bodySource = Okio.buffer(new ForwardingSource(source) { // from class: okhttp3.Cache.CacheResponseBody.1
@Override // okio.ForwardingSource, okio.Source, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
CacheResponseBody.this.getSnapshot().close();
super.close();
}
});
}
public final DiskLruCache.Snapshot getSnapshot() {
return this.snapshot;
}
@Override // okhttp3.ResponseBody
/* renamed from: contentType */
public MediaType get$contentType() {
String str = this.contentType;
if (str != null) {
return MediaType.INSTANCE.parse(str);
}
return null;
}
@Override // okhttp3.ResponseBody
/* renamed from: contentLength */
public long getContentLength() {
String str = this.contentLength;
if (str != null) {
return Util.toLongOrDefault(str, -1L);
}
return -1L;
}
@Override // okhttp3.ResponseBody
/* renamed from: source, reason: from getter */
public BufferedSource getBodySource() {
return this.bodySource;
}
}
/* compiled from: Cache.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000N\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\"\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000bH\u0007J\u0015\u0010\f\u001a\u00020\u00042\u0006\u0010\r\u001a\u00020\u000eH\u0000¢\u0006\u0002\b\u000fJ\u0018\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u00112\u0006\u0010\u0013\u001a\u00020\u0011H\u0002J\u001e\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u0018\u001a\u00020\u00112\u0006\u0010\u0019\u001a\u00020\u001aJ\n\u0010\u001b\u001a\u00020\u0015*\u00020\u0017J\u0012\u0010\u001c\u001a\b\u0012\u0004\u0012\u00020\t0\u001d*\u00020\u0011H\u0002J\n\u0010\u0010\u001a\u00020\u0011*\u00020\u0017R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000¨\u0006\u001e"}, m238d2 = {"Lokhttp3/Cache$Companion;", "", "()V", "ENTRY_BODY", "", "ENTRY_COUNT", "ENTRY_METADATA", "VERSION", "key", "", ImagesContract.URL, "Lokhttp3/HttpUrl;", "readInt", "source", "Lokio/BufferedSource;", "readInt$okhttp", "varyHeaders", "Lokhttp3/Headers;", "requestHeaders", "responseHeaders", "varyMatches", "", "cachedResponse", "Lokhttp3/Response;", "cachedRequest", "newRequest", "Lokhttp3/Request;", "hasVaryAll", "varyFields", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
@JvmStatic
public final String key(HttpUrl url) {
Intrinsics.checkNotNullParameter(url, "url");
return ByteString.INSTANCE.encodeUtf8(url.getUrl()).md5().hex();
}
public final int readInt$okhttp(BufferedSource source) throws IOException {
Intrinsics.checkNotNullParameter(source, "source");
try {
long result = source.readDecimalLong();
String line = source.readUtf8LineStrict();
if (result >= 0 && result <= Integer.MAX_VALUE) {
if (!(line.length() > 0)) {
return (int) result;
}
}
throw new IOException("expected an int but was \"" + result + line + Typography.quote);
} catch (NumberFormatException e) {
throw new IOException(e.getMessage());
}
}
public final boolean varyMatches(Response cachedResponse, Headers cachedRequest, Request newRequest) {
Intrinsics.checkNotNullParameter(cachedResponse, "cachedResponse");
Intrinsics.checkNotNullParameter(cachedRequest, "cachedRequest");
Intrinsics.checkNotNullParameter(newRequest, "newRequest");
Iterable $this$none$iv = varyFields(cachedResponse.headers());
if (($this$none$iv instanceof Collection) && ((Collection) $this$none$iv).isEmpty()) {
return true;
}
for (Object element$iv : $this$none$iv) {
String it = (String) element$iv;
if (!Intrinsics.areEqual(cachedRequest.values(it), newRequest.headers(it))) {
return false;
}
}
return true;
}
public final boolean hasVaryAll(Response hasVaryAll) {
Intrinsics.checkNotNullParameter(hasVaryAll, "$this$hasVaryAll");
return varyFields(hasVaryAll.headers()).contains("*");
}
private final Set<String> varyFields(Headers $this$varyFields) {
Set result = (Set) null;
int size = $this$varyFields.size();
for (int i = 0; i < size; i++) {
if (StringsKt.equals(HttpHeaders.VARY, $this$varyFields.name(i), true)) {
String value = $this$varyFields.value(i);
if (result == null) {
Set result2 = new TreeSet(StringsKt.getCASE_INSENSITIVE_ORDER(StringCompanionObject.INSTANCE));
result = result2;
}
for (String varyField : StringsKt.split$default((CharSequence) value, new char[]{','}, false, 0, 6, (Object) null)) {
if (varyField == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.CharSequence");
}
result.add(StringsKt.trim((CharSequence) varyField).toString());
}
}
}
return result != null ? result : SetsKt.emptySet();
}
public final Headers varyHeaders(Response varyHeaders) {
Intrinsics.checkNotNullParameter(varyHeaders, "$this$varyHeaders");
Response networkResponse = varyHeaders.networkResponse();
Intrinsics.checkNotNull(networkResponse);
Headers requestHeaders = networkResponse.request().headers();
Headers responseHeaders = varyHeaders.headers();
return varyHeaders(requestHeaders, responseHeaders);
}
private final Headers varyHeaders(Headers requestHeaders, Headers responseHeaders) {
Set varyFields = varyFields(responseHeaders);
if (varyFields.isEmpty()) {
return Util.EMPTY_HEADERS;
}
Headers.Builder result = new Headers.Builder();
int size = requestHeaders.size();
for (int i = 0; i < size; i++) {
String fieldName = requestHeaders.name(i);
if (varyFields.contains(fieldName)) {
result.add(fieldName, requestHeaders.value(i));
}
}
return result.build();
}
}
}
@@ -0,0 +1,360 @@
package okhttp3;
import java.util.concurrent.TimeUnit;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
/* compiled from: CacheControl.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\n\n\u0002\u0010\u000e\n\u0002\b\u0011\u0018\u0000 !2\u00020\u0001:\u0002 !Bq\b\u0002\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003\u0012\u0006\u0010\u0005\u001a\u00020\u0006\u0012\u0006\u0010\u0007\u001a\u00020\u0006\u0012\u0006\u0010\b\u001a\u00020\u0003\u0012\u0006\u0010\t\u001a\u00020\u0003\u0012\u0006\u0010\n\u001a\u00020\u0003\u0012\u0006\u0010\u000b\u001a\u00020\u0006\u0012\u0006\u0010\f\u001a\u00020\u0006\u0012\u0006\u0010\r\u001a\u00020\u0003\u0012\u0006\u0010\u000e\u001a\u00020\u0003\u0012\u0006\u0010\u000f\u001a\u00020\u0003\u0012\b\u0010\u0010\u001a\u0004\u0018\u00010\u0011¢\u0006\u0002\u0010\u0012J\r\u0010\u000f\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u0015J\r\u0010\u0005\u001a\u00020\u0006H\u0007¢\u0006\u0002\b\u0016J\r\u0010\u000b\u001a\u00020\u0006H\u0007¢\u0006\u0002\b\u0017J\r\u0010\f\u001a\u00020\u0006H\u0007¢\u0006\u0002\b\u0018J\r\u0010\n\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u0019J\r\u0010\u0002\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u001aJ\r\u0010\u0004\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u001bJ\r\u0010\u000e\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u001cJ\r\u0010\r\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u001dJ\r\u0010\u0007\u001a\u00020\u0006H\u0007¢\u0006\u0002\b\u001eJ\b\u0010\u001f\u001a\u00020\u0011H\u0016R\u0010\u0010\u0010\u001a\u0004\u0018\u00010\u0011X\u0082\u000e¢\u0006\u0002\n\u0000R\u0013\u0010\u000f\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u000f\u0010\u0013R\u0011\u0010\b\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\u0013R\u0011\u0010\t\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\u0013R\u0013\u0010\u0005\u001a\u00020\u00068\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0014R\u0013\u0010\u000b\u001a\u00020\u00068\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\u0014R\u0013\u0010\f\u001a\u00020\u00068\u0007¢\u0006\b\n\u0000\u001a\u0004\b\f\u0010\u0014R\u0013\u0010\n\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u0013R\u0013\u0010\u0002\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\u0013R\u0013\u0010\u0004\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0004\u0010\u0013R\u0013\u0010\u000e\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u000e\u0010\u0013R\u0013\u0010\r\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u0013R\u0013\u0010\u0007\u001a\u00020\u00068\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\u0014¨\u0006\""}, m238d2 = {"Lokhttp3/CacheControl;", "", "noCache", "", "noStore", "maxAgeSeconds", "", "sMaxAgeSeconds", "isPrivate", "isPublic", "mustRevalidate", "maxStaleSeconds", "minFreshSeconds", "onlyIfCached", "noTransform", "immutable", "headerValue", "", "(ZZIIZZZIIZZZLjava/lang/String;)V", "()Z", "()I", "-deprecated_immutable", "-deprecated_maxAgeSeconds", "-deprecated_maxStaleSeconds", "-deprecated_minFreshSeconds", "-deprecated_mustRevalidate", "-deprecated_noCache", "-deprecated_noStore", "-deprecated_noTransform", "-deprecated_onlyIfCached", "-deprecated_sMaxAgeSeconds", "toString", "Builder", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class CacheControl {
private String headerValue;
private final boolean immutable;
private final boolean isPrivate;
private final boolean isPublic;
private final int maxAgeSeconds;
private final int maxStaleSeconds;
private final int minFreshSeconds;
private final boolean mustRevalidate;
private final boolean noCache;
private final boolean noStore;
private final boolean noTransform;
private final boolean onlyIfCached;
private final int sMaxAgeSeconds;
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
public static final CacheControl FORCE_NETWORK = new Builder().noCache().build();
public static final CacheControl FORCE_CACHE = new Builder().onlyIfCached().maxStale(Integer.MAX_VALUE, TimeUnit.SECONDS).build();
@JvmStatic
public static final CacheControl parse(Headers headers) {
return INSTANCE.parse(headers);
}
private CacheControl(boolean noCache, boolean noStore, int maxAgeSeconds, int sMaxAgeSeconds, boolean isPrivate, boolean isPublic, boolean mustRevalidate, int maxStaleSeconds, int minFreshSeconds, boolean onlyIfCached, boolean noTransform, boolean immutable, String headerValue) {
this.noCache = noCache;
this.noStore = noStore;
this.maxAgeSeconds = maxAgeSeconds;
this.sMaxAgeSeconds = sMaxAgeSeconds;
this.isPrivate = isPrivate;
this.isPublic = isPublic;
this.mustRevalidate = mustRevalidate;
this.maxStaleSeconds = maxStaleSeconds;
this.minFreshSeconds = minFreshSeconds;
this.onlyIfCached = onlyIfCached;
this.noTransform = noTransform;
this.immutable = immutable;
this.headerValue = headerValue;
}
public /* synthetic */ CacheControl(boolean noCache, boolean noStore, int maxAgeSeconds, int sMaxAgeSeconds, boolean isPrivate, boolean isPublic, boolean mustRevalidate, int maxStaleSeconds, int minFreshSeconds, boolean onlyIfCached, boolean noTransform, boolean immutable, String headerValue, DefaultConstructorMarker $constructor_marker) {
this(noCache, noStore, maxAgeSeconds, sMaxAgeSeconds, isPrivate, isPublic, mustRevalidate, maxStaleSeconds, minFreshSeconds, onlyIfCached, noTransform, immutable, headerValue);
}
public final boolean noCache() {
return this.noCache;
}
public final boolean noStore() {
return this.noStore;
}
public final int maxAgeSeconds() {
return this.maxAgeSeconds;
}
public final int sMaxAgeSeconds() {
return this.sMaxAgeSeconds;
}
/* renamed from: isPrivate, reason: from getter */
public final boolean getIsPrivate() {
return this.isPrivate;
}
/* renamed from: isPublic, reason: from getter */
public final boolean getIsPublic() {
return this.isPublic;
}
public final boolean mustRevalidate() {
return this.mustRevalidate;
}
public final int maxStaleSeconds() {
return this.maxStaleSeconds;
}
public final int minFreshSeconds() {
return this.minFreshSeconds;
}
public final boolean onlyIfCached() {
return this.onlyIfCached;
}
public final boolean noTransform() {
return this.noTransform;
}
public final boolean immutable() {
return this.immutable;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "noCache", imports = {}))
/* renamed from: -deprecated_noCache, reason: not valid java name and from getter */
public final boolean getNoCache() {
return this.noCache;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "noStore", imports = {}))
/* renamed from: -deprecated_noStore, reason: not valid java name and from getter */
public final boolean getNoStore() {
return this.noStore;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "maxAgeSeconds", imports = {}))
/* renamed from: -deprecated_maxAgeSeconds, reason: not valid java name and from getter */
public final int getMaxAgeSeconds() {
return this.maxAgeSeconds;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "sMaxAgeSeconds", imports = {}))
/* renamed from: -deprecated_sMaxAgeSeconds, reason: not valid java name and from getter */
public final int getSMaxAgeSeconds() {
return this.sMaxAgeSeconds;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "mustRevalidate", imports = {}))
/* renamed from: -deprecated_mustRevalidate, reason: not valid java name and from getter */
public final boolean getMustRevalidate() {
return this.mustRevalidate;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "maxStaleSeconds", imports = {}))
/* renamed from: -deprecated_maxStaleSeconds, reason: not valid java name and from getter */
public final int getMaxStaleSeconds() {
return this.maxStaleSeconds;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "minFreshSeconds", imports = {}))
/* renamed from: -deprecated_minFreshSeconds, reason: not valid java name and from getter */
public final int getMinFreshSeconds() {
return this.minFreshSeconds;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "onlyIfCached", imports = {}))
/* renamed from: -deprecated_onlyIfCached, reason: not valid java name and from getter */
public final boolean getOnlyIfCached() {
return this.onlyIfCached;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "noTransform", imports = {}))
/* renamed from: -deprecated_noTransform, reason: not valid java name and from getter */
public final boolean getNoTransform() {
return this.noTransform;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "immutable", imports = {}))
/* renamed from: -deprecated_immutable, reason: not valid java name and from getter */
public final boolean getImmutable() {
return this.immutable;
}
public String toString() {
String result = this.headerValue;
if (result == null) {
StringBuilder $this$buildString = new StringBuilder();
if (this.noCache) {
$this$buildString.append("no-cache, ");
}
if (this.noStore) {
$this$buildString.append("no-store, ");
}
if (this.maxAgeSeconds != -1) {
$this$buildString.append("max-age=");
$this$buildString.append(this.maxAgeSeconds);
$this$buildString.append(", ");
}
if (this.sMaxAgeSeconds != -1) {
$this$buildString.append("s-maxage=");
$this$buildString.append(this.sMaxAgeSeconds);
$this$buildString.append(", ");
}
if (this.isPrivate) {
$this$buildString.append("private, ");
}
if (this.isPublic) {
$this$buildString.append("public, ");
}
if (this.mustRevalidate) {
$this$buildString.append("must-revalidate, ");
}
if (this.maxStaleSeconds != -1) {
$this$buildString.append("max-stale=");
$this$buildString.append(this.maxStaleSeconds);
$this$buildString.append(", ");
}
if (this.minFreshSeconds != -1) {
$this$buildString.append("min-fresh=");
$this$buildString.append(this.minFreshSeconds);
$this$buildString.append(", ");
}
if (this.onlyIfCached) {
$this$buildString.append("only-if-cached, ");
}
if (this.noTransform) {
$this$buildString.append("no-transform, ");
}
if (this.immutable) {
$this$buildString.append("immutable, ");
}
if ($this$buildString.length() == 0) {
return "";
}
$this$buildString.delete($this$buildString.length() - 2, $this$buildString.length());
String result2 = $this$buildString.toString();
Intrinsics.checkNotNullExpressionValue(result2, "StringBuilder().apply(builderAction).toString()");
this.headerValue = result2;
return result2;
}
return result;
}
/* compiled from: CacheControl.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\b\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\t\n\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0006\u0010\r\u001a\u00020\u000eJ\u0006\u0010\u0003\u001a\u00020\u0000J\u0016\u0010\u000f\u001a\u00020\u00002\u0006\u0010\u000f\u001a\u00020\u00062\u0006\u0010\u0010\u001a\u00020\u0011J\u0016\u0010\u0012\u001a\u00020\u00002\u0006\u0010\u0012\u001a\u00020\u00062\u0006\u0010\u0010\u001a\u00020\u0011J\u0016\u0010\u0013\u001a\u00020\u00002\u0006\u0010\u0013\u001a\u00020\u00062\u0006\u0010\u0010\u001a\u00020\u0011J\u0006\u0010\t\u001a\u00020\u0000J\u0006\u0010\n\u001a\u00020\u0000J\u0006\u0010\u000b\u001a\u00020\u0000J\u0006\u0010\f\u001a\u00020\u0000J\f\u0010\u0014\u001a\u00020\u0006*\u00020\u0015H\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0016"}, m238d2 = {"Lokhttp3/CacheControl$Builder;", "", "()V", "immutable", "", "maxAgeSeconds", "", "maxStaleSeconds", "minFreshSeconds", "noCache", "noStore", "noTransform", "onlyIfCached", "build", "Lokhttp3/CacheControl;", "maxAge", "timeUnit", "Ljava/util/concurrent/TimeUnit;", "maxStale", "minFresh", "clampToInt", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Builder {
private boolean immutable;
private int maxAgeSeconds = -1;
private int maxStaleSeconds = -1;
private int minFreshSeconds = -1;
private boolean noCache;
private boolean noStore;
private boolean noTransform;
private boolean onlyIfCached;
public final Builder noCache() {
Builder $this$apply = this;
$this$apply.noCache = true;
return this;
}
public final Builder noStore() {
Builder $this$apply = this;
$this$apply.noStore = true;
return this;
}
public final Builder maxAge(int maxAge, TimeUnit timeUnit) {
Intrinsics.checkNotNullParameter(timeUnit, "timeUnit");
Builder $this$apply = this;
if (!(maxAge >= 0)) {
throw new IllegalArgumentException(("maxAge < 0: " + maxAge).toString());
}
long maxAgeSecondsLong = timeUnit.toSeconds(maxAge);
$this$apply.maxAgeSeconds = $this$apply.clampToInt(maxAgeSecondsLong);
return this;
}
public final Builder maxStale(int maxStale, TimeUnit timeUnit) {
Intrinsics.checkNotNullParameter(timeUnit, "timeUnit");
Builder $this$apply = this;
if (!(maxStale >= 0)) {
throw new IllegalArgumentException(("maxStale < 0: " + maxStale).toString());
}
long maxStaleSecondsLong = timeUnit.toSeconds(maxStale);
$this$apply.maxStaleSeconds = $this$apply.clampToInt(maxStaleSecondsLong);
return this;
}
public final Builder minFresh(int minFresh, TimeUnit timeUnit) {
Intrinsics.checkNotNullParameter(timeUnit, "timeUnit");
Builder $this$apply = this;
if (!(minFresh >= 0)) {
throw new IllegalArgumentException(("minFresh < 0: " + minFresh).toString());
}
long minFreshSecondsLong = timeUnit.toSeconds(minFresh);
$this$apply.minFreshSeconds = $this$apply.clampToInt(minFreshSecondsLong);
return this;
}
public final Builder onlyIfCached() {
Builder $this$apply = this;
$this$apply.onlyIfCached = true;
return this;
}
public final Builder noTransform() {
Builder $this$apply = this;
$this$apply.noTransform = true;
return this;
}
public final Builder immutable() {
Builder $this$apply = this;
$this$apply.immutable = true;
return this;
}
private final int clampToInt(long $this$clampToInt) {
if ($this$clampToInt > Integer.MAX_VALUE) {
return Integer.MAX_VALUE;
}
return (int) $this$clampToInt;
}
public final CacheControl build() {
return new CacheControl(this.noCache, this.noStore, this.maxAgeSeconds, -1, false, false, false, this.maxStaleSeconds, this.minFreshSeconds, this.onlyIfCached, this.noTransform, this.immutable, null, null);
}
}
/* compiled from: CacheControl.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\u0010\u000e\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0006\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\bH\u0007J\u001e\u0010\t\u001a\u00020\n*\u00020\u000b2\u0006\u0010\f\u001a\u00020\u000b2\b\b\u0002\u0010\r\u001a\u00020\nH\u0002R\u0010\u0010\u0003\u001a\u00020\u00048\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0005\u001a\u00020\u00048\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006\u000e"}, m238d2 = {"Lokhttp3/CacheControl$Companion;", "", "()V", "FORCE_CACHE", "Lokhttp3/CacheControl;", "FORCE_NETWORK", "parse", "headers", "Lokhttp3/Headers;", "indexOfElement", "", "", "characters", "startIndex", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
/* JADX WARN: Removed duplicated region for block: B:24:0x012a */
/* JADX WARN: Removed duplicated region for block: B:27:0x0138 */
@kotlin.jvm.JvmStatic
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final okhttp3.CacheControl parse(okhttp3.Headers r36) {
/*
Method dump skipped, instructions count: 690
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.CacheControl.Companion.parse(okhttp3.Headers):okhttp3.CacheControl");
}
static /* synthetic */ int indexOfElement$default(Companion companion, String str, String str2, int i, int i2, Object obj) {
if ((i2 & 2) != 0) {
i = 0;
}
return companion.indexOfElement(str, str2, i);
}
private final int indexOfElement(String $this$indexOfElement, String characters, int startIndex) {
int length = $this$indexOfElement.length();
for (int i = startIndex; i < length; i++) {
if (StringsKt.contains$default((CharSequence) characters, $this$indexOfElement.charAt(i), false, 2, (Object) null)) {
return i;
}
}
return $this$indexOfElement.length();
}
}
}
@@ -0,0 +1,33 @@
package okhttp3;
import java.io.IOException;
import kotlin.Metadata;
import okio.Timeout;
/* compiled from: Call.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0010\u001a\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\bf\u0018\u00002\u00020\u0001:\u0001\u0011J\b\u0010\u0002\u001a\u00020\u0003H&J\b\u0010\u0004\u001a\u00020\u0000H&J\u0010\u0010\u0005\u001a\u00020\u00032\u0006\u0010\u0006\u001a\u00020\u0007H&J\b\u0010\b\u001a\u00020\tH&J\b\u0010\n\u001a\u00020\u000bH&J\b\u0010\f\u001a\u00020\u000bH&J\b\u0010\r\u001a\u00020\u000eH&J\b\u0010\u000f\u001a\u00020\u0010H&¨\u0006\u0012"}, m238d2 = {"Lokhttp3/Call;", "", "cancel", "", "clone", "enqueue", "responseCallback", "Lokhttp3/Callback;", "execute", "Lokhttp3/Response;", "isCanceled", "", "isExecuted", "request", "Lokhttp3/Request;", "timeout", "Lokio/Timeout;", "Factory", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public interface Call extends Cloneable {
/* compiled from: Call.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\\u0080\u0001\u0018\u00002\u00020\u0001J\u0010\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0005H&¨\u0006\u0006"}, m238d2 = {"Lokhttp3/Call$Factory;", "", "newCall", "Lokhttp3/Call;", "request", "Lokhttp3/Request;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public interface Factory {
Call newCall(Request request);
}
void cancel();
Call clone();
void enqueue(Callback responseCallback);
Response execute() throws IOException;
boolean isCanceled();
boolean isExecuted();
Request request();
Timeout timeout();
}
@@ -0,0 +1,14 @@
package okhttp3;
import androidx.core.app.NotificationCompat;
import java.io.IOException;
import kotlin.Metadata;
/* compiled from: Callback.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\bf\u0018\u00002\u00020\u0001J\u0018\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u0007H&J\u0018\u0010\b\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\t\u001a\u00020\nH&¨\u0006\u000b"}, m238d2 = {"Lokhttp3/Callback;", "", "onFailure", "", NotificationCompat.CATEGORY_CALL, "Lokhttp3/Call;", "e", "Ljava/io/IOException;", "onResponse", "response", "Lokhttp3/Response;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public interface Callback {
void onFailure(Call call, IOException e);
void onResponse(Call call, Response response) throws IOException;
}
@@ -0,0 +1,410 @@
package okhttp3;
import java.security.Principal;
import java.security.PublicKey;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import javax.net.ssl.SSLPeerUnverifiedException;
import kotlin.Deprecated;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.collections.ArraysKt;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.TypeIntrinsics;
import kotlin.text.StringsKt;
import okhttp3.internal.HostnamesKt;
import okhttp3.internal.tls.CertificateChainCleaner;
import okio.ByteString;
/* compiled from: CertificatePinner.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000T\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\"\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0006\u0018\u0000 \"2\u00020\u0001:\u0003!\"#B!\b\u0000\u0012\f\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003\u0012\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0006¢\u0006\u0002\u0010\u0007J)\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u000f2\u0012\u0010\u0010\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00130\u00120\u0011H\u0000¢\u0006\u0002\b\u0014J)\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u000f2\u0012\u0010\u0015\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00170\u0016\"\u00020\u0017H\u0007¢\u0006\u0002\u0010\u0018J\u001c\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u000f2\f\u0010\u0015\u001a\b\u0012\u0004\u0012\u00020\u00170\u0012J\u0013\u0010\u0019\u001a\u00020\u001a2\b\u0010\u001b\u001a\u0004\u0018\u00010\u0001H\u0096\u0002J\u0014\u0010\u001c\u001a\b\u0012\u0004\u0012\u00020\u00040\u00122\u0006\u0010\u000e\u001a\u00020\u000fJ\b\u0010\u001d\u001a\u00020\u001eH\u0016J\u0015\u0010\u001f\u001a\u00020\u00002\u0006\u0010\u0005\u001a\u00020\u0006H\u0000¢\u0006\u0002\b R\u0016\u0010\u0005\u001a\u0004\u0018\u00010\u0006X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\tR\u0017\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000b¨\u0006$"}, m238d2 = {"Lokhttp3/CertificatePinner;", "", "pins", "", "Lokhttp3/CertificatePinner$Pin;", "certificateChainCleaner", "Lokhttp3/internal/tls/CertificateChainCleaner;", "(Ljava/util/Set;Lokhttp3/internal/tls/CertificateChainCleaner;)V", "getCertificateChainCleaner$okhttp", "()Lokhttp3/internal/tls/CertificateChainCleaner;", "getPins", "()Ljava/util/Set;", "check", "", "hostname", "", "cleanedPeerCertificatesFn", "Lkotlin/Function0;", "", "Ljava/security/cert/X509Certificate;", "check$okhttp", "peerCertificates", "", "Ljava/security/cert/Certificate;", "(Ljava/lang/String;[Ljava/security/cert/Certificate;)V", "equals", "", "other", "findMatchingPins", "hashCode", "", "withCertificateChainCleaner", "withCertificateChainCleaner$okhttp", "Builder", "Companion", "Pin", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class CertificatePinner {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
public static final CertificatePinner DEFAULT = new Builder().build();
private final CertificateChainCleaner certificateChainCleaner;
private final Set<Pin> pins;
@JvmStatic
public static final String pin(Certificate certificate) {
return INSTANCE.pin(certificate);
}
@JvmStatic
public static final ByteString sha1Hash(X509Certificate x509Certificate) {
return INSTANCE.sha1Hash(x509Certificate);
}
@JvmStatic
public static final ByteString sha256Hash(X509Certificate x509Certificate) {
return INSTANCE.sha256Hash(x509Certificate);
}
public CertificatePinner(Set<Pin> pins, CertificateChainCleaner certificateChainCleaner) {
Intrinsics.checkNotNullParameter(pins, "pins");
this.pins = pins;
this.certificateChainCleaner = certificateChainCleaner;
}
public final Set<Pin> getPins() {
return this.pins;
}
/* JADX WARN: Illegal instructions before constructor call */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public /* synthetic */ CertificatePinner(java.util.Set r1, okhttp3.internal.tls.CertificateChainCleaner r2, int r3, kotlin.jvm.internal.DefaultConstructorMarker r4) {
/*
r0 = this;
r3 = r3 & 2
if (r3 == 0) goto L8
r2 = 0
r3 = r2
okhttp3.internal.tls.CertificateChainCleaner r3 = (okhttp3.internal.tls.CertificateChainCleaner) r3
L8:
r0.<init>(r1, r2)
return
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.CertificatePinner.<init>(java.util.Set, okhttp3.internal.tls.CertificateChainCleaner, int, kotlin.jvm.internal.DefaultConstructorMarker):void");
}
/* renamed from: getCertificateChainCleaner$okhttp, reason: from getter */
public final CertificateChainCleaner getCertificateChainCleaner() {
return this.certificateChainCleaner;
}
public final void check(final String hostname, final List<? extends Certificate> peerCertificates) throws SSLPeerUnverifiedException {
Intrinsics.checkNotNullParameter(hostname, "hostname");
Intrinsics.checkNotNullParameter(peerCertificates, "peerCertificates");
check$okhttp(hostname, new Function0<List<? extends X509Certificate>>() { // from class: okhttp3.CertificatePinner$check$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
@Override // kotlin.jvm.functions.Function0
public final List<? extends X509Certificate> invoke() {
Iterable iterable;
CertificateChainCleaner certificateChainCleaner = CertificatePinner.this.getCertificateChainCleaner();
if (certificateChainCleaner == null || (iterable = certificateChainCleaner.clean(peerCertificates, hostname)) == null) {
iterable = peerCertificates;
}
Iterable $this$map$iv = iterable;
Collection destination$iv$iv = new ArrayList(CollectionsKt.collectionSizeOrDefault($this$map$iv, 10));
for (Object item$iv$iv : $this$map$iv) {
Certificate it = (Certificate) item$iv$iv;
if (it == null) {
throw new NullPointerException("null cannot be cast to non-null type java.security.cert.X509Certificate");
}
destination$iv$iv.add((X509Certificate) it);
}
return (List) destination$iv$iv;
}
});
}
public final void check$okhttp(String hostname, Function0<? extends List<? extends X509Certificate>> cleanedPeerCertificatesFn) {
Intrinsics.checkNotNullParameter(hostname, "hostname");
Intrinsics.checkNotNullParameter(cleanedPeerCertificatesFn, "cleanedPeerCertificatesFn");
List pins = findMatchingPins(hostname);
if (pins.isEmpty()) {
return;
}
List peerCertificates = cleanedPeerCertificatesFn.invoke();
for (X509Certificate peerCertificate : peerCertificates) {
ByteString sha1 = (ByteString) null;
ByteString sha256 = (ByteString) null;
for (Pin pin : pins) {
String hashAlgorithm = pin.getHashAlgorithm();
switch (hashAlgorithm.hashCode()) {
case -903629273:
if (hashAlgorithm.equals("sha256")) {
if (sha256 == null) {
sha256 = INSTANCE.sha256Hash(peerCertificate);
}
if (Intrinsics.areEqual(pin.getHash(), sha256)) {
return;
}
} else {
throw new AssertionError("unsupported hashAlgorithm: " + pin.getHashAlgorithm());
}
case 3528965:
if (hashAlgorithm.equals("sha1")) {
if (sha1 == null) {
sha1 = INSTANCE.sha1Hash(peerCertificate);
}
if (Intrinsics.areEqual(pin.getHash(), sha1)) {
return;
}
} else {
throw new AssertionError("unsupported hashAlgorithm: " + pin.getHashAlgorithm());
}
default:
throw new AssertionError("unsupported hashAlgorithm: " + pin.getHashAlgorithm());
}
}
}
StringBuilder $this$buildString = new StringBuilder();
$this$buildString.append("Certificate pinning failure!");
$this$buildString.append("\n Peer certificate chain:");
for (X509Certificate element : peerCertificates) {
$this$buildString.append("\n ");
$this$buildString.append(INSTANCE.pin(element));
$this$buildString.append(": ");
Principal subjectDN = element.getSubjectDN();
Intrinsics.checkNotNullExpressionValue(subjectDN, "element.subjectDN");
$this$buildString.append(subjectDN.getName());
}
$this$buildString.append("\n Pinned certificates for ");
$this$buildString.append(hostname);
$this$buildString.append(":");
for (Pin pin2 : pins) {
$this$buildString.append("\n ");
$this$buildString.append(pin2);
}
String message = $this$buildString.toString();
Intrinsics.checkNotNullExpressionValue(message, "StringBuilder().apply(builderAction).toString()");
throw new SSLPeerUnverifiedException(message);
}
@Deprecated(message = "replaced with {@link #check(String, List)}.", replaceWith = @ReplaceWith(expression = "check(hostname, peerCertificates.toList())", imports = {}))
public final void check(String hostname, Certificate... peerCertificates) throws SSLPeerUnverifiedException {
Intrinsics.checkNotNullParameter(hostname, "hostname");
Intrinsics.checkNotNullParameter(peerCertificates, "peerCertificates");
check(hostname, ArraysKt.toList(peerCertificates));
}
public final List<Pin> findMatchingPins(String hostname) {
Intrinsics.checkNotNullParameter(hostname, "hostname");
Iterable $this$filterList$iv = this.pins;
List result$iv = CollectionsKt.emptyList();
for (Object i$iv : $this$filterList$iv) {
Pin $this$filterList = (Pin) i$iv;
if ($this$filterList.matchesHostname(hostname)) {
if (result$iv.isEmpty()) {
List result$iv2 = new ArrayList();
result$iv = result$iv2;
}
if (result$iv == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.collections.MutableList<T>");
}
TypeIntrinsics.asMutableList(result$iv).add(i$iv);
}
}
return result$iv;
}
public final CertificatePinner withCertificateChainCleaner$okhttp(CertificateChainCleaner certificateChainCleaner) {
Intrinsics.checkNotNullParameter(certificateChainCleaner, "certificateChainCleaner");
if (Intrinsics.areEqual(this.certificateChainCleaner, certificateChainCleaner)) {
return this;
}
return new CertificatePinner(this.pins, certificateChainCleaner);
}
public boolean equals(Object other) {
return (other instanceof CertificatePinner) && Intrinsics.areEqual(((CertificatePinner) other).pins, this.pins) && Intrinsics.areEqual(((CertificatePinner) other).certificateChainCleaner, this.certificateChainCleaner);
}
public int hashCode() {
int result = (37 * 41) + this.pins.hashCode();
int result2 = result * 41;
CertificateChainCleaner certificateChainCleaner = this.certificateChainCleaner;
return result2 + (certificateChainCleaner != null ? certificateChainCleaner.hashCode() : 0);
}
/* compiled from: CertificatePinner.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003¢\u0006\u0002\u0010\u0005J\u0013\u0010\u000e\u001a\u00020\u000f2\b\u0010\u0010\u001a\u0004\u0018\u00010\u0001H\u0096\u0002J\b\u0010\u0011\u001a\u00020\u0012H\u0016J\u000e\u0010\u0013\u001a\u00020\u000f2\u0006\u0010\u0014\u001a\u00020\u0015J\u000e\u0010\u0016\u001a\u00020\u000f2\u0006\u0010\u0017\u001a\u00020\u0003J\b\u0010\u0018\u001a\u00020\u0003H\u0016R\u0011\u0010\u0006\u001a\u00020\u0007¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\tR\u0011\u0010\n\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\fR\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\\u0006\u0019"}, m238d2 = {"Lokhttp3/CertificatePinner$Pin;", "", "pattern", "", "pin", "(Ljava/lang/String;Ljava/lang/String;)V", "hash", "Lokio/ByteString;", "getHash", "()Lokio/ByteString;", "hashAlgorithm", "getHashAlgorithm", "()Ljava/lang/String;", "getPattern", "equals", "", "other", "hashCode", "", "matchesCertificate", "certificate", "Ljava/security/cert/X509Certificate;", "matchesHostname", "hostname", "toString", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Pin {
private final ByteString hash;
private final String hashAlgorithm;
private final String pattern;
public Pin(String pattern, String pin) {
Intrinsics.checkNotNullParameter(pattern, "pattern");
Intrinsics.checkNotNullParameter(pin, "pin");
if (!((StringsKt.startsWith$default(pattern, "*.", false, 2, (Object) null) && StringsKt.indexOf$default((CharSequence) pattern, "*", 1, false, 4, (Object) null) == -1) || (StringsKt.startsWith$default(pattern, "**.", false, 2, (Object) null) && StringsKt.indexOf$default((CharSequence) pattern, "*", 2, false, 4, (Object) null) == -1) || StringsKt.indexOf$default((CharSequence) pattern, "*", 0, false, 6, (Object) null) == -1)) {
throw new IllegalArgumentException(("Unexpected pattern: " + pattern).toString());
}
String canonicalHost = HostnamesKt.toCanonicalHost(pattern);
if (canonicalHost == null) {
throw new IllegalArgumentException("Invalid pattern: " + pattern);
}
this.pattern = canonicalHost;
if (StringsKt.startsWith$default(pin, "sha1/", false, 2, (Object) null)) {
this.hashAlgorithm = "sha1";
ByteString.Companion companion = ByteString.INSTANCE;
String substring = pin.substring("sha1/".length());
Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.String).substring(startIndex)");
ByteString decodeBase64 = companion.decodeBase64(substring);
if (decodeBase64 != null) {
this.hash = decodeBase64;
return;
}
throw new IllegalArgumentException("Invalid pin hash: " + pin);
}
if (!StringsKt.startsWith$default(pin, "sha256/", false, 2, (Object) null)) {
throw new IllegalArgumentException("pins must start with 'sha256/' or 'sha1/': " + pin);
}
this.hashAlgorithm = "sha256";
ByteString.Companion companion2 = ByteString.INSTANCE;
String substring2 = pin.substring("sha256/".length());
Intrinsics.checkNotNullExpressionValue(substring2, "(this as java.lang.String).substring(startIndex)");
ByteString decodeBase642 = companion2.decodeBase64(substring2);
if (decodeBase642 != null) {
this.hash = decodeBase642;
return;
}
throw new IllegalArgumentException("Invalid pin hash: " + pin);
}
public final String getPattern() {
return this.pattern;
}
public final String getHashAlgorithm() {
return this.hashAlgorithm;
}
public final ByteString getHash() {
return this.hash;
}
public final boolean matchesHostname(String hostname) {
boolean regionMatches;
boolean regionMatches2;
Intrinsics.checkNotNullParameter(hostname, "hostname");
if (StringsKt.startsWith$default(this.pattern, "**.", false, 2, (Object) null)) {
int suffixLength = this.pattern.length() - 3;
int prefixLength = hostname.length() - suffixLength;
regionMatches2 = StringsKt.regionMatches(hostname, hostname.length() - suffixLength, this.pattern, 3, suffixLength, (r12 & 16) != 0 ? false : false);
if (regionMatches2) {
return prefixLength == 0 || hostname.charAt(prefixLength + (-1)) == '.';
}
return false;
}
if (StringsKt.startsWith$default(this.pattern, "*.", false, 2, (Object) null)) {
int suffixLength2 = this.pattern.length() - 1;
int prefixLength2 = hostname.length() - suffixLength2;
regionMatches = StringsKt.regionMatches(hostname, hostname.length() - suffixLength2, this.pattern, 1, suffixLength2, (r12 & 16) != 0 ? false : false);
return regionMatches && StringsKt.lastIndexOf$default((CharSequence) hostname, '.', prefixLength2 + (-1), false, 4, (Object) null) == -1;
}
return Intrinsics.areEqual(hostname, this.pattern);
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
public final boolean matchesCertificate(X509Certificate certificate) {
Intrinsics.checkNotNullParameter(certificate, "certificate");
String str = this.hashAlgorithm;
switch (str.hashCode()) {
case -903629273:
if (str.equals("sha256")) {
return Intrinsics.areEqual(this.hash, CertificatePinner.INSTANCE.sha256Hash(certificate));
}
return false;
case 3528965:
if (str.equals("sha1")) {
return Intrinsics.areEqual(this.hash, CertificatePinner.INSTANCE.sha1Hash(certificate));
}
return false;
default:
return false;
}
}
public String toString() {
return this.hashAlgorithm + '/' + this.hash.base64();
}
public boolean equals(Object other) {
if (this == other) {
return true;
}
return (!(other instanceof Pin) || (Intrinsics.areEqual(this.pattern, ((Pin) other).pattern) ^ true) || (Intrinsics.areEqual(this.hashAlgorithm, ((Pin) other).hashAlgorithm) ^ true) || (Intrinsics.areEqual(this.hash, ((Pin) other).hash) ^ true)) ? false : true;
}
public int hashCode() {
int result = this.pattern.hashCode();
return (((result * 31) + this.hashAlgorithm.hashCode()) * 31) + this.hash.hashCode();
}
}
/* compiled from: CertificatePinner.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010!\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000e\n\u0002\u0010\u0011\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J'\u0010\b\u001a\u00020\u00002\u0006\u0010\t\u001a\u00020\n2\u0012\u0010\u0003\u001a\n\u0012\u0006\b\u0001\u0012\u00020\n0\u000b\"\u00020\\u0006\u0002\u0010\fJ\u0006\u0010\r\u001a\u00020\u000eR\u0017\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007¨\u0006\u000f"}, m238d2 = {"Lokhttp3/CertificatePinner$Builder;", "", "()V", "pins", "", "Lokhttp3/CertificatePinner$Pin;", "getPins", "()Ljava/util/List;", "add", "pattern", "", "", "(Ljava/lang/String;[Ljava/lang/String;)Lokhttp3/CertificatePinner$Builder;", "build", "Lokhttp3/CertificatePinner;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Builder {
private final List<Pin> pins = new ArrayList();
public final List<Pin> getPins() {
return this.pins;
}
public final Builder add(String pattern, String... pins) {
Intrinsics.checkNotNullParameter(pattern, "pattern");
Intrinsics.checkNotNullParameter(pins, "pins");
Builder $this$apply = this;
for (String pin : pins) {
$this$apply.pins.add(new Pin(pattern, pin));
}
return this;
}
/* JADX WARN: Multi-variable type inference failed */
public final CertificatePinner build() {
return new CertificatePinner(CollectionsKt.toSet(this.pins), null, 2, 0 == true ? 1 : 0);
}
}
/* compiled from: CertificatePinner.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0007J\f\u0010\t\u001a\u00020\n*\u00020\u000bH\u0007J\f\u0010\f\u001a\u00020\n*\u00020\u000bH\u0007R\u0010\u0010\u0003\u001a\u00020\u00048\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006\r"}, m238d2 = {"Lokhttp3/CertificatePinner$Companion;", "", "()V", "DEFAULT", "Lokhttp3/CertificatePinner;", "pin", "", "certificate", "Ljava/security/cert/Certificate;", "sha1Hash", "Lokio/ByteString;", "Ljava/security/cert/X509Certificate;", "sha256Hash", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
@JvmStatic
public final ByteString sha1Hash(X509Certificate sha1Hash) {
Intrinsics.checkNotNullParameter(sha1Hash, "$this$sha1Hash");
ByteString.Companion companion = ByteString.INSTANCE;
PublicKey publicKey = sha1Hash.getPublicKey();
Intrinsics.checkNotNullExpressionValue(publicKey, "publicKey");
byte[] encoded = publicKey.getEncoded();
Intrinsics.checkNotNullExpressionValue(encoded, "publicKey.encoded");
return ByteString.Companion.of$default(companion, encoded, 0, 0, 3, null).sha1();
}
@JvmStatic
public final ByteString sha256Hash(X509Certificate sha256Hash) {
Intrinsics.checkNotNullParameter(sha256Hash, "$this$sha256Hash");
ByteString.Companion companion = ByteString.INSTANCE;
PublicKey publicKey = sha256Hash.getPublicKey();
Intrinsics.checkNotNullExpressionValue(publicKey, "publicKey");
byte[] encoded = publicKey.getEncoded();
Intrinsics.checkNotNullExpressionValue(encoded, "publicKey.encoded");
return ByteString.Companion.of$default(companion, encoded, 0, 0, 3, null).sha256();
}
@JvmStatic
public final String pin(Certificate certificate) {
Intrinsics.checkNotNullParameter(certificate, "certificate");
if (!(certificate instanceof X509Certificate)) {
throw new IllegalArgumentException("Certificate pinning requires X509 certificates".toString());
}
return "sha256/" + sha256Hash((X509Certificate) certificate).base64();
}
}
}
@@ -0,0 +1,143 @@
package okhttp3;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.collections.MapsKt;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: Challenge.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010$\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0005\u0018\u00002\u00020\u0001B\u0017\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003¢\u0006\u0002\u0010\u0005B#\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0014\u0010\u0006\u001a\u0010\u0012\u0006\u0012\u0004\u0018\u00010\u0003\u0012\u0004\u0012\u00020\u00030\u0007¢\u0006\u0002\u0010\bJ\u001b\u0010\u0006\u001a\u0010\u0012\u0006\u0012\u0004\u0018\u00010\u0003\u0012\u0004\u0012\u00020\u00030\u0007H\u0007¢\u0006\u0002\b\u000eJ\r\u0010\n\u001a\u00020\u000bH\u0007¢\u0006\u0002\b\u000fJ\u0013\u0010\u0010\u001a\u00020\u00112\b\u0010\u0012\u001a\u0004\u0018\u00010\u0001H\u0096\u0002J\b\u0010\u0013\u001a\u00020\u0014H\u0016J\u000f\u0010\u0004\u001a\u0004\u0018\u00010\u0003H\u0007¢\u0006\u0002\b\u0015J\r\u0010\u0002\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u0016J\b\u0010\u0017\u001a\u00020\u0003H\u0016J\u000e\u0010\u0018\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u000bR!\u0010\u0006\u001a\u0010\u0012\u0006\u0012\u0004\u0018\u00010\u0003\u0012\u0004\u0012\u00020\u00030\u00078G¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\tR\u0011\u0010\n\u001a\u00020\u000b8G¢\u0006\u0006\u001a\u0004\b\n\u0010\fR\u0013\u0010\u0004\u001a\u0004\u0018\u00010\u00038G¢\u0006\u0006\u001a\u0004\b\u0004\u0010\rR\u0013\u0010\u0002\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\\u0006\u0019"}, m238d2 = {"Lokhttp3/Challenge;", "", "scheme", "", "realm", "(Ljava/lang/String;Ljava/lang/String;)V", "authParams", "", "(Ljava/lang/String;Ljava/util/Map;)V", "()Ljava/util/Map;", "charset", "Ljava/nio/charset/Charset;", "()Ljava/nio/charset/Charset;", "()Ljava/lang/String;", "-deprecated_authParams", "-deprecated_charset", "equals", "", "other", "hashCode", "", "-deprecated_realm", "-deprecated_scheme", "toString", "withCharset", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Challenge {
private final Map<String, String> authParams;
private final String scheme;
public Challenge(String scheme, Map<String, String> authParams) {
String newKey;
Intrinsics.checkNotNullParameter(scheme, "scheme");
Intrinsics.checkNotNullParameter(authParams, "authParams");
this.scheme = scheme;
Map newAuthParams = new LinkedHashMap();
for (Map.Entry<String, String> entry : authParams.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (key != null) {
Locale US = Locale.US;
Intrinsics.checkNotNullExpressionValue(US, "US");
if (key == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
newKey = key.toLowerCase(US);
Intrinsics.checkNotNullExpressionValue(newKey, "(this as java.lang.String).toLowerCase(locale)");
} else {
newKey = null;
}
newAuthParams.put(newKey, value);
}
Map<String, String> unmodifiableMap = Collections.unmodifiableMap(newAuthParams);
Intrinsics.checkNotNullExpressionValue(unmodifiableMap, "unmodifiableMap<String?, String>(newAuthParams)");
this.authParams = unmodifiableMap;
}
public final String scheme() {
return this.scheme;
}
public final Map<String, String> authParams() {
return this.authParams;
}
public final String realm() {
return this.authParams.get("realm");
}
public final Charset charset() {
String charset = this.authParams.get("charset");
if (charset != null) {
try {
Charset forName = Charset.forName(charset);
Intrinsics.checkNotNullExpressionValue(forName, "Charset.forName(charset)");
return forName;
} catch (Exception e) {
}
}
Charset ISO_8859_1 = StandardCharsets.ISO_8859_1;
Intrinsics.checkNotNullExpressionValue(ISO_8859_1, "ISO_8859_1");
return ISO_8859_1;
}
/* JADX WARN: Illegal instructions before constructor call */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public Challenge(java.lang.String r3, java.lang.String r4) {
/*
r2 = this;
java.lang.String r0 = "scheme"
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r3, r0)
java.lang.String r0 = "realm"
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r4, r0)
java.util.Map r0 = java.util.Collections.singletonMap(r0, r4)
java.lang.String r1 = "singletonMap(\"realm\", realm)"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r0, r1)
r2.<init>(r3, r0)
return
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.Challenge.<init>(java.lang.String, java.lang.String):void");
}
public final Challenge withCharset(Charset charset) {
Intrinsics.checkNotNullParameter(charset, "charset");
Map authParams = MapsKt.toMutableMap(this.authParams);
String name = charset.name();
Intrinsics.checkNotNullExpressionValue(name, "charset.name()");
authParams.put("charset", name);
return new Challenge(this.scheme, (Map<String, String>) authParams);
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "scheme", imports = {}))
/* renamed from: -deprecated_scheme, reason: not valid java name and from getter */
public final String getScheme() {
return this.scheme;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "authParams", imports = {}))
/* renamed from: -deprecated_authParams, reason: not valid java name */
public final Map<String, String> m1630deprecated_authParams() {
return this.authParams;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "realm", imports = {}))
/* renamed from: -deprecated_realm, reason: not valid java name */
public final String m1632deprecated_realm() {
return realm();
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "charset", imports = {}))
/* renamed from: -deprecated_charset, reason: not valid java name */
public final Charset m1631deprecated_charset() {
return charset();
}
public boolean equals(Object other) {
return (other instanceof Challenge) && Intrinsics.areEqual(((Challenge) other).scheme, this.scheme) && Intrinsics.areEqual(((Challenge) other).authParams, this.authParams);
}
public int hashCode() {
int result = (29 * 31) + this.scheme.hashCode();
return (result * 31) + this.authParams.hashCode();
}
public String toString() {
return this.scheme + " authParams=" + this.authParams;
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,17 @@
package okhttp3;
import java.net.Socket;
import kotlin.Metadata;
/* compiled from: Connection.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\bf\u0018\u00002\u00020\u0001J\n\u0010\u0002\u001a\u0004\u0018\u00010\u0003H&J\b\u0010\u0004\u001a\u00020\u0005H&J\b\u0010\u0006\u001a\u00020\u0007H&J\b\u0010\b\u001a\u00020\tH&¨\u0006\n"}, m238d2 = {"Lokhttp3/Connection;", "", "handshake", "Lokhttp3/Handshake;", "protocol", "Lokhttp3/Protocol;", "route", "Lokhttp3/Route;", "socket", "Ljava/net/Socket;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public interface Connection {
Handshake handshake();
Protocol protocol();
Route route();
Socket socket();
}
@@ -0,0 +1,46 @@
package okhttp3;
import java.util.concurrent.TimeUnit;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.internal.concurrent.TaskRunner;
import okhttp3.internal.connection.RealConnectionPool;
/* compiled from: ConnectionPool.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0002\u0018\u00002\u00020\u0001B\u001f\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007¢\u0006\u0002\u0010\bB\u0007\b\u0016¢\u0006\u0002\u0010\tB\u000f\b\u0000\u0012\u0006\u0010\n\u001a\u00020\u000b¢\u0006\u0002\u0010\fJ\u0006\u0010\u000f\u001a\u00020\u0003J\u0006\u0010\u0010\u001a\u00020\u0011J\u0006\u0010\u0012\u001a\u00020\u0003R\u0014\u0010\n\u001a\u00020\u000bX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u000e¨\u0006\u0013"}, m238d2 = {"Lokhttp3/ConnectionPool;", "", "maxIdleConnections", "", "keepAliveDuration", "", "timeUnit", "Ljava/util/concurrent/TimeUnit;", "(IJLjava/util/concurrent/TimeUnit;)V", "()V", "delegate", "Lokhttp3/internal/connection/RealConnectionPool;", "(Lokhttp3/internal/connection/RealConnectionPool;)V", "getDelegate$okhttp", "()Lokhttp3/internal/connection/RealConnectionPool;", "connectionCount", "evictAll", "", "idleConnectionCount", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class ConnectionPool {
private final RealConnectionPool delegate;
public ConnectionPool(RealConnectionPool delegate) {
Intrinsics.checkNotNullParameter(delegate, "delegate");
this.delegate = delegate;
}
/* renamed from: getDelegate$okhttp, reason: from getter */
public final RealConnectionPool getDelegate() {
return this.delegate;
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public ConnectionPool(int maxIdleConnections, long keepAliveDuration, TimeUnit timeUnit) {
this(new RealConnectionPool(TaskRunner.INSTANCE, maxIdleConnections, keepAliveDuration, timeUnit));
Intrinsics.checkNotNullParameter(timeUnit, "timeUnit");
}
public ConnectionPool() {
this(5, 5L, TimeUnit.MINUTES);
}
public final int idleConnectionCount() {
return this.delegate.idleConnectionCount();
}
public final int connectionCount() {
return this.delegate.connectionCount();
}
public final void evictAll() {
this.delegate.evictAll();
}
}
@@ -0,0 +1,351 @@
package okhttp3;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import javax.net.ssl.SSLSocket;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.collections.CollectionsKt;
import kotlin.comparisons.ComparisonsKt;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.internal.Util;
/* compiled from: ConnectionSpec.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000F\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\b\n\u0002\b\t\u0018\u0000 $2\u00020\u0001:\u0002#$B7\b\u0000\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003\u0012\u000e\u0010\u0005\u001a\n\u0012\u0004\u0012\u00020\u0007\u0018\u00010\u0006\u0012\u000e\u0010\b\u001a\n\u0012\u0004\u0012\u00020\u0007\u0018\u00010\u0006¢\u0006\u0002\u0010\tJ\u001d\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u0003H\u0000¢\u0006\u0002\b\u0017J\u0015\u0010\n\u001a\n\u0012\u0004\u0012\u00020\f\u0018\u00010\u000bH\u0007¢\u0006\u0002\b\u0018J\u0013\u0010\u0019\u001a\u00020\u00032\b\u0010\u001a\u001a\u0004\u0018\u00010\u0001H\u0096\u0002J\b\u0010\u001b\u001a\u00020\u001cH\u0016J\u000e\u0010\u001d\u001a\u00020\u00032\u0006\u0010\u001e\u001a\u00020\u0015J\u0018\u0010\u001f\u001a\u00020\u00002\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u0003H\u0002J\r\u0010\u0004\u001a\u00020\u0003H\u0007¢\u0006\u0002\b J\u0015\u0010\u0010\u001a\n\u0012\u0004\u0012\u00020\u0011\u0018\u00010\u000bH\u0007¢\u0006\u0002\b!J\b\u0010\"\u001a\u00020\u0007H\u0016R\u0019\u0010\n\u001a\n\u0012\u0004\u0012\u00020\f\u0018\u00010\u000b8G¢\u0006\u0006\u001a\u0004\b\n\u0010\rR\u0018\u0010\u0005\u001a\n\u0012\u0004\u0012\u00020\u0007\u0018\u00010\u0006X\u0082\u0004¢\u0006\u0004\n\u0002\u0010\u000eR\u0013\u0010\u0002\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\u000fR\u0013\u0010\u0004\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0004\u0010\u000fR\u0019\u0010\u0010\u001a\n\u0012\u0004\u0012\u00020\u0011\u0018\u00010\u000b8G¢\u0006\u0006\u001a\u0004\b\u0010\u0010\rR\u0018\u0010\b\u001a\n\u0012\u0004\u0012\u00020\u0007\u0018\u00010\u0006X\u0082\u0004¢\u0006\u0004\n\u0002\u0010\u000e¨\u0006%"}, m238d2 = {"Lokhttp3/ConnectionSpec;", "", "isTls", "", "supportsTlsExtensions", "cipherSuitesAsString", "", "", "tlsVersionsAsString", "(ZZ[Ljava/lang/String;[Ljava/lang/String;)V", "cipherSuites", "", "Lokhttp3/CipherSuite;", "()Ljava/util/List;", "[Ljava/lang/String;", "()Z", "tlsVersions", "Lokhttp3/TlsVersion;", "apply", "", "sslSocket", "Ljavax/net/ssl/SSLSocket;", "isFallback", "apply$okhttp", "-deprecated_cipherSuites", "equals", "other", "hashCode", "", "isCompatible", "socket", "supportedSpec", "-deprecated_supportsTlsExtensions", "-deprecated_tlsVersions", "toString", "Builder", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class ConnectionSpec {
private static final CipherSuite[] APPROVED_CIPHER_SUITES;
public static final ConnectionSpec CLEARTEXT;
public static final ConnectionSpec COMPATIBLE_TLS;
public static final ConnectionSpec MODERN_TLS;
private static final CipherSuite[] RESTRICTED_CIPHER_SUITES;
public static final ConnectionSpec RESTRICTED_TLS;
private final String[] cipherSuitesAsString;
private final boolean isTls;
private final boolean supportsTlsExtensions;
private final String[] tlsVersionsAsString;
public ConnectionSpec(boolean isTls, boolean supportsTlsExtensions, String[] cipherSuitesAsString, String[] tlsVersionsAsString) {
this.isTls = isTls;
this.supportsTlsExtensions = supportsTlsExtensions;
this.cipherSuitesAsString = cipherSuitesAsString;
this.tlsVersionsAsString = tlsVersionsAsString;
}
/* renamed from: isTls, reason: from getter */
public final boolean getIsTls() {
return this.isTls;
}
public final boolean supportsTlsExtensions() {
return this.supportsTlsExtensions;
}
public final List<CipherSuite> cipherSuites() {
String[] strArr = this.cipherSuitesAsString;
if (strArr == null) {
return null;
}
Collection destination$iv$iv = new ArrayList(strArr.length);
for (String str : strArr) {
destination$iv$iv.add(CipherSuite.INSTANCE.forJavaName(str));
}
return CollectionsKt.toList((List) destination$iv$iv);
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "cipherSuites", imports = {}))
/* renamed from: -deprecated_cipherSuites, reason: not valid java name */
public final List<CipherSuite> m1635deprecated_cipherSuites() {
return cipherSuites();
}
public final List<TlsVersion> tlsVersions() {
String[] strArr = this.tlsVersionsAsString;
if (strArr == null) {
return null;
}
Collection destination$iv$iv = new ArrayList(strArr.length);
for (String str : strArr) {
destination$iv$iv.add(TlsVersion.INSTANCE.forJavaName(str));
}
return CollectionsKt.toList((List) destination$iv$iv);
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "tlsVersions", imports = {}))
/* renamed from: -deprecated_tlsVersions, reason: not valid java name */
public final List<TlsVersion> m1637deprecated_tlsVersions() {
return tlsVersions();
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "supportsTlsExtensions", imports = {}))
/* renamed from: -deprecated_supportsTlsExtensions, reason: not valid java name and from getter */
public final boolean getSupportsTlsExtensions() {
return this.supportsTlsExtensions;
}
public final void apply$okhttp(SSLSocket sslSocket, boolean isFallback) {
Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
ConnectionSpec specToApply = supportedSpec(sslSocket, isFallback);
if (specToApply.tlsVersions() != null) {
sslSocket.setEnabledProtocols(specToApply.tlsVersionsAsString);
}
if (specToApply.cipherSuites() != null) {
sslSocket.setEnabledCipherSuites(specToApply.cipherSuitesAsString);
}
}
private final ConnectionSpec supportedSpec(SSLSocket sslSocket, boolean isFallback) {
String[] cipherSuitesIntersection;
String[] tlsVersionsIntersection;
if (this.cipherSuitesAsString != null) {
String[] enabledCipherSuites = sslSocket.getEnabledCipherSuites();
Intrinsics.checkNotNullExpressionValue(enabledCipherSuites, "sslSocket.enabledCipherSuites");
cipherSuitesIntersection = Util.intersect(enabledCipherSuites, this.cipherSuitesAsString, CipherSuite.INSTANCE.getORDER_BY_NAME$okhttp());
} else {
cipherSuitesIntersection = sslSocket.getEnabledCipherSuites();
}
if (this.tlsVersionsAsString != null) {
String[] enabledProtocols = sslSocket.getEnabledProtocols();
Intrinsics.checkNotNullExpressionValue(enabledProtocols, "sslSocket.enabledProtocols");
tlsVersionsIntersection = Util.intersect(enabledProtocols, this.tlsVersionsAsString, ComparisonsKt.naturalOrder());
} else {
tlsVersionsIntersection = sslSocket.getEnabledProtocols();
}
String[] supportedCipherSuites = sslSocket.getSupportedCipherSuites();
Intrinsics.checkNotNullExpressionValue(supportedCipherSuites, "supportedCipherSuites");
int indexOfFallbackScsv = Util.indexOf(supportedCipherSuites, "TLS_FALLBACK_SCSV", CipherSuite.INSTANCE.getORDER_BY_NAME$okhttp());
if (isFallback && indexOfFallbackScsv != -1) {
Intrinsics.checkNotNullExpressionValue(cipherSuitesIntersection, "cipherSuitesIntersection");
String str = supportedCipherSuites[indexOfFallbackScsv];
Intrinsics.checkNotNullExpressionValue(str, "supportedCipherSuites[indexOfFallbackScsv]");
cipherSuitesIntersection = Util.concat(cipherSuitesIntersection, str);
}
Builder builder = new Builder(this);
Intrinsics.checkNotNullExpressionValue(cipherSuitesIntersection, "cipherSuitesIntersection");
Builder cipherSuites = builder.cipherSuites((String[]) Arrays.copyOf(cipherSuitesIntersection, cipherSuitesIntersection.length));
Intrinsics.checkNotNullExpressionValue(tlsVersionsIntersection, "tlsVersionsIntersection");
return cipherSuites.tlsVersions((String[]) Arrays.copyOf(tlsVersionsIntersection, tlsVersionsIntersection.length)).build();
}
public final boolean isCompatible(SSLSocket socket) {
Intrinsics.checkNotNullParameter(socket, "socket");
if (!this.isTls) {
return false;
}
String[] strArr = this.tlsVersionsAsString;
if (strArr != null && !Util.hasIntersection(strArr, socket.getEnabledProtocols(), ComparisonsKt.naturalOrder())) {
return false;
}
String[] strArr2 = this.cipherSuitesAsString;
return strArr2 == null || Util.hasIntersection(strArr2, socket.getEnabledCipherSuites(), CipherSuite.INSTANCE.getORDER_BY_NAME$okhttp());
}
public boolean equals(Object other) {
if (!(other instanceof ConnectionSpec)) {
return false;
}
if (other == this) {
return true;
}
boolean z = this.isTls;
if (z != ((ConnectionSpec) other).isTls) {
return false;
}
return !z || (Arrays.equals(this.cipherSuitesAsString, ((ConnectionSpec) other).cipherSuitesAsString) && Arrays.equals(this.tlsVersionsAsString, ((ConnectionSpec) other).tlsVersionsAsString) && this.supportsTlsExtensions == ((ConnectionSpec) other).supportsTlsExtensions);
}
public int hashCode() {
if (!this.isTls) {
return 17;
}
int i = 17 * 31;
String[] strArr = this.cipherSuitesAsString;
int hashCode = (i + (strArr != null ? Arrays.hashCode(strArr) : 0)) * 31;
String[] strArr2 = this.tlsVersionsAsString;
return ((hashCode + (strArr2 != null ? Arrays.hashCode(strArr2) : 0)) * 31) + (!this.supportsTlsExtensions ? 1 : 0);
}
public String toString() {
if (!this.isTls) {
return "ConnectionSpec()";
}
return "ConnectionSpec(cipherSuites=" + Objects.toString(cipherSuites(), "[all enabled]") + ", tlsVersions=" + Objects.toString(tlsVersions(), "[all enabled]") + ", supportsTlsExtensions=" + this.supportsTlsExtensions + ')';
}
/* compiled from: ConnectionSpec.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\b\u0012\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0018\u00002\u00020\u0001B\u000f\b\u0010\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004B\u000f\b\u0016\u0012\u0006\u0010\u0005\u001a\u00020\u0006¢\u0006\u0002\u0010\u0007J\u0006\u0010\u0019\u001a\u00020\u0000J\u0006\u0010\u001a\u001a\u00020\u0000J\u0006\u0010\u001b\u001a\u00020\u0006J\u001f\u0010\b\u001a\u00020\u00002\u0012\u0010\b\u001a\n\u0012\u0006\b\u0001\u0012\u00020\n0\t\"\u00020\\u0006\u0002\u0010\u001cJ\u001f\u0010\b\u001a\u00020\u00002\u0012\u0010\b\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u001d0\t\"\u00020\u001d¢\u0006\u0002\u0010\u001eJ\u0010\u0010\u0010\u001a\u00020\u00002\u0006\u0010\u0010\u001a\u00020\u0003H\u0007J\u001f\u0010\u0016\u001a\u00020\u00002\u0012\u0010\u0016\u001a\n\u0012\u0006\b\u0001\u0012\u00020\n0\t\"\u00020\\u0006\u0002\u0010\u001cJ\u001f\u0010\u0016\u001a\u00020\u00002\u0012\u0010\u0016\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u001f0\t\"\u00020\u001f¢\u0006\u0002\u0010 R$\u0010\b\u001a\n\u0012\u0004\u0012\u00020\n\u0018\u00010\tX\u0080\u000e¢\u0006\u0010\n\u0002\u0010\u000f\u001a\u0004\b\u000b\u0010\f\"\u0004\b\r\u0010\u000eR\u001a\u0010\u0010\u001a\u00020\u0003X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0011\u0010\u0012\"\u0004\b\u0013\u0010\u0004R\u001a\u0010\u0002\u001a\u00020\u0003X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0014\u0010\u0012\"\u0004\b\u0015\u0010\u0004R$\u0010\u0016\u001a\n\u0012\u0004\u0012\u00020\n\u0018\u00010\tX\u0080\u000e¢\u0006\u0010\n\u0002\u0010\u000f\u001a\u0004\b\u0017\u0010\f\"\u0004\b\u0018\u0010\u000e¨\u0006!"}, m238d2 = {"Lokhttp3/ConnectionSpec$Builder;", "", "tls", "", "(Z)V", "connectionSpec", "Lokhttp3/ConnectionSpec;", "(Lokhttp3/ConnectionSpec;)V", "cipherSuites", "", "", "getCipherSuites$okhttp", "()[Ljava/lang/String;", "setCipherSuites$okhttp", "([Ljava/lang/String;)V", "[Ljava/lang/String;", "supportsTlsExtensions", "getSupportsTlsExtensions$okhttp", "()Z", "setSupportsTlsExtensions$okhttp", "getTls$okhttp", "setTls$okhttp", "tlsVersions", "getTlsVersions$okhttp", "setTlsVersions$okhttp", "allEnabledCipherSuites", "allEnabledTlsVersions", "build", "([Ljava/lang/String;)Lokhttp3/ConnectionSpec$Builder;", "Lokhttp3/CipherSuite;", "([Lokhttp3/CipherSuite;)Lokhttp3/ConnectionSpec$Builder;", "Lokhttp3/TlsVersion;", "([Lokhttp3/TlsVersion;)Lokhttp3/ConnectionSpec$Builder;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Builder {
private String[] cipherSuites;
private boolean supportsTlsExtensions;
private boolean tls;
private String[] tlsVersions;
/* renamed from: getTls$okhttp, reason: from getter */
public final boolean getTls() {
return this.tls;
}
public final void setTls$okhttp(boolean z) {
this.tls = z;
}
/* renamed from: getCipherSuites$okhttp, reason: from getter */
public final String[] getCipherSuites() {
return this.cipherSuites;
}
public final void setCipherSuites$okhttp(String[] strArr) {
this.cipherSuites = strArr;
}
/* renamed from: getTlsVersions$okhttp, reason: from getter */
public final String[] getTlsVersions() {
return this.tlsVersions;
}
public final void setTlsVersions$okhttp(String[] strArr) {
this.tlsVersions = strArr;
}
/* renamed from: getSupportsTlsExtensions$okhttp, reason: from getter */
public final boolean getSupportsTlsExtensions() {
return this.supportsTlsExtensions;
}
public final void setSupportsTlsExtensions$okhttp(boolean z) {
this.supportsTlsExtensions = z;
}
public Builder(boolean tls) {
this.tls = tls;
}
public Builder(ConnectionSpec connectionSpec) {
Intrinsics.checkNotNullParameter(connectionSpec, "connectionSpec");
this.tls = connectionSpec.getIsTls();
this.cipherSuites = connectionSpec.cipherSuitesAsString;
this.tlsVersions = connectionSpec.tlsVersionsAsString;
this.supportsTlsExtensions = connectionSpec.supportsTlsExtensions();
}
public final Builder allEnabledCipherSuites() {
Builder $this$apply = this;
if (!$this$apply.tls) {
throw new IllegalArgumentException("no cipher suites for cleartext connections".toString());
}
$this$apply.cipherSuites = null;
return this;
}
public final Builder cipherSuites(CipherSuite... cipherSuites) {
Intrinsics.checkNotNullParameter(cipherSuites, "cipherSuites");
Builder $this$apply = this;
if (!$this$apply.tls) {
throw new IllegalArgumentException("no cipher suites for cleartext connections".toString());
}
Collection destination$iv$iv = new ArrayList(cipherSuites.length);
for (CipherSuite cipherSuite : cipherSuites) {
destination$iv$iv.add(cipherSuite.javaName());
}
Collection $this$toTypedArray$iv = (List) destination$iv$iv;
Object[] array = $this$toTypedArray$iv.toArray(new String[0]);
if (array == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
}
String[] strings = (String[]) array;
return $this$apply.cipherSuites((String[]) Arrays.copyOf(strings, strings.length));
}
public final Builder cipherSuites(String... cipherSuites) {
Intrinsics.checkNotNullParameter(cipherSuites, "cipherSuites");
Builder $this$apply = this;
if (!$this$apply.tls) {
throw new IllegalArgumentException("no cipher suites for cleartext connections".toString());
}
if (!(!(cipherSuites.length == 0))) {
throw new IllegalArgumentException("At least one cipher suite is required".toString());
}
Object clone = cipherSuites.clone();
if (clone != null) {
$this$apply.cipherSuites = (String[]) clone;
return this;
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<kotlin.String>");
}
public final Builder allEnabledTlsVersions() {
Builder $this$apply = this;
if (!$this$apply.tls) {
throw new IllegalArgumentException("no TLS versions for cleartext connections".toString());
}
$this$apply.tlsVersions = null;
return this;
}
public final Builder tlsVersions(TlsVersion... tlsVersions) {
Intrinsics.checkNotNullParameter(tlsVersions, "tlsVersions");
Builder $this$apply = this;
if (!$this$apply.tls) {
throw new IllegalArgumentException("no TLS versions for cleartext connections".toString());
}
Collection destination$iv$iv = new ArrayList(tlsVersions.length);
for (TlsVersion tlsVersion : tlsVersions) {
destination$iv$iv.add(tlsVersion.javaName());
}
Collection $this$toTypedArray$iv = (List) destination$iv$iv;
Object[] array = $this$toTypedArray$iv.toArray(new String[0]);
if (array == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
}
String[] strings = (String[]) array;
return $this$apply.tlsVersions((String[]) Arrays.copyOf(strings, strings.length));
}
public final Builder tlsVersions(String... tlsVersions) {
Intrinsics.checkNotNullParameter(tlsVersions, "tlsVersions");
Builder $this$apply = this;
if (!$this$apply.tls) {
throw new IllegalArgumentException("no TLS versions for cleartext connections".toString());
}
if (!(!(tlsVersions.length == 0))) {
throw new IllegalArgumentException("At least one TLS version is required".toString());
}
Object clone = tlsVersions.clone();
if (clone != null) {
$this$apply.tlsVersions = (String[]) clone;
return this;
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<kotlin.String>");
}
@Deprecated(message = "since OkHttp 3.13 all TLS-connections are expected to support TLS extensions.\nIn a future release setting this to true will be unnecessary and setting it to false\nwill have no effect.")
public final Builder supportsTlsExtensions(boolean supportsTlsExtensions) {
Builder $this$apply = this;
if (!$this$apply.tls) {
throw new IllegalArgumentException("no TLS extensions for cleartext connections".toString());
}
$this$apply.supportsTlsExtensions = supportsTlsExtensions;
return this;
}
public final ConnectionSpec build() {
return new ConnectionSpec(this.tls, this.supportsTlsExtensions, this.cipherSuites, this.tlsVersions);
}
}
static {
CipherSuite[] cipherSuiteArr = {CipherSuite.TLS_AES_128_GCM_SHA256, CipherSuite.TLS_AES_256_GCM_SHA384, CipherSuite.TLS_CHACHA20_POLY1305_SHA256, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, CipherSuite.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256};
RESTRICTED_CIPHER_SUITES = cipherSuiteArr;
CipherSuite[] cipherSuiteArr2 = {CipherSuite.TLS_AES_128_GCM_SHA256, CipherSuite.TLS_AES_256_GCM_SHA384, CipherSuite.TLS_CHACHA20_POLY1305_SHA256, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, CipherSuite.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, CipherSuite.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_RSA_WITH_AES_128_GCM_SHA256, CipherSuite.TLS_RSA_WITH_AES_256_GCM_SHA384, CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA, CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA, CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA};
APPROVED_CIPHER_SUITES = cipherSuiteArr2;
RESTRICTED_TLS = new Builder(true).cipherSuites((CipherSuite[]) Arrays.copyOf(cipherSuiteArr, cipherSuiteArr.length)).tlsVersions(TlsVersion.TLS_1_3, TlsVersion.TLS_1_2).supportsTlsExtensions(true).build();
MODERN_TLS = new Builder(true).cipherSuites((CipherSuite[]) Arrays.copyOf(cipherSuiteArr2, cipherSuiteArr2.length)).tlsVersions(TlsVersion.TLS_1_3, TlsVersion.TLS_1_2).supportsTlsExtensions(true).build();
COMPATIBLE_TLS = new Builder(true).cipherSuites((CipherSuite[]) Arrays.copyOf(cipherSuiteArr2, cipherSuiteArr2.length)).tlsVersions(TlsVersion.TLS_1_3, TlsVersion.TLS_1_2, TlsVersion.TLS_1_1, TlsVersion.TLS_1_0).supportsTlsExtensions(true).build();
CLEARTEXT = new Builder(false).build();
}
}
@@ -0,0 +1,10 @@
package okhttp3;
/* compiled from: D8$$SyntheticClass */
/* loaded from: classes11.dex */
public final /* synthetic */ class Cookie$$ExternalSyntheticBackport0 {
/* renamed from: m */
public static /* synthetic */ int m258m(long j) {
return (int) (j ^ (j >>> 32));
}
}
@@ -0,0 +1,10 @@
package okhttp3;
/* compiled from: D8$$SyntheticClass */
/* loaded from: classes11.dex */
public final /* synthetic */ class Cookie$$ExternalSyntheticBackport1 {
/* renamed from: m */
public static /* synthetic */ int m259m(boolean z) {
return z ? 1231 : 1237;
}
}
@@ -0,0 +1,661 @@
package okhttp3;
import com.google.android.gms.common.internal.ImagesContract;
import com.google.common.net.HttpHeaders;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.LongCompanionObject;
import kotlin.text.Regex;
import kotlin.text.StringsKt;
import okhttp3.internal.HostnamesKt;
import okhttp3.internal.Util;
import okhttp3.internal.http.DatesKt;
import okhttp3.internal.publicsuffix.PublicSuffixDatabase;
/* compiled from: Cookie.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\f\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u000b\u0018\u0000 &2\u00020\u0001:\u0002%&BO\b\u0002\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003\u0012\u0006\u0010\u0005\u001a\u00020\u0006\u0012\u0006\u0010\u0007\u001a\u00020\u0003\u0012\u0006\u0010\b\u001a\u00020\u0003\u0012\u0006\u0010\t\u001a\u00020\n\u0012\u0006\u0010\u000b\u001a\u00020\n\u0012\u0006\u0010\f\u001a\u00020\n\u0012\u0006\u0010\r\u001a\u00020\\u0006\u0002\u0010\u000eJ\r\u0010\u0007\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u0012J\u0013\u0010\u0013\u001a\u00020\n2\b\u0010\u0014\u001a\u0004\u0018\u00010\u0001H\u0096\u0002J\r\u0010\u0005\u001a\u00020\u0006H\u0007¢\u0006\u0002\b\u0015J\b\u0010\u0016\u001a\u00020\u0017H\u0017J\r\u0010\r\u001a\u00020\nH\u0007¢\u0006\u0002\b\u0018J\r\u0010\u000b\u001a\u00020\nH\u0007¢\u0006\u0002\b\u0019J\u000e\u0010\u001a\u001a\u00020\n2\u0006\u0010\u001b\u001a\u00020\u001cJ\r\u0010\u0002\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u001dJ\r\u0010\b\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u001eJ\r\u0010\f\u001a\u00020\nH\u0007¢\u0006\u0002\b\u001fJ\r\u0010\t\u001a\u00020\nH\u0007¢\u0006\u0002\b J\b\u0010!\u001a\u00020\u0003H\u0016J\u0015\u0010!\u001a\u00020\u00032\u0006\u0010\"\u001a\u00020\nH\u0000¢\u0006\u0002\b#J\r\u0010\u0004\u001a\u00020\u0003H\u0007¢\u0006\u0002\b$R\u0013\u0010\u0007\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\u000fR\u0013\u0010\u0005\u001a\u00020\u00068\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0010R\u0013\u0010\r\u001a\u00020\n8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u0011R\u0013\u0010\u000b\u001a\u00020\n8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\u0011R\u0013\u0010\u0002\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\u000fR\u0013\u0010\b\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\u000fR\u0013\u0010\f\u001a\u00020\n8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\f\u0010\u0011R\u0013\u0010\t\u001a\u00020\n8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\u0011R\u0013\u0010\u0004\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0004\u0010\u000f¨\u0006'"}, m238d2 = {"Lokhttp3/Cookie;", "", "name", "", "value", "expiresAt", "", "domain", "path", "secure", "", "httpOnly", "persistent", "hostOnly", "(Ljava/lang/String;Ljava/lang/String;JLjava/lang/String;Ljava/lang/String;ZZZZ)V", "()Ljava/lang/String;", "()J", "()Z", "-deprecated_domain", "equals", "other", "-deprecated_expiresAt", "hashCode", "", "-deprecated_hostOnly", "-deprecated_httpOnly", "matches", ImagesContract.URL, "Lokhttp3/HttpUrl;", "-deprecated_name", "-deprecated_path", "-deprecated_persistent", "-deprecated_secure", "toString", "forObsoleteRfc2965", "toString$okhttp", "-deprecated_value", "Builder", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Cookie {
private final String domain;
private final long expiresAt;
private final boolean hostOnly;
private final boolean httpOnly;
private final String name;
private final String path;
private final boolean persistent;
private final boolean secure;
private final String value;
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private static final Pattern YEAR_PATTERN = Pattern.compile("(\\d{2,4})[^\\d]*");
private static final Pattern MONTH_PATTERN = Pattern.compile("(?i)(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec).*");
private static final Pattern DAY_OF_MONTH_PATTERN = Pattern.compile("(\\d{1,2})[^\\d]*");
private static final Pattern TIME_PATTERN = Pattern.compile("(\\d{1,2}):(\\d{1,2}):(\\d{1,2})[^\\d]*");
@JvmStatic
public static final Cookie parse(HttpUrl httpUrl, String str) {
return INSTANCE.parse(httpUrl, str);
}
@JvmStatic
public static final List<Cookie> parseAll(HttpUrl httpUrl, Headers headers) {
return INSTANCE.parseAll(httpUrl, headers);
}
private Cookie(String name, String value, long expiresAt, String domain, String path, boolean secure, boolean httpOnly, boolean persistent, boolean hostOnly) {
this.name = name;
this.value = value;
this.expiresAt = expiresAt;
this.domain = domain;
this.path = path;
this.secure = secure;
this.httpOnly = httpOnly;
this.persistent = persistent;
this.hostOnly = hostOnly;
}
public /* synthetic */ Cookie(String name, String value, long expiresAt, String domain, String path, boolean secure, boolean httpOnly, boolean persistent, boolean hostOnly, DefaultConstructorMarker $constructor_marker) {
this(name, value, expiresAt, domain, path, secure, httpOnly, persistent, hostOnly);
}
public final String name() {
return this.name;
}
public final String value() {
return this.value;
}
public final long expiresAt() {
return this.expiresAt;
}
public final String domain() {
return this.domain;
}
public final String path() {
return this.path;
}
public final boolean secure() {
return this.secure;
}
public final boolean httpOnly() {
return this.httpOnly;
}
public final boolean persistent() {
return this.persistent;
}
public final boolean hostOnly() {
return this.hostOnly;
}
public final boolean matches(HttpUrl url) {
boolean domainMatch;
Intrinsics.checkNotNullParameter(url, "url");
if (this.hostOnly) {
domainMatch = Intrinsics.areEqual(url.host(), this.domain);
} else {
domainMatch = INSTANCE.domainMatch(url.host(), this.domain);
}
if (domainMatch && INSTANCE.pathMatch(url, this.path)) {
return !this.secure || url.getIsHttps();
}
return false;
}
public boolean equals(Object other) {
return (other instanceof Cookie) && Intrinsics.areEqual(((Cookie) other).name, this.name) && Intrinsics.areEqual(((Cookie) other).value, this.value) && ((Cookie) other).expiresAt == this.expiresAt && Intrinsics.areEqual(((Cookie) other).domain, this.domain) && Intrinsics.areEqual(((Cookie) other).path, this.path) && ((Cookie) other).secure == this.secure && ((Cookie) other).httpOnly == this.httpOnly && ((Cookie) other).persistent == this.persistent && ((Cookie) other).hostOnly == this.hostOnly;
}
public int hashCode() {
int result = (17 * 31) + this.name.hashCode();
return (((((((((((((((result * 31) + this.value.hashCode()) * 31) + Cookie$$ExternalSyntheticBackport0.m258m(this.expiresAt)) * 31) + this.domain.hashCode()) * 31) + this.path.hashCode()) * 31) + Cookie$$ExternalSyntheticBackport1.m259m(this.secure)) * 31) + Cookie$$ExternalSyntheticBackport1.m259m(this.httpOnly)) * 31) + Cookie$$ExternalSyntheticBackport1.m259m(this.persistent)) * 31) + Cookie$$ExternalSyntheticBackport1.m259m(this.hostOnly);
}
public String toString() {
return toString$okhttp(false);
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "name", imports = {}))
/* renamed from: -deprecated_name, reason: not valid java name and from getter */
public final String getName() {
return this.name;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "value", imports = {}))
/* renamed from: -deprecated_value, reason: not valid java name and from getter */
public final String getValue() {
return this.value;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "persistent", imports = {}))
/* renamed from: -deprecated_persistent, reason: not valid java name and from getter */
public final boolean getPersistent() {
return this.persistent;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "expiresAt", imports = {}))
/* renamed from: -deprecated_expiresAt, reason: not valid java name and from getter */
public final long getExpiresAt() {
return this.expiresAt;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "hostOnly", imports = {}))
/* renamed from: -deprecated_hostOnly, reason: not valid java name and from getter */
public final boolean getHostOnly() {
return this.hostOnly;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "domain", imports = {}))
/* renamed from: -deprecated_domain, reason: not valid java name and from getter */
public final String getDomain() {
return this.domain;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "path", imports = {}))
/* renamed from: -deprecated_path, reason: not valid java name and from getter */
public final String getPath() {
return this.path;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "httpOnly", imports = {}))
/* renamed from: -deprecated_httpOnly, reason: not valid java name and from getter */
public final boolean getHttpOnly() {
return this.httpOnly;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "secure", imports = {}))
/* renamed from: -deprecated_secure, reason: not valid java name and from getter */
public final boolean getSecure() {
return this.secure;
}
public final String toString$okhttp(boolean forObsoleteRfc2965) {
StringBuilder $this$buildString = new StringBuilder();
$this$buildString.append(this.name);
$this$buildString.append('=');
$this$buildString.append(this.value);
if (this.persistent) {
if (this.expiresAt == Long.MIN_VALUE) {
$this$buildString.append("; max-age=0");
} else {
$this$buildString.append("; expires=");
$this$buildString.append(DatesKt.toHttpDateString(new Date(this.expiresAt)));
}
}
if (!this.hostOnly) {
$this$buildString.append("; domain=");
if (forObsoleteRfc2965) {
$this$buildString.append(".");
}
$this$buildString.append(this.domain);
}
$this$buildString.append("; path=");
$this$buildString.append(this.path);
if (this.secure) {
$this$buildString.append("; secure");
}
if (this.httpOnly) {
$this$buildString.append("; httponly");
}
String sb = $this$buildString.toString();
Intrinsics.checkNotNullExpressionValue(sb, "toString()");
return sb;
}
/* compiled from: Cookie.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0002\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0006\u0010\u000f\u001a\u00020\u0010J\u000e\u0010\u0003\u001a\u00020\u00002\u0006\u0010\u0003\u001a\u00020\u0004J\u0018\u0010\u0003\u001a\u00020\u00002\u0006\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\bH\u0002J\u000e\u0010\u0005\u001a\u00020\u00002\u0006\u0010\u0005\u001a\u00020\u0006J\u000e\u0010\u0011\u001a\u00020\u00002\u0006\u0010\u0003\u001a\u00020\u0004J\u0006\u0010\t\u001a\u00020\u0000J\u000e\u0010\n\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u0004J\u000e\u0010\u000b\u001a\u00020\u00002\u0006\u0010\u000b\u001a\u00020\u0004J\u0006\u0010\r\u001a\u00020\u0000J\u000e\u0010\u000e\u001a\u00020\u00002\u0006\u0010\u000e\u001a\u00020\u0004R\u0010\u0010\u0003\u001a\u0004\u0018\u00010\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\n\u001a\u0004\u0018\u00010\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u000e\u001a\u0004\u0018\u00010\u0004X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0012"}, m238d2 = {"Lokhttp3/Cookie$Builder;", "", "()V", "domain", "", "expiresAt", "", "hostOnly", "", "httpOnly", "name", "path", "persistent", "secure", "value", "build", "Lokhttp3/Cookie;", "hostOnlyDomain", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Builder {
private String domain;
private boolean hostOnly;
private boolean httpOnly;
private String name;
private boolean persistent;
private boolean secure;
private String value;
private long expiresAt = DatesKt.MAX_DATE;
private String path = "/";
public final Builder name(String name) {
Intrinsics.checkNotNullParameter(name, "name");
Builder $this$apply = this;
if (!Intrinsics.areEqual(StringsKt.trim((CharSequence) name).toString(), name)) {
throw new IllegalArgumentException("name is not trimmed".toString());
}
$this$apply.name = name;
return this;
}
public final Builder value(String value) {
Intrinsics.checkNotNullParameter(value, "value");
Builder $this$apply = this;
if (!Intrinsics.areEqual(StringsKt.trim((CharSequence) value).toString(), value)) {
throw new IllegalArgumentException("value is not trimmed".toString());
}
$this$apply.value = value;
return this;
}
public final Builder expiresAt(long expiresAt) {
Builder $this$apply = this;
long expiresAt2 = expiresAt;
if (expiresAt2 <= 0) {
expiresAt2 = Long.MIN_VALUE;
}
if (expiresAt2 > DatesKt.MAX_DATE) {
expiresAt2 = DatesKt.MAX_DATE;
}
$this$apply.expiresAt = expiresAt2;
$this$apply.persistent = true;
return this;
}
public final Builder domain(String domain) {
Intrinsics.checkNotNullParameter(domain, "domain");
return domain(domain, false);
}
public final Builder hostOnlyDomain(String domain) {
Intrinsics.checkNotNullParameter(domain, "domain");
return domain(domain, true);
}
private final Builder domain(String domain, boolean hostOnly) {
Builder $this$apply = this;
String canonicalDomain = HostnamesKt.toCanonicalHost(domain);
if (canonicalDomain == null) {
throw new IllegalArgumentException("unexpected domain: " + domain);
}
$this$apply.domain = canonicalDomain;
$this$apply.hostOnly = hostOnly;
return this;
}
public final Builder path(String path) {
Intrinsics.checkNotNullParameter(path, "path");
Builder $this$apply = this;
if (!StringsKt.startsWith$default(path, "/", false, 2, (Object) null)) {
throw new IllegalArgumentException("path must start with '/'".toString());
}
$this$apply.path = path;
return this;
}
public final Builder secure() {
Builder $this$apply = this;
$this$apply.secure = true;
return this;
}
public final Builder httpOnly() {
Builder $this$apply = this;
$this$apply.httpOnly = true;
return this;
}
public final Cookie build() {
String str = this.name;
if (str == null) {
throw new NullPointerException("builder.name == null");
}
String str2 = this.value;
if (str2 == null) {
throw new NullPointerException("builder.value == null");
}
long j = this.expiresAt;
String str3 = this.domain;
if (str3 != null) {
return new Cookie(str, str2, j, str3, this.path, this.secure, this.httpOnly, this.persistent, this.hostOnly, null);
}
throw new NullPointerException("builder.domain == null");
}
}
/* compiled from: Cookie.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000L\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010 \n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J(\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\n2\u0006\u0010\u000e\u001a\u00020\n2\u0006\u0010\u000f\u001a\u00020\u0010H\u0002J\u0018\u0010\u0011\u001a\u00020\u00102\u0006\u0010\u0012\u001a\u00020\f2\u0006\u0010\u0013\u001a\u00020\fH\u0002J'\u0010\u0014\u001a\u0004\u0018\u00010\u00152\u0006\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u0018\u001a\u00020\u00192\u0006\u0010\u001a\u001a\u00020\fH\u0000¢\u0006\u0002\b\u001bJ\u001a\u0010\u0014\u001a\u0004\u0018\u00010\u00152\u0006\u0010\u0018\u001a\u00020\u00192\u0006\u0010\u001a\u001a\u00020\fH\u0007J\u001e\u0010\u001c\u001a\b\u0012\u0004\u0012\u00020\u00150\u001d2\u0006\u0010\u0018\u001a\u00020\u00192\u0006\u0010\u001e\u001a\u00020\u001fH\u0007J\u0010\u0010 \u001a\u00020\f2\u0006\u0010!\u001a\u00020\fH\u0002J \u0010\"\u001a\u00020\u00172\u0006\u0010!\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\n2\u0006\u0010\u000e\u001a\u00020\nH\u0002J\u0010\u0010#\u001a\u00020\u00172\u0006\u0010!\u001a\u00020\fH\u0002J\u0018\u0010$\u001a\u00020\u00102\u0006\u0010\u0018\u001a\u00020\u00192\u0006\u0010%\u001a\u00020\fH\u0002R\u0016\u0010\u0003\u001a\n \u0005*\u0004\u0018\u00010\u00040\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0016\u0010\u0006\u001a\n \u0005*\u0004\u0018\u00010\u00040\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0016\u0010\u0007\u001a\n \u0005*\u0004\u0018\u00010\u00040\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0016\u0010\b\u001a\n \u0005*\u0004\u0018\u00010\u00040\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006&"}, m238d2 = {"Lokhttp3/Cookie$Companion;", "", "()V", "DAY_OF_MONTH_PATTERN", "Ljava/util/regex/Pattern;", "kotlin.jvm.PlatformType", "MONTH_PATTERN", "TIME_PATTERN", "YEAR_PATTERN", "dateCharacterOffset", "", "input", "", "pos", "limit", "invert", "", "domainMatch", "urlHost", "domain", "parse", "Lokhttp3/Cookie;", "currentTimeMillis", "", ImagesContract.URL, "Lokhttp3/HttpUrl;", "setCookie", "parse$okhttp", "parseAll", "", "headers", "Lokhttp3/Headers;", "parseDomain", "s", "parseExpires", "parseMaxAge", "pathMatch", "path", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean domainMatch(String urlHost, String domain) {
if (Intrinsics.areEqual(urlHost, domain)) {
return true;
}
return StringsKt.endsWith$default(urlHost, domain, false, 2, (Object) null) && urlHost.charAt((urlHost.length() - domain.length()) - 1) == '.' && !Util.canParseAsIpAddress(urlHost);
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean pathMatch(HttpUrl url, String path) {
String urlPath = url.encodedPath();
if (Intrinsics.areEqual(urlPath, path)) {
return true;
}
return StringsKt.startsWith$default(urlPath, path, false, 2, (Object) null) && (StringsKt.endsWith$default(path, "/", false, 2, (Object) null) || urlPath.charAt(path.length()) == '/');
}
@JvmStatic
public final Cookie parse(HttpUrl url, String setCookie) {
Intrinsics.checkNotNullParameter(url, "url");
Intrinsics.checkNotNullParameter(setCookie, "setCookie");
return parse$okhttp(System.currentTimeMillis(), url, setCookie);
}
public final Cookie parse$okhttp(long currentTimeMillis, HttpUrl url, String setCookie) {
long expiresAt;
long deltaMilliseconds;
String encodedPath;
String str;
int pairEqualsSign;
int limit;
boolean z;
Intrinsics.checkNotNullParameter(url, "url");
Intrinsics.checkNotNullParameter(setCookie, "setCookie");
int cookiePairEnd = Util.delimiterOffset$default(setCookie, ';', 0, 0, 6, (Object) null);
int pairEqualsSign2 = Util.delimiterOffset$default(setCookie, '=', 0, cookiePairEnd, 2, (Object) null);
if (pairEqualsSign2 == cookiePairEnd) {
return null;
}
boolean z2 = true;
String cookieName = Util.trimSubstring$default(setCookie, 0, pairEqualsSign2, 1, null);
if (!(cookieName.length() == 0) && Util.indexOfControlOrNonAscii(cookieName) == -1) {
String cookieValue = Util.trimSubstring(setCookie, pairEqualsSign2 + 1, cookiePairEnd);
if (Util.indexOfControlOrNonAscii(cookieValue) != -1) {
return null;
}
String domain = (String) null;
String path = (String) null;
int pos = cookiePairEnd + 1;
int limit2 = setCookie.length();
long deltaSeconds = -1;
boolean secureOnly = false;
boolean httpOnly = false;
boolean hostOnly = true;
boolean persistent = false;
int pos2 = pos;
long expiresAt2 = 253402300799999L;
String path2 = path;
String domain2 = domain;
while (pos2 < limit2) {
int attributePairEnd = Util.delimiterOffset(setCookie, ';', pos2, limit2);
int attributeEqualsSign = Util.delimiterOffset(setCookie, '=', pos2, attributePairEnd);
String attributeName = Util.trimSubstring(setCookie, pos2, attributeEqualsSign);
if (attributeEqualsSign < attributePairEnd) {
str = Util.trimSubstring(setCookie, attributeEqualsSign + 1, attributePairEnd);
} else {
str = "";
}
String attributeValue = str;
if (StringsKt.equals(attributeName, "expires", z2)) {
try {
pairEqualsSign = pairEqualsSign2;
limit = limit2;
try {
expiresAt2 = parseExpires(attributeValue, 0, attributeValue.length());
persistent = true;
z = true;
} catch (IllegalArgumentException e) {
z = true;
pos2 = attributePairEnd + 1;
z2 = z;
pairEqualsSign2 = pairEqualsSign;
limit2 = limit;
}
} catch (IllegalArgumentException e2) {
pairEqualsSign = pairEqualsSign2;
limit = limit2;
}
} else {
pairEqualsSign = pairEqualsSign2;
limit = limit2;
if (StringsKt.equals(attributeName, "max-age", true)) {
try {
long deltaSeconds2 = parseMaxAge(attributeValue);
persistent = true;
deltaSeconds = deltaSeconds2;
z = true;
} catch (NumberFormatException e3) {
z = true;
}
} else if (StringsKt.equals(attributeName, "domain", true)) {
try {
String domain3 = parseDomain(attributeValue);
domain2 = domain3;
hostOnly = false;
z = true;
} catch (IllegalArgumentException e4) {
z = true;
}
} else {
z = true;
if (StringsKt.equals(attributeName, "path", true)) {
path2 = attributeValue;
} else if (StringsKt.equals(attributeName, "secure", true)) {
secureOnly = true;
} else if (StringsKt.equals(attributeName, "httponly", true)) {
httpOnly = true;
}
}
}
pos2 = attributePairEnd + 1;
z2 = z;
pairEqualsSign2 = pairEqualsSign;
limit2 = limit;
}
if (deltaSeconds == Long.MIN_VALUE) {
expiresAt = Long.MIN_VALUE;
} else if (deltaSeconds == -1) {
expiresAt = expiresAt2;
} else {
if (deltaSeconds <= 9223372036854775L) {
deltaMilliseconds = 1000 * deltaSeconds;
} else {
deltaMilliseconds = LongCompanionObject.MAX_VALUE;
}
long expiresAt3 = currentTimeMillis + deltaMilliseconds;
expiresAt = (expiresAt3 < currentTimeMillis || expiresAt3 > DatesKt.MAX_DATE) ? 253402300799999L : expiresAt3;
}
String urlHost = url.host();
if (domain2 == null) {
domain2 = urlHost;
} else if (!domainMatch(urlHost, domain2)) {
return null;
}
if (urlHost.length() != domain2.length() && PublicSuffixDatabase.INSTANCE.get().getEffectiveTldPlusOne(domain2) == null) {
return null;
}
String str2 = "/";
if (path2 == null || !StringsKt.startsWith$default(path2, "/", false, 2, (Object) null)) {
String encodedPath2 = url.encodedPath();
int lastSlash = StringsKt.lastIndexOf$default((CharSequence) encodedPath2, '/', 0, false, 6, (Object) null);
if (lastSlash != 0) {
if (encodedPath2 == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
str2 = encodedPath2.substring(0, lastSlash);
Intrinsics.checkNotNullExpressionValue(str2, "(this as java.lang.Strin…ing(startIndex, endIndex)");
}
String path3 = str2;
encodedPath = path3;
} else {
encodedPath = path2;
}
return new Cookie(cookieName, cookieValue, expiresAt, domain2, encodedPath, secureOnly, httpOnly, persistent, hostOnly, null);
}
return null;
}
private final long parseExpires(String s, int pos, int limit) {
int pos2 = dateCharacterOffset(s, pos, limit, false);
int hour = -1;
int minute = -1;
int second = -1;
int dayOfMonth = -1;
int month = -1;
int year = -1;
Matcher matcher = Cookie.TIME_PATTERN.matcher(s);
while (pos2 < limit) {
int end = dateCharacterOffset(s, pos2 + 1, limit, true);
matcher.region(pos2, end);
if (hour == -1 && matcher.usePattern(Cookie.TIME_PATTERN).matches()) {
String group = matcher.group(1);
Intrinsics.checkNotNullExpressionValue(group, "matcher.group(1)");
hour = Integer.parseInt(group);
String group2 = matcher.group(2);
Intrinsics.checkNotNullExpressionValue(group2, "matcher.group(2)");
int minute2 = Integer.parseInt(group2);
String group3 = matcher.group(3);
Intrinsics.checkNotNullExpressionValue(group3, "matcher.group(3)");
second = Integer.parseInt(group3);
minute = minute2;
} else if (dayOfMonth == -1 && matcher.usePattern(Cookie.DAY_OF_MONTH_PATTERN).matches()) {
String group4 = matcher.group(1);
Intrinsics.checkNotNullExpressionValue(group4, "matcher.group(1)");
dayOfMonth = Integer.parseInt(group4);
} else if (month == -1 && matcher.usePattern(Cookie.MONTH_PATTERN).matches()) {
String group5 = matcher.group(1);
Intrinsics.checkNotNullExpressionValue(group5, "matcher.group(1)");
Locale locale = Locale.US;
Intrinsics.checkNotNullExpressionValue(locale, "Locale.US");
if (group5 != null) {
String monthString = group5.toLowerCase(locale);
Intrinsics.checkNotNullExpressionValue(monthString, "(this as java.lang.String).toLowerCase(locale)");
String pattern = Cookie.MONTH_PATTERN.pattern();
Intrinsics.checkNotNullExpressionValue(pattern, "MONTH_PATTERN.pattern()");
month = StringsKt.indexOf$default((CharSequence) pattern, monthString, 0, false, 6, (Object) null) / 4;
} else {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
} else if (year == -1 && matcher.usePattern(Cookie.YEAR_PATTERN).matches()) {
String group6 = matcher.group(1);
Intrinsics.checkNotNullExpressionValue(group6, "matcher.group(1)");
year = Integer.parseInt(group6);
}
pos2 = dateCharacterOffset(s, end + 1, limit, false);
}
if (70 <= year && 99 >= year) {
year += 1900;
}
if (year >= 0 && 69 >= year) {
year += 2000;
}
if (!(year >= 1601)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
if (!(month != -1)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
if (!(1 <= dayOfMonth && 31 >= dayOfMonth)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
if (!(hour >= 0 && 23 >= hour)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
if (!(minute >= 0 && 59 >= minute)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
if (!(second >= 0 && 59 >= second)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
GregorianCalendar $this$apply = new GregorianCalendar(Util.UTC);
$this$apply.setLenient(false);
$this$apply.set(1, year);
$this$apply.set(2, month - 1);
$this$apply.set(5, dayOfMonth);
$this$apply.set(11, hour);
$this$apply.set(12, minute);
$this$apply.set(13, second);
$this$apply.set(14, 0);
return $this$apply.getTimeInMillis();
}
private final int dateCharacterOffset(String input, int pos, int limit, boolean invert) {
for (int i = pos; i < limit; i++) {
int c = input.charAt(i);
boolean dateCharacter = (c < 32 && c != 9) || c >= 127 || (48 <= c && 57 >= c) || ((97 <= c && 122 >= c) || ((65 <= c && 90 >= c) || c == 58));
if (dateCharacter == (!invert)) {
return i;
}
}
return limit;
}
private final long parseMaxAge(String s) {
try {
long parsed = Long.parseLong(s);
if (parsed <= 0) {
return Long.MIN_VALUE;
}
return parsed;
} catch (NumberFormatException e) {
if (new Regex("-?\\d+").matches(s)) {
if (StringsKt.startsWith$default(s, "-", false, 2, (Object) null)) {
return Long.MIN_VALUE;
}
return LongCompanionObject.MAX_VALUE;
}
throw e;
}
}
private final String parseDomain(String s) {
if (!(!StringsKt.endsWith$default(s, ".", false, 2, (Object) null))) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
String canonicalHost = HostnamesKt.toCanonicalHost(StringsKt.removePrefix(s, (CharSequence) "."));
if (canonicalHost != null) {
return canonicalHost;
}
throw new IllegalArgumentException();
}
@JvmStatic
public final List<Cookie> parseAll(HttpUrl url, Headers headers) {
Intrinsics.checkNotNullParameter(url, "url");
Intrinsics.checkNotNullParameter(headers, "headers");
List cookieStrings = headers.values(HttpHeaders.SET_COOKIE);
List cookies = (List) null;
int size = cookieStrings.size();
for (int i = 0; i < size; i++) {
Cookie cookie = parse(url, cookieStrings.get(i));
if (cookie != null) {
if (cookies == null) {
List cookies2 = new ArrayList();
cookies = cookies2;
}
cookies.add(cookie);
}
}
if (cookies != null) {
List<Cookie> unmodifiableList = Collections.unmodifiableList(cookies);
Intrinsics.checkNotNullExpressionValue(unmodifiableList, "Collections.unmodifiableList(cookies)");
return unmodifiableList;
}
return CollectionsKt.emptyList();
}
}
}
@@ -0,0 +1,51 @@
package okhttp3;
import com.google.android.gms.common.internal.ImagesContract;
import java.util.List;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: CookieJar.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\bf\u0018\u0000 \n2\u00020\u0001:\u0001\nJ\u0016\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u00032\u0006\u0010\u0005\u001a\u00020\u0006H&J\u001e\u0010\u0007\u001a\u00020\b2\u0006\u0010\u0005\u001a\u00020\u00062\f\u0010\t\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003H&¨\u0006\u000b"}, m238d2 = {"Lokhttp3/CookieJar;", "", "loadForRequest", "", "Lokhttp3/Cookie;", ImagesContract.URL, "Lokhttp3/HttpUrl;", "saveFromResponse", "", "cookies", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public interface CookieJar {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
public static final CookieJar NO_COOKIES = new Companion.NoCookies();
List<Cookie> loadForRequest(HttpUrl url);
void saveFromResponse(HttpUrl url, List<Cookie> cookies);
/* compiled from: CookieJar.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001:\u0001\u0005B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0016\u0010\u0003\u001a\u00020\u00048\u0006X\u0087\u0004ø\u0001\u0000¢\u0006\u0002\n\u0000¨\u0006\u0001\u0082\u0002\u0007\n\u0005\b\u0091F0\u0001¨\u0006\u0006"}, m238d2 = {"Lokhttp3/CookieJar$Companion;", "", "()V", "NO_COOKIES", "Lokhttp3/CookieJar;", "NoCookies", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
static final /* synthetic */ Companion $$INSTANCE = null;
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
/* compiled from: CookieJar.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\b\u0002\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0016\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u00042\u0006\u0010\u0006\u001a\u00020\u0007H\u0016J\u001e\u0010\b\u001a\u00020\t2\u0006\u0010\u0006\u001a\u00020\u00072\f\u0010\n\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004H\u0016¨\u0006\u000b"}, m238d2 = {"Lokhttp3/CookieJar$Companion$NoCookies;", "Lokhttp3/CookieJar;", "()V", "loadForRequest", "", "Lokhttp3/Cookie;", ImagesContract.URL, "Lokhttp3/HttpUrl;", "saveFromResponse", "", "cookies", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private static final class NoCookies implements CookieJar {
@Override // okhttp3.CookieJar
public void saveFromResponse(HttpUrl url, List<Cookie> cookies) {
Intrinsics.checkNotNullParameter(url, "url");
Intrinsics.checkNotNullParameter(cookies, "cookies");
}
@Override // okhttp3.CookieJar
public List<Cookie> loadForRequest(HttpUrl url) {
Intrinsics.checkNotNullParameter(url, "url");
return CollectionsKt.emptyList();
}
}
}
}
@@ -0,0 +1,42 @@
package okhttp3;
import app.beetlebug.p001db.DatabaseHelper;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import kotlin.Metadata;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.Intrinsics;
import okio.ByteString;
/* compiled from: Credentials.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\"\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0006\u001a\u00020\u00042\b\b\u0002\u0010\u0007\u001a\u00020\bH\u0007¨\u0006\t"}, m238d2 = {"Lokhttp3/Credentials;", "", "()V", "basic", "", "username", DatabaseHelper.PASS, "charset", "Ljava/nio/charset/Charset;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Credentials {
public static final Credentials INSTANCE = new Credentials();
@JvmStatic
public static final String basic(String str, String str2) {
return basic$default(str, str2, null, 4, null);
}
private Credentials() {
}
public static /* synthetic */ String basic$default(String str, String str2, Charset ISO_8859_1, int i, Object obj) {
if ((i & 4) != 0) {
ISO_8859_1 = StandardCharsets.ISO_8859_1;
Intrinsics.checkNotNullExpressionValue(ISO_8859_1, "ISO_8859_1");
}
return basic(str, str2, ISO_8859_1);
}
@JvmStatic
public static final String basic(String username, String password, Charset charset) {
Intrinsics.checkNotNullParameter(username, "username");
Intrinsics.checkNotNullParameter(password, "password");
Intrinsics.checkNotNullParameter(charset, "charset");
String usernameAndPassword = username + ':' + password;
String encoded = ByteString.INSTANCE.encodeString(usernameAndPassword, charset).base64();
return "Basic " + encoded;
}
}
@@ -0,0 +1,263 @@
package okhttp3;
import androidx.core.app.NotificationCompat;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Deque;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.internal.Util;
import okhttp3.internal.connection.RealCall;
/* compiled from: Dispatcher.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\\\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\b\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\b\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u00002\u00020\u0001B\u000f\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004B\u0005¢\u0006\u0002\u0010\u0005J\u0006\u0010\u001e\u001a\u00020\u001fJ\u0019\u0010 \u001a\u00020\u001f2\n\u0010!\u001a\u00060\u001aR\u00020\u001bH\u0000¢\u0006\u0002\b\"J\u0015\u0010#\u001a\u00020\u001f2\u0006\u0010!\u001a\u00020\u001bH\u0000¢\u0006\u0002\b$J\r\u0010\u0002\u001a\u00020\u0003H\u0007¢\u0006\u0002\b%J\u0016\u0010&\u001a\b\u0018\u00010\u001aR\u00020\u001b2\u0006\u0010'\u001a\u00020(H\u0002J)\u0010)\u001a\u00020\u001f\"\u0004\b\u0000\u0010*2\f\u0010+\u001a\b\u0012\u0004\u0012\u0002H*0,2\u0006\u0010!\u001a\u0002H*H\u0002¢\u0006\u0002\u0010-J\u0015\u0010)\u001a\u00020\u001f2\u0006\u0010!\u001a\u00020\u001bH\u0000¢\u0006\u0002\b.J\u0019\u0010)\u001a\u00020\u001f2\n\u0010!\u001a\u00060\u001aR\u00020\u001bH\u0000¢\u0006\u0002\b.J\b\u0010/\u001a\u000200H\u0002J\f\u00101\u001a\b\u0012\u0004\u0012\u00020302J\u0006\u00104\u001a\u00020\u0010J\f\u00105\u001a\b\u0012\u0004\u0012\u00020302J\u0006\u00106\u001a\u00020\u0010R\u0011\u0010\u0002\u001a\u00020\u00038G¢\u0006\u0006\u001a\u0004\b\u0002\u0010\u0006R\u0010\u0010\u0007\u001a\u0004\u0018\u00010\u0003X\u0082\u000e¢\u0006\u0002\n\u0000R*\u0010\n\u001a\u0004\u0018\u00010\t2\b\u0010\b\u001a\u0004\u0018\u00010\t8F@FX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000b\u0010\f\"\u0004\b\r\u0010\u000eR&\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u000f\u001a\u00020\u00108F@FX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0011\u0010\u0012\"\u0004\b\u0013\u0010\u0014R&\u0010\u0015\u001a\u00020\u00102\u0006\u0010\u0015\u001a\u00020\u00108F@FX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0016\u0010\u0012\"\u0004\b\u0017\u0010\u0014R\u0018\u0010\u0018\u001a\f\u0012\b\u0012\u00060\u001aR\u00020\u001b0\u0019X\u0082\u0004¢\u0006\u0002\n\u0000R\u0018\u0010\u001c\u001a\f\u0012\b\u0012\u00060\u001aR\u00020\u001b0\u0019X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u001d\u001a\b\u0012\u0004\u0012\u00020\u001b0\u0019X\u0082\u0004¢\u0006\u0002\n\u0000¨\u00067"}, m238d2 = {"Lokhttp3/Dispatcher;", "", "executorService", "Ljava/util/concurrent/ExecutorService;", "(Ljava/util/concurrent/ExecutorService;)V", "()V", "()Ljava/util/concurrent/ExecutorService;", "executorServiceOrNull", "<set-?>", "Ljava/lang/Runnable;", "idleCallback", "getIdleCallback", "()Ljava/lang/Runnable;", "setIdleCallback", "(Ljava/lang/Runnable;)V", "maxRequests", "", "getMaxRequests", "()I", "setMaxRequests", "(I)V", "maxRequestsPerHost", "getMaxRequestsPerHost", "setMaxRequestsPerHost", "readyAsyncCalls", "Ljava/util/ArrayDeque;", "Lokhttp3/internal/connection/RealCall$AsyncCall;", "Lokhttp3/internal/connection/RealCall;", "runningAsyncCalls", "runningSyncCalls", "cancelAll", "", "enqueue", NotificationCompat.CATEGORY_CALL, "enqueue$okhttp", "executed", "executed$okhttp", "-deprecated_executorService", "findExistingCallWithHost", "host", "", "finished", "T", "calls", "Ljava/util/Deque;", "(Ljava/util/Deque;Ljava/lang/Object;)V", "finished$okhttp", "promoteAndExecute", "", "queuedCalls", "", "Lokhttp3/Call;", "queuedCallsCount", "runningCalls", "runningCallsCount", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Dispatcher {
private ExecutorService executorServiceOrNull;
private Runnable idleCallback;
private int maxRequests;
private int maxRequestsPerHost;
private final ArrayDeque<RealCall.AsyncCall> readyAsyncCalls;
private final ArrayDeque<RealCall.AsyncCall> runningAsyncCalls;
private final ArrayDeque<RealCall> runningSyncCalls;
public Dispatcher() {
this.maxRequests = 64;
this.maxRequestsPerHost = 5;
this.readyAsyncCalls = new ArrayDeque<>();
this.runningAsyncCalls = new ArrayDeque<>();
this.runningSyncCalls = new ArrayDeque<>();
}
public final synchronized int getMaxRequests() {
return this.maxRequests;
}
public final void setMaxRequests(int maxRequests) {
if (!(maxRequests >= 1)) {
throw new IllegalArgumentException(("max < 1: " + maxRequests).toString());
}
synchronized (this) {
this.maxRequests = maxRequests;
Unit unit = Unit.INSTANCE;
}
promoteAndExecute();
}
public final synchronized int getMaxRequestsPerHost() {
return this.maxRequestsPerHost;
}
public final void setMaxRequestsPerHost(int maxRequestsPerHost) {
if (!(maxRequestsPerHost >= 1)) {
throw new IllegalArgumentException(("max < 1: " + maxRequestsPerHost).toString());
}
synchronized (this) {
this.maxRequestsPerHost = maxRequestsPerHost;
Unit unit = Unit.INSTANCE;
}
promoteAndExecute();
}
public final synchronized Runnable getIdleCallback() {
return this.idleCallback;
}
public final synchronized void setIdleCallback(Runnable runnable) {
this.idleCallback = runnable;
}
public final synchronized ExecutorService executorService() {
ExecutorService executorService;
if (this.executorServiceOrNull == null) {
this.executorServiceOrNull = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue(), Util.threadFactory(Util.okHttpName + " Dispatcher", false));
}
executorService = this.executorServiceOrNull;
Intrinsics.checkNotNull(executorService);
return executorService;
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public Dispatcher(ExecutorService executorService) {
this();
Intrinsics.checkNotNullParameter(executorService, "executorService");
this.executorServiceOrNull = executorService;
}
public final void enqueue$okhttp(RealCall.AsyncCall call) {
RealCall.AsyncCall existingCall;
Intrinsics.checkNotNullParameter(call, "call");
synchronized (this) {
this.readyAsyncCalls.add(call);
if (!call.getThis$0().getForWebSocket() && (existingCall = findExistingCallWithHost(call.getHost())) != null) {
call.reuseCallsPerHostFrom(existingCall);
}
Unit unit = Unit.INSTANCE;
}
promoteAndExecute();
}
private final RealCall.AsyncCall findExistingCallWithHost(String host) {
Iterator<RealCall.AsyncCall> it = this.runningAsyncCalls.iterator();
while (it.hasNext()) {
RealCall.AsyncCall existingCall = it.next();
if (Intrinsics.areEqual(existingCall.getHost(), host)) {
return existingCall;
}
}
Iterator<RealCall.AsyncCall> it2 = this.readyAsyncCalls.iterator();
while (it2.hasNext()) {
RealCall.AsyncCall existingCall2 = it2.next();
if (Intrinsics.areEqual(existingCall2.getHost(), host)) {
return existingCall2;
}
}
return null;
}
public final synchronized void cancelAll() {
Iterator<RealCall.AsyncCall> it = this.readyAsyncCalls.iterator();
while (it.hasNext()) {
RealCall.AsyncCall call = it.next();
call.getThis$0().cancel();
}
Iterator<RealCall.AsyncCall> it2 = this.runningAsyncCalls.iterator();
while (it2.hasNext()) {
RealCall.AsyncCall call2 = it2.next();
call2.getThis$0().cancel();
}
Iterator<RealCall> it3 = this.runningSyncCalls.iterator();
while (it3.hasNext()) {
RealCall call3 = it3.next();
call3.cancel();
}
}
private final boolean promoteAndExecute() {
int i;
boolean isRunning;
if (Util.assertionsEnabled && Thread.holdsLock(this)) {
StringBuilder sb = new StringBuilder();
sb.append("Thread ");
Thread currentThread = Thread.currentThread();
Intrinsics.checkNotNullExpressionValue(currentThread, "Thread.currentThread()");
sb.append(currentThread.getName());
sb.append(" MUST NOT hold lock on ");
sb.append(this);
throw new AssertionError(sb.toString());
}
List executableCalls = new ArrayList();
synchronized (this) {
Iterator i2 = this.readyAsyncCalls.iterator();
Intrinsics.checkNotNullExpressionValue(i2, "readyAsyncCalls.iterator()");
while (i2.hasNext()) {
RealCall.AsyncCall asyncCall = i2.next();
if (this.runningAsyncCalls.size() >= this.maxRequests) {
break;
}
if (asyncCall.getCallsPerHost().get() < this.maxRequestsPerHost) {
i2.remove();
asyncCall.getCallsPerHost().incrementAndGet();
Intrinsics.checkNotNullExpressionValue(asyncCall, "asyncCall");
executableCalls.add(asyncCall);
this.runningAsyncCalls.add(asyncCall);
}
}
i = 0;
isRunning = runningCallsCount() > 0;
Unit unit = Unit.INSTANCE;
}
int size = executableCalls.size();
while (i < size) {
int i3 = i;
((RealCall.AsyncCall) executableCalls.get(i3)).executeOn(executorService());
i = i3 + 1;
}
return isRunning;
}
public final synchronized void executed$okhttp(RealCall call) {
Intrinsics.checkNotNullParameter(call, "call");
this.runningSyncCalls.add(call);
}
public final void finished$okhttp(RealCall.AsyncCall call) {
Intrinsics.checkNotNullParameter(call, "call");
call.getCallsPerHost().decrementAndGet();
finished(this.runningAsyncCalls, call);
}
public final void finished$okhttp(RealCall call) {
Intrinsics.checkNotNullParameter(call, "call");
finished(this.runningSyncCalls, call);
}
private final <T> void finished(Deque<T> calls, T call) {
Runnable idleCallback;
synchronized (this) {
if (!calls.remove(call)) {
throw new AssertionError("Call wasn't in-flight!");
}
idleCallback = this.idleCallback;
Unit unit = Unit.INSTANCE;
}
boolean isRunning = promoteAndExecute();
if (!isRunning && idleCallback != null) {
idleCallback.run();
}
}
public final synchronized List<Call> queuedCalls() {
List<Call> unmodifiableList;
Iterable $this$map$iv = this.readyAsyncCalls;
Collection destination$iv$iv = new ArrayList(CollectionsKt.collectionSizeOrDefault($this$map$iv, 10));
for (Object item$iv$iv : $this$map$iv) {
RealCall.AsyncCall it = (RealCall.AsyncCall) item$iv$iv;
destination$iv$iv.add(it.getThis$0());
}
unmodifiableList = Collections.unmodifiableList((List) destination$iv$iv);
Intrinsics.checkNotNullExpressionValue(unmodifiableList, "Collections.unmodifiable…yncCalls.map { it.call })");
return unmodifiableList;
}
public final synchronized List<Call> runningCalls() {
List<Call> unmodifiableList;
ArrayDeque<RealCall> arrayDeque = this.runningSyncCalls;
Iterable $this$map$iv = this.runningAsyncCalls;
Collection destination$iv$iv = new ArrayList(CollectionsKt.collectionSizeOrDefault($this$map$iv, 10));
for (Object item$iv$iv : $this$map$iv) {
RealCall.AsyncCall it = (RealCall.AsyncCall) item$iv$iv;
destination$iv$iv.add(it.getThis$0());
}
unmodifiableList = Collections.unmodifiableList(CollectionsKt.plus((Collection) arrayDeque, destination$iv$iv));
Intrinsics.checkNotNullExpressionValue(unmodifiableList, "Collections.unmodifiable…yncCalls.map { it.call })");
return unmodifiableList;
}
public final synchronized int queuedCallsCount() {
return this.readyAsyncCalls.size();
}
public final synchronized int runningCallsCount() {
return this.runningAsyncCalls.size() + this.runningSyncCalls.size();
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "executorService", imports = {}))
/* renamed from: -deprecated_executorService, reason: not valid java name */
public final ExecutorService m1647deprecated_executorService() {
return executorService();
}
}
@@ -0,0 +1,52 @@
package okhttp3;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;
import kotlin.Metadata;
import kotlin.collections.ArraysKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: Dns.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\bf\u0018\u0000 \u00072\u00020\u0001:\u0001\u0007J\u0016\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u00032\u0006\u0010\u0005\u001a\u00020\u0006H&¨\u0006\b"}, m238d2 = {"Lokhttp3/Dns;", "", "lookup", "", "Ljava/net/InetAddress;", "hostname", "", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public interface Dns {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
public static final Dns SYSTEM = new Companion.DnsSystem();
List<InetAddress> lookup(String hostname) throws UnknownHostException;
/* compiled from: Dns.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001:\u0001\u0005B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0016\u0010\u0003\u001a\u00020\u00048\u0006X\u0087\u0004ø\u0001\u0000¢\u0006\u0002\n\u0000¨\u0006\u0001\u0082\u0002\u0007\n\u0005\b\u0091F0\u0001¨\u0006\u0006"}, m238d2 = {"Lokhttp3/Dns$Companion;", "", "()V", "SYSTEM", "Lokhttp3/Dns;", "DnsSystem", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
static final /* synthetic */ Companion $$INSTANCE = null;
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
/* compiled from: Dns.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\b\u0002\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0016\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u00042\u0006\u0010\u0006\u001a\u00020\u0007H\u0016¨\u0006\b"}, m238d2 = {"Lokhttp3/Dns$Companion$DnsSystem;", "Lokhttp3/Dns;", "()V", "lookup", "", "Ljava/net/InetAddress;", "hostname", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private static final class DnsSystem implements Dns {
@Override // okhttp3.Dns
public List<InetAddress> lookup(String hostname) {
Intrinsics.checkNotNullParameter(hostname, "hostname");
try {
InetAddress[] allByName = InetAddress.getAllByName(hostname);
Intrinsics.checkNotNullExpressionValue(allByName, "InetAddress.getAllByName(hostname)");
return ArraysKt.toList(allByName);
} catch (NullPointerException e) {
UnknownHostException $this$apply = new UnknownHostException("Broken system behaviour for dns lookup of " + hostname);
$this$apply.initCause(e);
throw $this$apply;
}
}
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,160 @@
package okhttp3;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.HttpUrl;
import okhttp3.internal.Util;
import okio.Buffer;
import okio.BufferedSink;
/* compiled from: FormBody.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000@\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\u0018\u0000 \u001c2\u00020\u0001:\u0002\u001b\u001cB#\b\u0000\u0012\f\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003\u0012\f\u0010\u0005\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003¢\u0006\u0002\u0010\u0006J\b\u0010\n\u001a\u00020\u000bH\u0016J\b\u0010\f\u001a\u00020\rH\u0016J\u000e\u0010\u000e\u001a\u00020\u00042\u0006\u0010\u000f\u001a\u00020\bJ\u000e\u0010\u0010\u001a\u00020\u00042\u0006\u0010\u000f\u001a\u00020\bJ\u000e\u0010\u0011\u001a\u00020\u00042\u0006\u0010\u000f\u001a\u00020\bJ\r\u0010\u0007\u001a\u00020\bH\u0007¢\u0006\u0002\b\u0012J\u000e\u0010\u0013\u001a\u00020\u00042\u0006\u0010\u000f\u001a\u00020\bJ\u001a\u0010\u0014\u001a\u00020\u000b2\b\u0010\u0015\u001a\u0004\u0018\u00010\u00162\u0006\u0010\u0017\u001a\u00020\u0018H\u0002J\u0010\u0010\u0019\u001a\u00020\u001a2\u0006\u0010\u0015\u001a\u00020\u0016H\u0016R\u0014\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0005\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\u0007\u001a\u00020\b8G¢\u0006\u0006\u001a\u0004\b\u0007\u0010\\u0006\u001d"}, m238d2 = {"Lokhttp3/FormBody;", "Lokhttp3/RequestBody;", "encodedNames", "", "", "encodedValues", "(Ljava/util/List;Ljava/util/List;)V", "size", "", "()I", "contentLength", "", "contentType", "Lokhttp3/MediaType;", "encodedName", "index", "encodedValue", "name", "-deprecated_size", "value", "writeOrCountBytes", "sink", "Lokio/BufferedSink;", "countBytes", "", "writeTo", "", "Builder", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class FormBody extends RequestBody {
private final List<String> encodedNames;
private final List<String> encodedValues;
private static final MediaType CONTENT_TYPE = MediaType.INSTANCE.get("application/x-www-form-urlencoded");
public FormBody(List<String> encodedNames, List<String> encodedValues) {
Intrinsics.checkNotNullParameter(encodedNames, "encodedNames");
Intrinsics.checkNotNullParameter(encodedValues, "encodedValues");
this.encodedNames = Util.toImmutableList(encodedNames);
this.encodedValues = Util.toImmutableList(encodedValues);
}
public final int size() {
return this.encodedNames.size();
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "size", imports = {}))
/* renamed from: -deprecated_size, reason: not valid java name */
public final int m1648deprecated_size() {
return size();
}
public final String encodedName(int index) {
return this.encodedNames.get(index);
}
public final String name(int index) {
return HttpUrl.Companion.percentDecode$okhttp$default(HttpUrl.INSTANCE, encodedName(index), 0, 0, true, 3, null);
}
public final String encodedValue(int index) {
return this.encodedValues.get(index);
}
public final String value(int index) {
return HttpUrl.Companion.percentDecode$okhttp$default(HttpUrl.INSTANCE, encodedValue(index), 0, 0, true, 3, null);
}
@Override // okhttp3.RequestBody
/* renamed from: contentType */
public MediaType get$contentType() {
return CONTENT_TYPE;
}
@Override // okhttp3.RequestBody
public long contentLength() {
return writeOrCountBytes(null, true);
}
@Override // okhttp3.RequestBody
public void writeTo(BufferedSink sink) throws IOException {
Intrinsics.checkNotNullParameter(sink, "sink");
writeOrCountBytes(sink, false);
}
private final long writeOrCountBytes(BufferedSink sink, boolean countBytes) {
Buffer buffer;
if (countBytes) {
buffer = new Buffer();
} else {
Intrinsics.checkNotNull(sink);
buffer = sink.getBuffer();
}
int size = this.encodedNames.size();
for (int i = 0; i < size; i++) {
if (i > 0) {
buffer.writeByte(38);
}
buffer.writeUtf8(this.encodedNames.get(i));
buffer.writeByte(61);
buffer.writeUtf8(this.encodedValues.get(i));
}
if (!countBytes) {
return 0L;
}
long byteCount = buffer.size();
buffer.clear();
return byteCount;
}
/* compiled from: FormBody.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010!\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\u0013\b\u0007\u0012\n\b\u0002\u0010\u0002\u001a\u0004\u0018\u00010\u0003¢\u0006\u0002\u0010\u0004J\u0016\u0010\t\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00072\u0006\u0010\u000b\u001a\u00020\u0007J\u0016\u0010\f\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00072\u0006\u0010\u000b\u001a\u00020\u0007J\u0006\u0010\r\u001a\u00020\u000eR\u0010\u0010\u0002\u001a\u0004\u0018\u00010\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0005\u001a\b\u0012\u0004\u0012\u00020\u00070\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\b\u001a\b\u0012\u0004\u0012\u00020\u00070\u0006X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u000f"}, m238d2 = {"Lokhttp3/FormBody$Builder;", "", "charset", "Ljava/nio/charset/Charset;", "(Ljava/nio/charset/Charset;)V", "names", "", "", "values", "add", "name", "value", "addEncoded", "build", "Lokhttp3/FormBody;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Builder {
private final Charset charset;
private final List<String> names;
private final List<String> values;
/* JADX WARN: Multi-variable type inference failed */
public Builder() {
this(null, 1, 0 == true ? 1 : 0);
}
public Builder(Charset charset) {
this.charset = charset;
this.names = new ArrayList();
this.values = new ArrayList();
}
/* JADX WARN: Illegal instructions before constructor call */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public /* synthetic */ Builder(java.nio.charset.Charset r1, int r2, kotlin.jvm.internal.DefaultConstructorMarker r3) {
/*
r0 = this;
r2 = r2 & 1
if (r2 == 0) goto L8
r1 = 0
r2 = r1
java.nio.charset.Charset r2 = (java.nio.charset.Charset) r2
L8:
r0.<init>(r1)
return
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.FormBody.Builder.<init>(java.nio.charset.Charset, int, kotlin.jvm.internal.DefaultConstructorMarker):void");
}
public final Builder add(String name, String value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
Builder $this$apply = this;
$this$apply.names.add(HttpUrl.Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, name, 0, 0, HttpUrl.FORM_ENCODE_SET, false, false, true, false, $this$apply.charset, 91, null));
$this$apply.values.add(HttpUrl.Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, value, 0, 0, HttpUrl.FORM_ENCODE_SET, false, false, true, false, $this$apply.charset, 91, null));
return this;
}
public final Builder addEncoded(String name, String value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
Builder $this$apply = this;
$this$apply.names.add(HttpUrl.Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, name, 0, 0, HttpUrl.FORM_ENCODE_SET, true, false, true, false, $this$apply.charset, 83, null));
$this$apply.values.add(HttpUrl.Companion.canonicalize$okhttp$default(HttpUrl.INSTANCE, value, 0, 0, HttpUrl.FORM_ENCODE_SET, true, false, true, false, $this$apply.charset, 83, null));
return this;
}
public final FormBody build() {
return new FormBody(this.names, this.values);
}
}
}
@@ -0,0 +1,348 @@
package okhttp3;
import java.io.IOException;
import java.security.Principal;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSession;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.internal.Util;
/* compiled from: Handshake.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000H\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u000e\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\b\u0018\u0000 &2\u00020\u0001:\u0001&B9\b\u0000\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\f\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u0007\u0012\u0012\u0010\t\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\b0\u00070\\u0006\u0002\u0010\u000bJ\r\u0010\u0004\u001a\u00020\u0005H\u0007¢\u0006\u0002\b\u001aJ\u0013\u0010\u001b\u001a\u00020\u001c2\b\u0010\u001d\u001a\u0004\u0018\u00010\u0001H\u0096\u0002J\b\u0010\u001e\u001a\u00020\u001fH\u0016J\u0013\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u0007H\u0007¢\u0006\u0002\b J\u000f\u0010\u000e\u001a\u0004\u0018\u00010\u000fH\u0007¢\u0006\u0002\b!J\u0013\u0010\u0011\u001a\b\u0012\u0004\u0012\u00020\b0\u0007H\u0007¢\u0006\u0002\b\"J\u000f\u0010\u0014\u001a\u0004\u0018\u00010\u000fH\u0007¢\u0006\u0002\b#J\r\u0010\u0002\u001a\u00020\u0003H\u0007¢\u0006\u0002\b$J\b\u0010%\u001a\u00020\u0017H\u0016R\u0013\u0010\u0004\u001a\u00020\u00058\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0004\u0010\fR\u0019\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u00078\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\rR\u0013\u0010\u000e\u001a\u0004\u0018\u00010\u000f8G¢\u0006\u0006\u001a\u0004\b\u000e\u0010\u0010R!\u0010\u0011\u001a\b\u0012\u0004\u0012\u00020\b0\u00078GX\u0086\u0084\u0002¢\u0006\f\n\u0004\b\u0012\u0010\u0013\u001a\u0004\b\u0011\u0010\rR\u0013\u0010\u0014\u001a\u0004\u0018\u00010\u000f8G¢\u0006\u0006\u001a\u0004\b\u0014\u0010\u0010R\u0013\u0010\u0002\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\u0015R\u0018\u0010\u0016\u001a\u00020\u0017*\u00020\b8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0018\u0010\u0019¨\u0006'"}, m238d2 = {"Lokhttp3/Handshake;", "", "tlsVersion", "Lokhttp3/TlsVersion;", "cipherSuite", "Lokhttp3/CipherSuite;", "localCertificates", "", "Ljava/security/cert/Certificate;", "peerCertificatesFn", "Lkotlin/Function0;", "(Lokhttp3/TlsVersion;Lokhttp3/CipherSuite;Ljava/util/List;Lkotlin/jvm/functions/Function0;)V", "()Lokhttp3/CipherSuite;", "()Ljava/util/List;", "localPrincipal", "Ljava/security/Principal;", "()Ljava/security/Principal;", "peerCertificates", "peerCertificates$delegate", "Lkotlin/Lazy;", "peerPrincipal", "()Lokhttp3/TlsVersion;", "name", "", "getName", "(Ljava/security/cert/Certificate;)Ljava/lang/String;", "-deprecated_cipherSuite", "equals", "", "other", "hashCode", "", "-deprecated_localCertificates", "-deprecated_localPrincipal", "-deprecated_peerCertificates", "-deprecated_peerPrincipal", "-deprecated_tlsVersion", "toString", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Handshake {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private final CipherSuite cipherSuite;
private final List<Certificate> localCertificates;
/* renamed from: peerCertificates$delegate, reason: from kotlin metadata */
private final Lazy peerCertificates;
private final TlsVersion tlsVersion;
@JvmStatic
public static final Handshake get(SSLSession sSLSession) throws IOException {
return INSTANCE.get(sSLSession);
}
@JvmStatic
public static final Handshake get(TlsVersion tlsVersion, CipherSuite cipherSuite, List<? extends Certificate> list, List<? extends Certificate> list2) {
return INSTANCE.get(tlsVersion, cipherSuite, list, list2);
}
public final List<Certificate> peerCertificates() {
return (List) this.peerCertificates.getValue();
}
/* JADX WARN: Multi-variable type inference failed */
public Handshake(TlsVersion tlsVersion, CipherSuite cipherSuite, List<? extends Certificate> localCertificates, final Function0<? extends List<? extends Certificate>> peerCertificatesFn) {
Intrinsics.checkNotNullParameter(tlsVersion, "tlsVersion");
Intrinsics.checkNotNullParameter(cipherSuite, "cipherSuite");
Intrinsics.checkNotNullParameter(localCertificates, "localCertificates");
Intrinsics.checkNotNullParameter(peerCertificatesFn, "peerCertificatesFn");
this.tlsVersion = tlsVersion;
this.cipherSuite = cipherSuite;
this.localCertificates = localCertificates;
this.peerCertificates = LazyKt.lazy(new Function0<List<? extends Certificate>>() { // from class: okhttp3.Handshake$peerCertificates$2
{
super(0);
}
@Override // kotlin.jvm.functions.Function0
public final List<? extends Certificate> invoke() {
try {
return (List) Function0.this.invoke();
} catch (SSLPeerUnverifiedException e) {
return CollectionsKt.emptyList();
}
}
});
}
public final TlsVersion tlsVersion() {
return this.tlsVersion;
}
public final CipherSuite cipherSuite() {
return this.cipherSuite;
}
public final List<Certificate> localCertificates() {
return this.localCertificates;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "tlsVersion", imports = {}))
/* renamed from: -deprecated_tlsVersion, reason: not valid java name and from getter */
public final TlsVersion getTlsVersion() {
return this.tlsVersion;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "cipherSuite", imports = {}))
/* renamed from: -deprecated_cipherSuite, reason: not valid java name and from getter */
public final CipherSuite getCipherSuite() {
return this.cipherSuite;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "peerCertificates", imports = {}))
/* renamed from: -deprecated_peerCertificates, reason: not valid java name */
public final List<Certificate> m1652deprecated_peerCertificates() {
return peerCertificates();
}
public final Principal peerPrincipal() {
Object firstOrNull = CollectionsKt.firstOrNull((List<? extends Object>) peerCertificates());
if (!(firstOrNull instanceof X509Certificate)) {
firstOrNull = null;
}
X509Certificate x509Certificate = (X509Certificate) firstOrNull;
return x509Certificate != null ? x509Certificate.getSubjectX500Principal() : null;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "peerPrincipal", imports = {}))
/* renamed from: -deprecated_peerPrincipal, reason: not valid java name */
public final Principal m1653deprecated_peerPrincipal() {
return peerPrincipal();
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "localCertificates", imports = {}))
/* renamed from: -deprecated_localCertificates, reason: not valid java name */
public final List<Certificate> m1650deprecated_localCertificates() {
return this.localCertificates;
}
public final Principal localPrincipal() {
Object firstOrNull = CollectionsKt.firstOrNull((List<? extends Object>) this.localCertificates);
if (!(firstOrNull instanceof X509Certificate)) {
firstOrNull = null;
}
X509Certificate x509Certificate = (X509Certificate) firstOrNull;
return x509Certificate != null ? x509Certificate.getSubjectX500Principal() : null;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "localPrincipal", imports = {}))
/* renamed from: -deprecated_localPrincipal, reason: not valid java name */
public final Principal m1651deprecated_localPrincipal() {
return localPrincipal();
}
public boolean equals(Object other) {
return (other instanceof Handshake) && ((Handshake) other).tlsVersion == this.tlsVersion && Intrinsics.areEqual(((Handshake) other).cipherSuite, this.cipherSuite) && Intrinsics.areEqual(((Handshake) other).peerCertificates(), peerCertificates()) && Intrinsics.areEqual(((Handshake) other).localCertificates, this.localCertificates);
}
public int hashCode() {
int result = (17 * 31) + this.tlsVersion.hashCode();
return (((((result * 31) + this.cipherSuite.hashCode()) * 31) + peerCertificates().hashCode()) * 31) + this.localCertificates.hashCode();
}
public String toString() {
Iterable $this$map$iv = peerCertificates();
Collection destination$iv$iv = new ArrayList(CollectionsKt.collectionSizeOrDefault($this$map$iv, 10));
for (Object item$iv$iv : $this$map$iv) {
Certificate it = (Certificate) item$iv$iv;
destination$iv$iv.add(getName(it));
}
String peerCertificatesString = ((List) destination$iv$iv).toString();
StringBuilder sb = new StringBuilder();
sb.append("Handshake{");
sb.append("tlsVersion=");
sb.append(this.tlsVersion);
sb.append(' ');
sb.append("cipherSuite=");
sb.append(this.cipherSuite);
sb.append(' ');
sb.append("peerCertificates=");
sb.append(peerCertificatesString);
sb.append(' ');
sb.append("localCertificates=");
Iterable $this$map$iv2 = this.localCertificates;
Collection destination$iv$iv2 = new ArrayList(CollectionsKt.collectionSizeOrDefault($this$map$iv2, 10));
for (Object item$iv$iv2 : $this$map$iv2) {
Certificate it2 = (Certificate) item$iv$iv2;
destination$iv$iv2.add(getName(it2));
}
sb.append((List) destination$iv$iv2);
sb.append('}');
return sb.toString();
}
private final String getName(Certificate $this$name) {
if ($this$name instanceof X509Certificate) {
return ((X509Certificate) $this$name).getSubjectDN().toString();
}
String type = $this$name.getType();
Intrinsics.checkNotNullExpressionValue(type, "type");
return type;
}
/* compiled from: Handshake.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000:\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0011\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0015\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0007¢\u0006\u0002\b\u0007J4\u0010\u0003\u001a\u00020\u00042\u0006\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000b2\f\u0010\f\u001a\b\u0012\u0004\u0012\u00020\u000e0\r2\f\u0010\u000f\u001a\b\u0012\u0004\u0012\u00020\u000e0\rH\u0007J\u0011\u0010\u0010\u001a\u00020\u0004*\u00020\u0006H\u0007¢\u0006\u0002\b\u0003J!\u0010\u0011\u001a\b\u0012\u0004\u0012\u00020\u000e0\r*\f\u0012\u0006\b\u0001\u0012\u00020\u000e\u0018\u00010\u0012H\u0002¢\u0006\u0002\u0010\u0013¨\u0006\u0014"}, m238d2 = {"Lokhttp3/Handshake$Companion;", "", "()V", "get", "Lokhttp3/Handshake;", "sslSession", "Ljavax/net/ssl/SSLSession;", "-deprecated_get", "tlsVersion", "Lokhttp3/TlsVersion;", "cipherSuite", "Lokhttp3/CipherSuite;", "peerCertificates", "", "Ljava/security/cert/Certificate;", "localCertificates", "handshake", "toImmutableList", "", "([Ljava/security/cert/Certificate;)Ljava/util/List;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
/* JADX WARN: Code restructure failed: missing block: B:11:0x0022, code lost:
if (r0.equals("TLS_NULL_WITH_NULL_NULL") == false) goto L15;
*/
/* JADX WARN: Code restructure failed: missing block: B:6:0x0019, code lost:
if (r0.equals("SSL_NULL_WITH_NULL_NULL") == false) goto L15;
*/
/* JADX WARN: Code restructure failed: missing block: B:8:0x003d, code lost:
throw new java.io.IOException("cipherSuite == " + r0);
*/
@kotlin.jvm.JvmStatic
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final okhttp3.Handshake get(javax.net.ssl.SSLSession r9) throws java.io.IOException {
/*
r8 = this;
java.lang.String r0 = "$this$handshake"
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r9, r0)
java.lang.String r0 = r9.getCipherSuite()
if (r0 == 0) goto L9f
int r1 = r0.hashCode()
switch(r1) {
case 1019404634: goto L1c;
case 1208658923: goto L13;
default: goto L12;
}
L12:
goto L3e
L13:
java.lang.String r1 = "SSL_NULL_WITH_NULL_NULL"
boolean r1 = r0.equals(r1)
if (r1 != 0) goto L25
goto L24
L1c:
java.lang.String r1 = "TLS_NULL_WITH_NULL_NULL"
boolean r1 = r0.equals(r1)
if (r1 != 0) goto L25
L24:
goto L3e
L25:
java.io.IOException r1 = new java.io.IOException
java.lang.StringBuilder r2 = new java.lang.StringBuilder
r2.<init>()
java.lang.String r3 = "cipherSuite == "
r2.append(r3)
r2.append(r0)
java.lang.String r2 = r2.toString()
r1.<init>(r2)
java.lang.Throwable r1 = (java.lang.Throwable) r1
throw r1
L3e:
okhttp3.CipherSuite$Companion r1 = okhttp3.CipherSuite.INSTANCE
okhttp3.CipherSuite r1 = r1.forJavaName(r0)
java.lang.String r2 = r9.getProtocol()
if (r2 == 0) goto L8f
java.lang.String r3 = "NONE"
boolean r3 = kotlin.jvm.internal.Intrinsics.areEqual(r3, r2)
if (r3 != 0) goto L85
okhttp3.TlsVersion$Companion r3 = okhttp3.TlsVersion.INSTANCE
okhttp3.TlsVersion r3 = r3.forJavaName(r2)
r4 = r8
okhttp3.Handshake$Companion r4 = (okhttp3.Handshake.Companion) r4 // Catch: javax.net.ssl.SSLPeerUnverifiedException -> L66
java.security.cert.Certificate[] r5 = r9.getPeerCertificates() // Catch: javax.net.ssl.SSLPeerUnverifiedException -> L66
java.util.List r4 = r4.toImmutableList(r5) // Catch: javax.net.ssl.SSLPeerUnverifiedException -> L66
goto L6c
L66:
r4 = move-exception
java.util.List r5 = kotlin.collections.CollectionsKt.emptyList()
r4 = r5
L6c:
okhttp3.Handshake r5 = new okhttp3.Handshake
r6 = r8
okhttp3.Handshake$Companion r6 = (okhttp3.Handshake.Companion) r6
java.security.cert.Certificate[] r7 = r9.getLocalCertificates()
java.util.List r6 = r6.toImmutableList(r7)
okhttp3.Handshake$Companion$handshake$1 r7 = new okhttp3.Handshake$Companion$handshake$1
r7.<init>()
kotlin.jvm.functions.Function0 r7 = (kotlin.jvm.functions.Function0) r7
r5.<init>(r3, r1, r6, r7)
return r5
L85:
java.io.IOException r3 = new java.io.IOException
java.lang.String r4 = "tlsVersion == NONE"
r3.<init>(r4)
java.lang.Throwable r3 = (java.lang.Throwable) r3
throw r3
L8f:
r2 = 0
java.lang.IllegalStateException r2 = new java.lang.IllegalStateException
java.lang.String r3 = "tlsVersion == null"
java.lang.String r3 = r3.toString()
r2.<init>(r3)
java.lang.Throwable r2 = (java.lang.Throwable) r2
throw r2
L9f:
r0 = 0
java.lang.IllegalStateException r0 = new java.lang.IllegalStateException
java.lang.String r1 = "cipherSuite == null"
java.lang.String r1 = r1.toString()
r0.<init>(r1)
java.lang.Throwable r0 = (java.lang.Throwable) r0
throw r0
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.Handshake.Companion.get(javax.net.ssl.SSLSession):okhttp3.Handshake");
}
private final List<Certificate> toImmutableList(Certificate[] $this$toImmutableList) {
if ($this$toImmutableList != null) {
return Util.immutableListOf((Certificate[]) Arrays.copyOf($this$toImmutableList, $this$toImmutableList.length));
}
return CollectionsKt.emptyList();
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to extension function", replaceWith = @ReplaceWith(expression = "sslSession.handshake()", imports = {}))
/* renamed from: -deprecated_get, reason: not valid java name */
public final Handshake m1655deprecated_get(SSLSession sslSession) throws IOException {
Intrinsics.checkNotNullParameter(sslSession, "sslSession");
return get(sslSession);
}
@JvmStatic
public final Handshake get(TlsVersion tlsVersion, CipherSuite cipherSuite, List<? extends Certificate> peerCertificates, List<? extends Certificate> localCertificates) {
Intrinsics.checkNotNullParameter(tlsVersion, "tlsVersion");
Intrinsics.checkNotNullParameter(cipherSuite, "cipherSuite");
Intrinsics.checkNotNullParameter(peerCertificates, "peerCertificates");
Intrinsics.checkNotNullParameter(localCertificates, "localCertificates");
final List peerCertificatesCopy = Util.toImmutableList(peerCertificates);
return new Handshake(tlsVersion, cipherSuite, Util.toImmutableList(localCertificates), new Function0<List<? extends Certificate>>() { // from class: okhttp3.Handshake$Companion$get$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
@Override // kotlin.jvm.functions.Function0
public final List<? extends Certificate> invoke() {
return peerCertificatesCopy;
}
});
}
}
}
@@ -0,0 +1,527 @@
package okhttp3;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.ReplaceWith;
import kotlin.TuplesKt;
import kotlin.collections.ArraysKt;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.ArrayIteratorKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.jvm.internal.markers.KMappedMarker;
import kotlin.ranges.IntProgression;
import kotlin.ranges.RangesKt;
import kotlin.text.StringsKt;
import okhttp3.internal.Util;
import okhttp3.internal.http.DatesKt;
/* compiled from: Headers.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000f\n\u0002\u0018\u0002\n\u0002\u0010\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0011\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010(\n\u0002\b\u0002\n\u0002\u0010\"\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010$\n\u0002\u0010 \n\u0002\b\u0006\u0018\u0000 '2\u0014\u0012\u0010\u0012\u000e\u0012\u0004\u0012\u00020\u0003\u0012\u0004\u0012\u00020\u00030\u00020\u0001:\u0002&'B\u0015\b\u0002\u0012\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00030\u0005¢\u0006\u0002\u0010\u0006J\u0006\u0010\u000b\u001a\u00020\fJ\u0013\u0010\r\u001a\u00020\u000e2\b\u0010\u000f\u001a\u0004\u0018\u00010\u0010H\u0096\u0002J\u0013\u0010\u0011\u001a\u0004\u0018\u00010\u00032\u0006\u0010\u0012\u001a\u00020\u0003H\u0086\u0002J\u0010\u0010\u0013\u001a\u0004\u0018\u00010\u00142\u0006\u0010\u0012\u001a\u00020\u0003J\u0012\u0010\u0015\u001a\u0004\u0018\u00010\u00162\u0006\u0010\u0012\u001a\u00020\u0003H\u0007J\b\u0010\u0017\u001a\u00020\tH\u0016J\u001b\u0010\u0018\u001a\u0014\u0012\u0010\u0012\u000e\u0012\u0004\u0012\u00020\u0003\u0012\u0004\u0012\u00020\u00030\u00020\u0019H\u0096\u0002J\u000e\u0010\u0012\u001a\u00020\u00032\u0006\u0010\u001a\u001a\u00020\tJ\f\u0010\u001b\u001a\b\u0012\u0004\u0012\u00020\u00030\u001cJ\u0006\u0010\u001d\u001a\u00020\u001eJ\r\u0010\b\u001a\u00020\tH\u0007¢\u0006\u0002\b\u001fJ\u0018\u0010 \u001a\u0014\u0012\u0004\u0012\u00020\u0003\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00030\"0!J\b\u0010#\u001a\u00020\u0003H\u0016J\u000e\u0010$\u001a\u00020\u00032\u0006\u0010\u001a\u001a\u00020\tJ\u0014\u0010%\u001a\b\u0012\u0004\u0012\u00020\u00030\"2\u0006\u0010\u0012\u001a\u00020\u0003R\u0016\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00030\u0005X\u0082\u0004¢\u0006\u0004\n\u0002\u0010\u0007R\u0011\u0010\b\u001a\u00020\t8G¢\u0006\u0006\u001a\u0004\b\b\u0010\\u0006("}, m238d2 = {"Lokhttp3/Headers;", "", "Lkotlin/Pair;", "", "namesAndValues", "", "([Ljava/lang/String;)V", "[Ljava/lang/String;", "size", "", "()I", "byteCount", "", "equals", "", "other", "", "get", "name", "getDate", "Ljava/util/Date;", "getInstant", "Ljava/time/Instant;", "hashCode", "iterator", "", "index", "names", "", "newBuilder", "Lokhttp3/Headers$Builder;", "-deprecated_size", "toMultimap", "", "", "toString", "value", "values", "Builder", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Headers implements Iterable<Pair<? extends String, ? extends String>>, KMappedMarker {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private final String[] namesAndValues;
@JvmStatic
/* renamed from: of */
public static final Headers m260of(Map<String, String> map) {
return INSTANCE.m262of(map);
}
@JvmStatic
/* renamed from: of */
public static final Headers m261of(String... strArr) {
return INSTANCE.m263of(strArr);
}
private Headers(String[] namesAndValues) {
this.namesAndValues = namesAndValues;
}
public /* synthetic */ Headers(String[] namesAndValues, DefaultConstructorMarker $constructor_marker) {
this(namesAndValues);
}
public final String get(String name) {
Intrinsics.checkNotNullParameter(name, "name");
return INSTANCE.get(this.namesAndValues, name);
}
public final Date getDate(String name) {
Intrinsics.checkNotNullParameter(name, "name");
String str = get(name);
if (str != null) {
return DatesKt.toHttpDateOrNull(str);
}
return null;
}
public final Instant getInstant(String name) {
Intrinsics.checkNotNullParameter(name, "name");
Date value = getDate(name);
if (value != null) {
return value.toInstant();
}
return null;
}
public final int size() {
return this.namesAndValues.length / 2;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "size", imports = {}))
/* renamed from: -deprecated_size, reason: not valid java name */
public final int m1656deprecated_size() {
return size();
}
public final String name(int index) {
return this.namesAndValues[index * 2];
}
public final String value(int index) {
return this.namesAndValues[(index * 2) + 1];
}
public final Set<String> names() {
TreeSet result = new TreeSet(StringsKt.getCASE_INSENSITIVE_ORDER(StringCompanionObject.INSTANCE));
int size = size();
for (int i = 0; i < size; i++) {
result.add(name(i));
}
Set<String> unmodifiableSet = Collections.unmodifiableSet(result);
Intrinsics.checkNotNullExpressionValue(unmodifiableSet, "Collections.unmodifiableSet(result)");
return unmodifiableSet;
}
public final List<String> values(String name) {
Intrinsics.checkNotNullParameter(name, "name");
List result = (List) null;
int size = size();
for (int i = 0; i < size; i++) {
if (StringsKt.equals(name, name(i), true)) {
if (result == null) {
List result2 = new ArrayList(2);
result = result2;
}
result.add(value(i));
}
}
if (result != null) {
List<String> unmodifiableList = Collections.unmodifiableList(result);
Intrinsics.checkNotNullExpressionValue(unmodifiableList, "Collections.unmodifiableList(result)");
return unmodifiableList;
}
return CollectionsKt.emptyList();
}
public final long byteCount() {
String[] strArr = this.namesAndValues;
long result = strArr.length * 2;
for (int i = 0; i < strArr.length; i++) {
result += this.namesAndValues[i].length();
}
return result;
}
@Override // java.lang.Iterable
public Iterator<Pair<? extends String, ? extends String>> iterator() {
int size = size();
Pair[] pairArr = new Pair[size];
for (int i = 0; i < size; i++) {
int it = i;
pairArr[i] = TuplesKt.m245to(name(it), value(it));
}
return ArrayIteratorKt.iterator(pairArr);
}
public final Builder newBuilder() {
Builder result = new Builder();
CollectionsKt.addAll(result.getNamesAndValues$okhttp(), this.namesAndValues);
return result;
}
public boolean equals(Object other) {
return (other instanceof Headers) && Arrays.equals(this.namesAndValues, ((Headers) other).namesAndValues);
}
public int hashCode() {
return Arrays.hashCode(this.namesAndValues);
}
public String toString() {
StringBuilder $this$buildString = new StringBuilder();
int size = size();
for (int i = 0; i < size; i++) {
String name = name(i);
String value = value(i);
$this$buildString.append(name);
$this$buildString.append(": ");
$this$buildString.append(Util.isSensitiveHeader(name) ? "██" : value);
$this$buildString.append("\n");
}
String sb = $this$buildString.toString();
Intrinsics.checkNotNullExpressionValue(sb, "StringBuilder().apply(builderAction).toString()");
return sb;
}
public final Map<String, List<String>> toMultimap() {
TreeMap result = new TreeMap(StringsKt.getCASE_INSENSITIVE_ORDER(StringCompanionObject.INSTANCE));
int size = size();
for (int i = 0; i < size; i++) {
String name = name(i);
Locale locale = Locale.US;
Intrinsics.checkNotNullExpressionValue(locale, "Locale.US");
if (name == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
String name2 = name.toLowerCase(locale);
Intrinsics.checkNotNullExpressionValue(name2, "(this as java.lang.String).toLowerCase(locale)");
List values = (List) result.get(name2);
if (values == null) {
values = new ArrayList(2);
result.put(name2, values);
}
values.add(value(i));
}
return result;
}
/* compiled from: Headers.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010!\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u000e\u0010\b\u001a\u00020\u00002\u0006\u0010\t\u001a\u00020\u0005J\u0018\u0010\b\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\fH\u0007J\u0016\u0010\b\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\rJ\u0016\u0010\b\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\u0005J\u000e\u0010\u000e\u001a\u00020\u00002\u0006\u0010\u000f\u001a\u00020\u0010J\u0015\u0010\u0011\u001a\u00020\u00002\u0006\u0010\t\u001a\u00020\u0005H\u0000¢\u0006\u0002\b\u0012J\u001d\u0010\u0011\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\u0005H\u0000¢\u0006\u0002\b\u0012J\u0016\u0010\u0013\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\u0005J\u0006\u0010\u0014\u001a\u00020\u0010J\u0013\u0010\u0015\u001a\u0004\u0018\u00010\u00052\u0006\u0010\n\u001a\u00020\u0005H\u0086\u0002J\u000e\u0010\u0016\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u0005J\u0019\u0010\u0017\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\fH\u0087\u0002J\u0019\u0010\u0017\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\rH\u0086\u0002J\u0019\u0010\u0017\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u00052\u0006\u0010\u000b\u001a\u00020\u0005H\u0086\u0002R\u001a\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007¨\u0006\u0018"}, m238d2 = {"Lokhttp3/Headers$Builder;", "", "()V", "namesAndValues", "", "", "getNamesAndValues$okhttp", "()Ljava/util/List;", "add", "line", "name", "value", "Ljava/time/Instant;", "Ljava/util/Date;", "addAll", "headers", "Lokhttp3/Headers;", "addLenient", "addLenient$okhttp", "addUnsafeNonAscii", "build", "get", "removeAll", "set", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Builder {
private final List<String> namesAndValues = new ArrayList(20);
public final List<String> getNamesAndValues$okhttp() {
return this.namesAndValues;
}
public final Builder addLenient$okhttp(String line) {
Intrinsics.checkNotNullParameter(line, "line");
Builder $this$apply = this;
int index = StringsKt.indexOf$default((CharSequence) line, ':', 1, false, 4, (Object) null);
if (index != -1) {
String substring = line.substring(0, index);
Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
String substring2 = line.substring(index + 1);
Intrinsics.checkNotNullExpressionValue(substring2, "(this as java.lang.String).substring(startIndex)");
$this$apply.addLenient$okhttp(substring, substring2);
} else if (line.charAt(0) == ':') {
String substring3 = line.substring(1);
Intrinsics.checkNotNullExpressionValue(substring3, "(this as java.lang.String).substring(startIndex)");
$this$apply.addLenient$okhttp("", substring3);
} else {
$this$apply.addLenient$okhttp("", line);
}
return this;
}
public final Builder add(String line) {
Intrinsics.checkNotNullParameter(line, "line");
Builder $this$apply = this;
int index = StringsKt.indexOf$default((CharSequence) line, ':', 0, false, 6, (Object) null);
if (!(index != -1)) {
throw new IllegalArgumentException(("Unexpected header: " + line).toString());
}
String substring = line.substring(0, index);
Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
if (substring != null) {
String obj = StringsKt.trim((CharSequence) substring).toString();
String substring2 = line.substring(index + 1);
Intrinsics.checkNotNullExpressionValue(substring2, "(this as java.lang.String).substring(startIndex)");
$this$apply.add(obj, substring2);
return this;
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.CharSequence");
}
public final Builder add(String name, String value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
Builder $this$apply = this;
Headers.INSTANCE.checkName(name);
Headers.INSTANCE.checkValue(value, name);
$this$apply.addLenient$okhttp(name, value);
return this;
}
public final Builder addUnsafeNonAscii(String name, String value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
Builder $this$apply = this;
Headers.INSTANCE.checkName(name);
$this$apply.addLenient$okhttp(name, value);
return this;
}
public final Builder addAll(Headers headers) {
Intrinsics.checkNotNullParameter(headers, "headers");
Builder $this$apply = this;
int size = headers.size();
for (int i = 0; i < size; i++) {
$this$apply.addLenient$okhttp(headers.name(i), headers.value(i));
}
return this;
}
public final Builder add(String name, Date value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
Builder $this$apply = this;
$this$apply.add(name, DatesKt.toHttpDateString(value));
return this;
}
public final Builder add(String name, Instant value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
Builder $this$apply = this;
$this$apply.add(name, new Date(value.toEpochMilli()));
return this;
}
public final Builder set(String name, Date value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
Builder $this$apply = this;
$this$apply.set(name, DatesKt.toHttpDateString(value));
return this;
}
public final Builder set(String name, Instant value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
Builder $this$apply = this;
return $this$apply.set(name, new Date(value.toEpochMilli()));
}
public final Builder addLenient$okhttp(String name, String value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
Builder $this$apply = this;
$this$apply.namesAndValues.add(name);
$this$apply.namesAndValues.add(StringsKt.trim((CharSequence) value).toString());
return this;
}
public final Builder removeAll(String name) {
Intrinsics.checkNotNullParameter(name, "name");
Builder $this$apply = this;
int i = 0;
while (i < $this$apply.namesAndValues.size()) {
if (StringsKt.equals(name, $this$apply.namesAndValues.get(i), true)) {
$this$apply.namesAndValues.remove(i);
$this$apply.namesAndValues.remove(i);
i -= 2;
}
i += 2;
}
return this;
}
public final Builder set(String name, String value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
Builder $this$apply = this;
Headers.INSTANCE.checkName(name);
Headers.INSTANCE.checkValue(value, name);
$this$apply.removeAll(name);
$this$apply.addLenient$okhttp(name, value);
return this;
}
public final String get(String name) {
Intrinsics.checkNotNullParameter(name, "name");
IntProgression step = RangesKt.step(RangesKt.downTo(this.namesAndValues.size() - 2, 0), 2);
int i = step.getFirst();
int last = step.getLast();
int step2 = step.getStep();
if (step2 >= 0) {
if (i > last) {
return null;
}
} else if (i < last) {
return null;
}
while (!StringsKt.equals(name, this.namesAndValues.get(i), true)) {
if (i == last) {
return null;
}
i += step2;
}
return this.namesAndValues.get(i + 1);
}
public final Headers build() {
Collection $this$toTypedArray$iv = this.namesAndValues;
Object[] array = $this$toTypedArray$iv.toArray(new String[0]);
if (array != null) {
return new Headers((String[]) array, null);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
}
}
/* compiled from: Headers.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0004\n\u0002\u0010\u0011\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010$\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0002J\u0018\u0010\u0007\u001a\u00020\u00042\u0006\u0010\b\u001a\u00020\u00062\u0006\u0010\u0005\u001a\u00020\u0006H\u0002J%\u0010\t\u001a\u0004\u0018\u00010\u00062\f\u0010\n\u001a\b\u0012\u0004\u0012\u00020\u00060\u000b2\u0006\u0010\u0005\u001a\u00020\u0006H\u0002¢\u0006\u0002\u0010\fJ#\u0010\r\u001a\u00020\u000e2\u0012\u0010\n\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00060\u000b\"\u00020\u0006H\u0007¢\u0006\u0004\b\u000f\u0010\u0010J#\u0010\u000f\u001a\u00020\u000e2\u0012\u0010\n\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00060\u000b\"\u00020\u0006H\u0007¢\u0006\u0004\b\u0011\u0010\u0010J!\u0010\u000f\u001a\u00020\u000e2\u0012\u0010\u0012\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u00060\u0013H\u0007¢\u0006\u0002\b\u0011J\u001d\u0010\u0014\u001a\u00020\u000e*\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u00060\u0013H\u0007¢\u0006\u0002\b\u000f¨\u0006\u0015"}, m238d2 = {"Lokhttp3/Headers$Companion;", "", "()V", "checkName", "", "name", "", "checkValue", "value", "get", "namesAndValues", "", "([Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;", "headersOf", "Lokhttp3/Headers;", "of", "([Ljava/lang/String;)Lokhttp3/Headers;", "-deprecated_of", "headers", "", "toHeaders", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
/* JADX INFO: Access modifiers changed from: private */
public final String get(String[] namesAndValues, String name) {
IntProgression step = RangesKt.step(RangesKt.downTo(namesAndValues.length - 2, 0), 2);
int i = step.getFirst();
int last = step.getLast();
int step2 = step.getStep();
if (step2 >= 0) {
if (i > last) {
return null;
}
} else if (i < last) {
return null;
}
while (!StringsKt.equals(name, namesAndValues[i], true)) {
if (i == last) {
return null;
}
i += step2;
}
return namesAndValues[i + 1];
}
@JvmStatic
/* renamed from: of */
public final Headers m263of(String... namesAndValues) {
Intrinsics.checkNotNullParameter(namesAndValues, "namesAndValues");
if (!(namesAndValues.length % 2 == 0)) {
throw new IllegalArgumentException("Expected alternating header names and values".toString());
}
Object clone = namesAndValues.clone();
if (clone == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<kotlin.String>");
}
String[] namesAndValues2 = (String[]) clone;
int length = namesAndValues2.length;
for (int i = 0; i < length; i++) {
if (!(namesAndValues2[i] != null)) {
throw new IllegalArgumentException("Headers cannot be null".toString());
}
String str = namesAndValues2[i];
if (str == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.CharSequence");
}
namesAndValues2[i] = StringsKt.trim((CharSequence) str).toString();
}
IntProgression step = RangesKt.step(ArraysKt.getIndices(namesAndValues2), 2);
int i2 = step.getFirst();
int last = step.getLast();
int step2 = step.getStep();
if (step2 < 0 ? i2 >= last : i2 <= last) {
while (true) {
String name = namesAndValues2[i2];
String value = namesAndValues2[i2 + 1];
checkName(name);
checkValue(value, name);
if (i2 == last) {
break;
}
i2 += step2;
}
}
return new Headers(namesAndValues2, null);
}
@Deprecated(level = DeprecationLevel.ERROR, message = "function name changed", replaceWith = @ReplaceWith(expression = "headersOf(*namesAndValues)", imports = {}))
/* renamed from: -deprecated_of, reason: not valid java name */
public final Headers m1658deprecated_of(String... namesAndValues) {
Intrinsics.checkNotNullParameter(namesAndValues, "namesAndValues");
return m263of((String[]) Arrays.copyOf(namesAndValues, namesAndValues.length));
}
@JvmStatic
/* renamed from: of */
public final Headers m262of(Map<String, String> toHeaders) {
Intrinsics.checkNotNullParameter(toHeaders, "$this$toHeaders");
String[] namesAndValues = new String[toHeaders.size() * 2];
int i = 0;
for (Map.Entry<String, String> entry : toHeaders.entrySet()) {
String k = entry.getKey();
String v = entry.getValue();
if (k == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.CharSequence");
}
String name = StringsKt.trim((CharSequence) k).toString();
if (v == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.CharSequence");
}
String value = StringsKt.trim((CharSequence) v).toString();
checkName(name);
checkValue(value, name);
namesAndValues[i] = name;
namesAndValues[i + 1] = value;
i += 2;
}
return new Headers(namesAndValues, null);
}
@Deprecated(level = DeprecationLevel.ERROR, message = "function moved to extension", replaceWith = @ReplaceWith(expression = "headers.toHeaders()", imports = {}))
/* renamed from: -deprecated_of, reason: not valid java name */
public final Headers m1657deprecated_of(Map<String, String> headers) {
Intrinsics.checkNotNullParameter(headers, "headers");
return m262of(headers);
}
/* JADX INFO: Access modifiers changed from: private */
public final void checkName(String name) {
if (!(name.length() > 0)) {
throw new IllegalArgumentException("name is empty".toString());
}
int length = name.length();
for (int i = 0; i < length; i++) {
char c = name.charAt(i);
if (!('!' <= c && '~' >= c)) {
throw new IllegalArgumentException(Util.format("Unexpected char %#04x at %d in header name: %s", Integer.valueOf(c), Integer.valueOf(i), name).toString());
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public final void checkValue(String value, String name) {
int length = value.length();
for (int i = 0; i < length; i++) {
char c = value.charAt(i);
if (!(c == '\t' || (' ' <= c && '~' >= c))) {
StringBuilder sb = new StringBuilder();
sb.append(Util.format("Unexpected char %#04x at %d in %s value", Integer.valueOf(c), Integer.valueOf(i), name));
sb.append(Util.isSensitiveHeader(name) ? "" : ": " + value);
throw new IllegalArgumentException(sb.toString().toString());
}
}
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,64 @@
package okhttp3;
import androidx.core.app.NotificationCompat;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import kotlin.Metadata;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.Interceptor;
/* compiled from: Interceptor.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\\u0080\u0001\u0018\u0000 \u00072\u00020\u0001:\u0002\u0006\u0007J\u0010\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0005H&¨\u0006\b"}, m238d2 = {"Lokhttp3/Interceptor;", "", "intercept", "Lokhttp3/Response;", "chain", "Lokhttp3/Interceptor$Chain;", "Chain", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public interface Interceptor {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = Companion.$$INSTANCE;
/* compiled from: Interceptor.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\bf\u0018\u00002\u00020\u0001J\b\u0010\u0002\u001a\u00020\u0003H&J\b\u0010\u0004\u001a\u00020\u0005H&J\n\u0010\u0006\u001a\u0004\u0018\u00010\u0007H&J\u0010\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000bH&J\b\u0010\f\u001a\u00020\u0005H&J\b\u0010\n\u001a\u00020\u000bH&J\u0018\u0010\r\u001a\u00020\u00002\u0006\u0010\u000e\u001a\u00020\u00052\u0006\u0010\u000f\u001a\u00020\u0010H&J\u0018\u0010\u0011\u001a\u00020\u00002\u0006\u0010\u000e\u001a\u00020\u00052\u0006\u0010\u000f\u001a\u00020\u0010H&J\u0018\u0010\u0012\u001a\u00020\u00002\u0006\u0010\u000e\u001a\u00020\u00052\u0006\u0010\u000f\u001a\u00020\u0010H&J\b\u0010\u0013\u001a\u00020\u0005H&¨\u0006\u0014"}, m238d2 = {"Lokhttp3/Interceptor$Chain;", "", NotificationCompat.CATEGORY_CALL, "Lokhttp3/Call;", "connectTimeoutMillis", "", "connection", "Lokhttp3/Connection;", "proceed", "Lokhttp3/Response;", "request", "Lokhttp3/Request;", "readTimeoutMillis", "withConnectTimeout", "timeout", "unit", "Ljava/util/concurrent/TimeUnit;", "withReadTimeout", "withWriteTimeout", "writeTimeoutMillis", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public interface Chain {
Call call();
int connectTimeoutMillis();
Connection connection();
Response proceed(Request request) throws IOException;
int readTimeoutMillis();
Request request();
Chain withConnectTimeout(int timeout, TimeUnit unit);
Chain withReadTimeout(int timeout, TimeUnit unit);
Chain withWriteTimeout(int timeout, TimeUnit unit);
int writeTimeoutMillis();
}
Response intercept(Chain chain) throws IOException;
/* compiled from: Interceptor.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J1\u0010\u0003\u001a\u00020\u00042#\b\u0004\u0010\u0005\u001a\u001d\u0012\u0013\u0012\u00110\u0007¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\n\u0012\u0004\u0012\u00020\u000b0\u0006H\u0086\\u0001\u0000\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006\f"}, m238d2 = {"Lokhttp3/Interceptor$Companion;", "", "()V", "invoke", "Lokhttp3/Interceptor;", "block", "Lkotlin/Function1;", "Lokhttp3/Interceptor$Chain;", "Lkotlin/ParameterName;", "name", "chain", "Lokhttp3/Response;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
static final /* synthetic */ Companion $$INSTANCE = new Companion();
private Companion() {
}
public final Interceptor invoke(final Function1<? super Chain, Response> block) {
Intrinsics.checkNotNullParameter(block, "block");
return new Interceptor() { // from class: okhttp3.Interceptor$Companion$invoke$1
@Override // okhttp3.Interceptor
public final Response intercept(Interceptor.Chain it) {
Intrinsics.checkNotNullParameter(it, "it");
return (Response) Function1.this.invoke(it);
}
};
}
}
}
@@ -0,0 +1,242 @@
package okhttp3;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.collections.ArraysKt;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.ranges.IntProgression;
import kotlin.ranges.RangesKt;
import kotlin.text.StringsKt;
import kotlin.text.Typography;
/* compiled from: MediaType.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u0011\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0007\u0018\u0000 \u00182\u00020\u0001:\u0001\u0018B-\b\u0002\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003\u0012\u0006\u0010\u0005\u001a\u00020\u0003\u0012\f\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\u00030\u0007¢\u0006\u0002\u0010\bJ\u0016\u0010\u000b\u001a\u0004\u0018\u00010\f2\n\b\u0002\u0010\r\u001a\u0004\u0018\u00010\fH\u0007J\u0013\u0010\u000e\u001a\u00020\u000f2\b\u0010\u0010\u001a\u0004\u0018\u00010\u0001H\u0096\u0002J\b\u0010\u0011\u001a\u00020\u0012H\u0016J\u0010\u0010\u0013\u001a\u0004\u0018\u00010\u00032\u0006\u0010\u0014\u001a\u00020\u0003J\r\u0010\u0005\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u0015J\b\u0010\u0016\u001a\u00020\u0003H\u0016J\r\u0010\u0004\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u0017R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u0016\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\u00030\u0007X\u0082\u0004¢\u0006\u0004\n\u0002\u0010\tR\u0013\u0010\u0005\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\nR\u0013\u0010\u0004\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0004\u0010\\u0006\u0019"}, m238d2 = {"Lokhttp3/MediaType;", "", "mediaType", "", "type", "subtype", "parameterNamesAndValues", "", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V", "[Ljava/lang/String;", "()Ljava/lang/String;", "charset", "Ljava/nio/charset/Charset;", "defaultValue", "equals", "", "other", "hashCode", "", "parameter", "name", "-deprecated_subtype", "toString", "-deprecated_type", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class MediaType {
private static final String QUOTED = "\"([^\"]*)\"";
private static final String TOKEN = "([a-zA-Z0-9-!#$%&'*+.^_`{|}~]+)";
private final String mediaType;
private final String[] parameterNamesAndValues;
private final String subtype;
private final String type;
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private static final Pattern TYPE_SUBTYPE = Pattern.compile("([a-zA-Z0-9-!#$%&'*+.^_`{|}~]+)/([a-zA-Z0-9-!#$%&'*+.^_`{|}~]+)");
private static final Pattern PARAMETER = Pattern.compile(";\\s*(?:([a-zA-Z0-9-!#$%&'*+.^_`{|}~]+)=(?:([a-zA-Z0-9-!#$%&'*+.^_`{|}~]+)|\"([^\"]*)\"))?");
@JvmStatic
public static final MediaType get(String str) {
return INSTANCE.get(str);
}
@JvmStatic
public static final MediaType parse(String str) {
return INSTANCE.parse(str);
}
public final Charset charset() {
return charset$default(this, null, 1, null);
}
private MediaType(String mediaType, String type, String subtype, String[] parameterNamesAndValues) {
this.mediaType = mediaType;
this.type = type;
this.subtype = subtype;
this.parameterNamesAndValues = parameterNamesAndValues;
}
public /* synthetic */ MediaType(String mediaType, String type, String subtype, String[] parameterNamesAndValues, DefaultConstructorMarker $constructor_marker) {
this(mediaType, type, subtype, parameterNamesAndValues);
}
public final String type() {
return this.type;
}
public final String subtype() {
return this.subtype;
}
public static /* synthetic */ Charset charset$default(MediaType mediaType, Charset charset, int i, Object obj) {
if ((i & 1) != 0) {
charset = null;
}
return mediaType.charset(charset);
}
public final Charset charset(Charset defaultValue) {
String charset = parameter("charset");
if (charset == null) {
return defaultValue;
}
try {
return Charset.forName(charset);
} catch (IllegalArgumentException e) {
return defaultValue;
}
}
public final String parameter(String name) {
Intrinsics.checkNotNullParameter(name, "name");
IntProgression step = RangesKt.step(ArraysKt.getIndices(this.parameterNamesAndValues), 2);
int i = step.getFirst();
int last = step.getLast();
int step2 = step.getStep();
if (step2 >= 0) {
if (i > last) {
return null;
}
} else if (i < last) {
return null;
}
while (!StringsKt.equals(this.parameterNamesAndValues[i], name, true)) {
if (i == last) {
return null;
}
i += step2;
}
return this.parameterNamesAndValues[i + 1];
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "type", imports = {}))
/* renamed from: -deprecated_type, reason: not valid java name and from getter */
public final String getType() {
return this.type;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "subtype", imports = {}))
/* renamed from: -deprecated_subtype, reason: not valid java name and from getter */
public final String getSubtype() {
return this.subtype;
}
/* renamed from: toString, reason: from getter */
public String getMediaType() {
return this.mediaType;
}
public boolean equals(Object other) {
return (other instanceof MediaType) && Intrinsics.areEqual(((MediaType) other).mediaType, this.mediaType);
}
public int hashCode() {
return this.mediaType.hashCode();
}
/* compiled from: MediaType.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0007\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0015\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\u0007H\u0007¢\u0006\u0002\b\rJ\u0017\u0010\u000e\u001a\u0004\u0018\u00010\u000b2\u0006\u0010\f\u001a\u00020\u0007H\u0007¢\u0006\u0002\b\u000fJ\u0011\u0010\u0010\u001a\u00020\u000b*\u00020\u0007H\u0007¢\u0006\u0002\b\nJ\u0013\u0010\u0011\u001a\u0004\u0018\u00010\u000b*\u00020\u0007H\u0007¢\u0006\u0002\b\u000eR\u0016\u0010\u0003\u001a\n \u0005*\u0004\u0018\u00010\u00040\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0007X\u0082T¢\u0006\u0002\n\u0000R\u0016\u0010\t\u001a\n \u0005*\u0004\u0018\u00010\u00040\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0012"}, m238d2 = {"Lokhttp3/MediaType$Companion;", "", "()V", "PARAMETER", "Ljava/util/regex/Pattern;", "kotlin.jvm.PlatformType", "QUOTED", "", "TOKEN", "TYPE_SUBTYPE", "get", "Lokhttp3/MediaType;", "mediaType", "-deprecated_get", "parse", "-deprecated_parse", "toMediaType", "toMediaTypeOrNull", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
@JvmStatic
public final MediaType get(String toMediaType) {
String value;
Intrinsics.checkNotNullParameter(toMediaType, "$this$toMediaType");
Matcher typeSubtype = MediaType.TYPE_SUBTYPE.matcher(toMediaType);
if (!typeSubtype.lookingAt()) {
throw new IllegalArgumentException(("No subtype found for: \"" + toMediaType + Typography.quote).toString());
}
String group = typeSubtype.group(1);
Intrinsics.checkNotNullExpressionValue(group, "typeSubtype.group(1)");
Locale locale = Locale.US;
Intrinsics.checkNotNullExpressionValue(locale, "Locale.US");
if (group == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
String type = group.toLowerCase(locale);
Intrinsics.checkNotNullExpressionValue(type, "(this as java.lang.String).toLowerCase(locale)");
String group2 = typeSubtype.group(2);
Intrinsics.checkNotNullExpressionValue(group2, "typeSubtype.group(2)");
Locale locale2 = Locale.US;
Intrinsics.checkNotNullExpressionValue(locale2, "Locale.US");
if (group2 == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
String subtype = group2.toLowerCase(locale2);
Intrinsics.checkNotNullExpressionValue(subtype, "(this as java.lang.String).toLowerCase(locale)");
Collection parameterNamesAndValues = (List) new ArrayList();
Matcher parameter = MediaType.PARAMETER.matcher(toMediaType);
int s = typeSubtype.end();
while (s < toMediaType.length()) {
parameter.region(s, toMediaType.length());
if (!parameter.lookingAt()) {
StringBuilder sb = new StringBuilder();
sb.append("Parameter is not formatted correctly: \"");
String substring = toMediaType.substring(s);
Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.String).substring(startIndex)");
sb.append(substring);
sb.append("\" for: \"");
sb.append(toMediaType);
sb.append(Typography.quote);
throw new IllegalArgumentException(sb.toString().toString());
}
String name = parameter.group(1);
if (name == null) {
s = parameter.end();
} else {
String token = parameter.group(2);
if (token != null) {
if (StringsKt.startsWith$default(token, "'", false, 2, (Object) null) && StringsKt.endsWith$default(token, "'", false, 2, (Object) null) && token.length() > 2) {
value = token.substring(1, token.length() - 1);
Intrinsics.checkNotNullExpressionValue(value, "(this as java.lang.Strin…ing(startIndex, endIndex)");
} else {
value = token;
}
} else {
value = parameter.group(3);
}
parameterNamesAndValues.add(name);
parameterNamesAndValues.add(value);
s = parameter.end();
}
}
Collection $this$toTypedArray$iv = parameterNamesAndValues;
Object[] array = $this$toTypedArray$iv.toArray(new String[0]);
if (array != null) {
return new MediaType(toMediaType, type, subtype, (String[]) array, null);
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
}
@JvmStatic
public final MediaType parse(String toMediaTypeOrNull) {
Intrinsics.checkNotNullParameter(toMediaTypeOrNull, "$this$toMediaTypeOrNull");
try {
return get(toMediaTypeOrNull);
} catch (IllegalArgumentException e) {
return null;
}
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to extension function", replaceWith = @ReplaceWith(expression = "mediaType.toMediaType()", imports = {"okhttp3.MediaType.Companion.toMediaType"}))
/* renamed from: -deprecated_get, reason: not valid java name */
public final MediaType m1684deprecated_get(String mediaType) {
Intrinsics.checkNotNullParameter(mediaType, "mediaType");
return get(mediaType);
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to extension function", replaceWith = @ReplaceWith(expression = "mediaType.toMediaTypeOrNull()", imports = {"okhttp3.MediaType.Companion.toMediaTypeOrNull"}))
/* renamed from: -deprecated_parse, reason: not valid java name */
public final MediaType m1685deprecated_parse(String mediaType) {
Intrinsics.checkNotNullParameter(mediaType, "mediaType");
return parse(mediaType);
}
}
}
@@ -0,0 +1,428 @@
package okhttp3;
import com.google.common.net.HttpHeaders;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Typography;
import okhttp3.Headers;
import okhttp3.RequestBody;
import okhttp3.internal.Util;
import okio.Buffer;
import okio.BufferedSink;
import okio.ByteString;
/* compiled from: MultipartBody.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000N\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\n\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0004\u0018\u0000 #2\u00020\u0001:\u0003\"#$B%\b\u0000\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\f\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u0007¢\u0006\u0002\u0010\tJ\r\u0010\n\u001a\u00020\u000bH\u0007¢\u0006\u0002\b\u0015J\b\u0010\r\u001a\u00020\u000eH\u0016J\b\u0010\u000f\u001a\u00020\u0005H\u0016J\u000e\u0010\u0016\u001a\u00020\b2\u0006\u0010\u0017\u001a\u00020\u0012J\u0013\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u0007H\u0007¢\u0006\u0002\b\u0018J\r\u0010\u0011\u001a\u00020\u0012H\u0007¢\u0006\u0002\b\u0019J\r\u0010\u0004\u001a\u00020\u0005H\u0007¢\u0006\u0002\b\u001aJ\u001a\u0010\u001b\u001a\u00020\u000e2\b\u0010\u001c\u001a\u0004\u0018\u00010\u001d2\u0006\u0010\u001e\u001a\u00020\u001fH\u0002J\u0010\u0010 \u001a\u00020!2\u0006\u0010\u001c\u001a\u00020\u001dH\u0016R\u0011\u0010\n\u001a\u00020\u000b8G¢\u0006\u0006\u001a\u0004\b\n\u0010\fR\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u000eX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0019\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u00078\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0010R\u0011\u0010\u0011\u001a\u00020\u00128G¢\u0006\u0006\u001a\u0004\b\u0011\u0010\u0013R\u0013\u0010\u0004\u001a\u00020\u00058\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0004\u0010\u0014¨\u0006%"}, m238d2 = {"Lokhttp3/MultipartBody;", "Lokhttp3/RequestBody;", "boundaryByteString", "Lokio/ByteString;", "type", "Lokhttp3/MediaType;", "parts", "", "Lokhttp3/MultipartBody$Part;", "(Lokio/ByteString;Lokhttp3/MediaType;Ljava/util/List;)V", "boundary", "", "()Ljava/lang/String;", "contentLength", "", "contentType", "()Ljava/util/List;", "size", "", "()I", "()Lokhttp3/MediaType;", "-deprecated_boundary", "part", "index", "-deprecated_parts", "-deprecated_size", "-deprecated_type", "writeOrCountBytes", "sink", "Lokio/BufferedSink;", "countBytes", "", "writeTo", "", "Builder", "Companion", "Part", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class MultipartBody extends RequestBody {
private static final byte[] DASHDASH;
private final ByteString boundaryByteString;
private long contentLength;
private final MediaType contentType;
private final List<Part> parts;
private final MediaType type;
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
public static final MediaType MIXED = MediaType.INSTANCE.get("multipart/mixed");
public static final MediaType ALTERNATIVE = MediaType.INSTANCE.get("multipart/alternative");
public static final MediaType DIGEST = MediaType.INSTANCE.get("multipart/digest");
public static final MediaType PARALLEL = MediaType.INSTANCE.get("multipart/parallel");
public static final MediaType FORM = MediaType.INSTANCE.get("multipart/form-data");
private static final byte[] COLONSPACE = {(byte) 58, (byte) 32};
private static final byte[] CRLF = {(byte) 13, (byte) 10};
public MultipartBody(ByteString boundaryByteString, MediaType type, List<Part> parts) {
Intrinsics.checkNotNullParameter(boundaryByteString, "boundaryByteString");
Intrinsics.checkNotNullParameter(type, "type");
Intrinsics.checkNotNullParameter(parts, "parts");
this.boundaryByteString = boundaryByteString;
this.type = type;
this.parts = parts;
this.contentType = MediaType.INSTANCE.get(type + "; boundary=" + boundary());
this.contentLength = -1L;
}
public final MediaType type() {
return this.type;
}
public final List<Part> parts() {
return this.parts;
}
public final String boundary() {
return this.boundaryByteString.utf8();
}
public final int size() {
return this.parts.size();
}
public final Part part(int index) {
return this.parts.get(index);
}
@Override // okhttp3.RequestBody
/* renamed from: contentType, reason: from getter */
public MediaType getContentType() {
return this.contentType;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "type", imports = {}))
/* renamed from: -deprecated_type, reason: not valid java name and from getter */
public final MediaType getType() {
return this.type;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "boundary", imports = {}))
/* renamed from: -deprecated_boundary, reason: not valid java name */
public final String m1686deprecated_boundary() {
return boundary();
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "size", imports = {}))
/* renamed from: -deprecated_size, reason: not valid java name */
public final int m1688deprecated_size() {
return size();
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "parts", imports = {}))
/* renamed from: -deprecated_parts, reason: not valid java name */
public final List<Part> m1687deprecated_parts() {
return this.parts;
}
@Override // okhttp3.RequestBody
public long contentLength() throws IOException {
long result = this.contentLength;
if (result == -1) {
long result2 = writeOrCountBytes(null, true);
this.contentLength = result2;
return result2;
}
return result;
}
@Override // okhttp3.RequestBody
public void writeTo(BufferedSink sink) throws IOException {
Intrinsics.checkNotNullParameter(sink, "sink");
writeOrCountBytes(sink, false);
}
private final long writeOrCountBytes(BufferedSink sink, boolean countBytes) throws IOException {
Buffer sink2 = sink;
long byteCount = 0;
Buffer byteCountBuffer = (Buffer) null;
if (countBytes) {
byteCountBuffer = new Buffer();
sink2 = byteCountBuffer;
}
int size = this.parts.size();
for (int p = 0; p < size; p++) {
Part part = this.parts.get(p);
Headers headers = part.headers();
RequestBody body = part.body();
Intrinsics.checkNotNull(sink2);
sink2.write(DASHDASH);
sink2.write(this.boundaryByteString);
sink2.write(CRLF);
if (headers != null) {
int size2 = headers.size();
for (int h = 0; h < size2; h++) {
sink2.writeUtf8(headers.name(h)).write(COLONSPACE).writeUtf8(headers.value(h)).write(CRLF);
}
}
MediaType contentType = body.getContentType();
if (contentType != null) {
sink2.writeUtf8("Content-Type: ").writeUtf8(contentType.getMediaType()).write(CRLF);
}
long contentLength = body.contentLength();
if (contentLength != -1) {
sink2.writeUtf8("Content-Length: ").writeDecimalLong(contentLength).write(CRLF);
} else if (countBytes) {
Intrinsics.checkNotNull(byteCountBuffer);
byteCountBuffer.clear();
return -1L;
}
byte[] bArr = CRLF;
sink2.write(bArr);
if (countBytes) {
byteCount += contentLength;
} else {
body.writeTo(sink2);
}
sink2.write(bArr);
}
Intrinsics.checkNotNull(sink2);
byte[] bArr2 = DASHDASH;
sink2.write(bArr2);
sink2.write(this.boundaryByteString);
sink2.write(bArr2);
sink2.write(CRLF);
if (!countBytes) {
return byteCount;
}
Intrinsics.checkNotNull(byteCountBuffer);
long byteCount2 = byteCount + byteCountBuffer.size();
byteCountBuffer.clear();
return byteCount2;
}
/* compiled from: MultipartBody.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\u0018\u0000 \u000b2\u00020\u0001:\u0001\u000bB\u0019\b\u0002\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\r\u0010\u0004\u001a\u00020\u0005H\u0007¢\u0006\u0002\b\tJ\u000f\u0010\u0002\u001a\u0004\u0018\u00010\u0003H\u0007¢\u0006\u0002\b\nR\u0013\u0010\u0004\u001a\u00020\u00058\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0004\u0010\u0007R\u0015\u0010\u0002\u001a\u0004\u0018\u00010\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\\u0006\f"}, m238d2 = {"Lokhttp3/MultipartBody$Part;", "", "headers", "Lokhttp3/Headers;", "body", "Lokhttp3/RequestBody;", "(Lokhttp3/Headers;Lokhttp3/RequestBody;)V", "()Lokhttp3/RequestBody;", "()Lokhttp3/Headers;", "-deprecated_body", "-deprecated_headers", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Part {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private final RequestBody body;
private final Headers headers;
@JvmStatic
public static final Part create(Headers headers, RequestBody requestBody) {
return INSTANCE.create(headers, requestBody);
}
@JvmStatic
public static final Part create(RequestBody requestBody) {
return INSTANCE.create(requestBody);
}
@JvmStatic
public static final Part createFormData(String str, String str2) {
return INSTANCE.createFormData(str, str2);
}
@JvmStatic
public static final Part createFormData(String str, String str2, RequestBody requestBody) {
return INSTANCE.createFormData(str, str2, requestBody);
}
private Part(Headers headers, RequestBody body) {
this.headers = headers;
this.body = body;
}
public /* synthetic */ Part(Headers headers, RequestBody body, DefaultConstructorMarker $constructor_marker) {
this(headers, body);
}
public final Headers headers() {
return this.headers;
}
public final RequestBody body() {
return this.body;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "headers", imports = {}))
/* renamed from: -deprecated_headers, reason: not valid java name and from getter */
public final Headers getHeaders() {
return this.headers;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "body", imports = {}))
/* renamed from: -deprecated_body, reason: not valid java name and from getter */
public final RequestBody getBody() {
return this.body;
}
/* compiled from: MultipartBody.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u001a\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0007J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\bH\u0007J\u0018\u0010\t\u001a\u00020\u00042\u0006\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\u000bH\u0007J\"\u0010\t\u001a\u00020\u00042\u0006\u0010\n\u001a\u00020\u000b2\b\u0010\r\u001a\u0004\u0018\u00010\u000b2\u0006\u0010\u0007\u001a\u00020\bH\u0007¨\u0006\u000e"}, m238d2 = {"Lokhttp3/MultipartBody$Part$Companion;", "", "()V", "create", "Lokhttp3/MultipartBody$Part;", "headers", "Lokhttp3/Headers;", "body", "Lokhttp3/RequestBody;", "createFormData", "name", "", "value", "filename", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
@JvmStatic
public final Part create(RequestBody body) {
Intrinsics.checkNotNullParameter(body, "body");
return create(null, body);
}
@JvmStatic
public final Part create(Headers headers, RequestBody body) {
Intrinsics.checkNotNullParameter(body, "body");
DefaultConstructorMarker defaultConstructorMarker = null;
if (!((headers != null ? headers.get(HttpHeaders.CONTENT_TYPE) : null) == null)) {
throw new IllegalArgumentException("Unexpected header: Content-Type".toString());
}
if ((headers != null ? headers.get(HttpHeaders.CONTENT_LENGTH) : null) == null) {
return new Part(headers, body, defaultConstructorMarker);
}
throw new IllegalArgumentException("Unexpected header: Content-Length".toString());
}
@JvmStatic
public final Part createFormData(String name, String value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
return createFormData(name, null, RequestBody.Companion.create$default(RequestBody.INSTANCE, value, (MediaType) null, 1, (Object) null));
}
@JvmStatic
public final Part createFormData(String name, String filename, RequestBody body) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(body, "body");
StringBuilder $this$buildString = new StringBuilder();
$this$buildString.append("form-data; name=");
MultipartBody.INSTANCE.appendQuotedString$okhttp($this$buildString, name);
if (filename != null) {
$this$buildString.append("; filename=");
MultipartBody.INSTANCE.appendQuotedString$okhttp($this$buildString, filename);
}
String disposition = $this$buildString.toString();
Intrinsics.checkNotNullExpressionValue(disposition, "StringBuilder().apply(builderAction).toString()");
Headers headers = new Headers.Builder().addUnsafeNonAscii(HttpHeaders.CONTENT_DISPOSITION, disposition).build();
return create(headers, body);
}
}
}
/* compiled from: MultipartBody.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000@\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010!\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0018\u00002\u00020\u0001B\u0011\b\u0007\u0012\b\b\u0002\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\u0016\u0010\u000b\u001a\u00020\u00002\u0006\u0010\f\u001a\u00020\u00032\u0006\u0010\r\u001a\u00020\u0003J \u0010\u000b\u001a\u00020\u00002\u0006\u0010\f\u001a\u00020\u00032\b\u0010\u000e\u001a\u0004\u0018\u00010\u00032\u0006\u0010\u000f\u001a\u00020\u0010J\u0018\u0010\u0011\u001a\u00020\u00002\b\u0010\u0012\u001a\u0004\u0018\u00010\u00132\u0006\u0010\u000f\u001a\u00020\u0010J\u000e\u0010\u0011\u001a\u00020\u00002\u0006\u0010\u0014\u001a\u00020\bJ\u000e\u0010\u0011\u001a\u00020\u00002\u0006\u0010\u000f\u001a\u00020\u0010J\u0006\u0010\u0015\u001a\u00020\u0016J\u000e\u0010\u0017\u001a\u00020\u00002\u0006\u0010\t\u001a\u00020\nR\u000e\u0010\u0002\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\nX\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0018"}, m238d2 = {"Lokhttp3/MultipartBody$Builder;", "", "boundary", "", "(Ljava/lang/String;)V", "Lokio/ByteString;", "parts", "", "Lokhttp3/MultipartBody$Part;", "type", "Lokhttp3/MediaType;", "addFormDataPart", "name", "value", "filename", "body", "Lokhttp3/RequestBody;", "addPart", "headers", "Lokhttp3/Headers;", "part", "build", "Lokhttp3/MultipartBody;", "setType", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Builder {
private final ByteString boundary;
private final List<Part> parts;
private MediaType type;
/* JADX WARN: Multi-variable type inference failed */
public Builder() {
this(null, 1, 0 == true ? 1 : 0);
}
public Builder(String boundary) {
Intrinsics.checkNotNullParameter(boundary, "boundary");
this.boundary = ByteString.INSTANCE.encodeUtf8(boundary);
this.type = MultipartBody.MIXED;
this.parts = new ArrayList();
}
/* JADX WARN: Illegal instructions before constructor call */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public /* synthetic */ Builder(java.lang.String r1, int r2, kotlin.jvm.internal.DefaultConstructorMarker r3) {
/*
r0 = this;
r2 = r2 & 1
if (r2 == 0) goto L11
java.util.UUID r1 = java.util.UUID.randomUUID()
java.lang.String r1 = r1.toString()
java.lang.String r2 = "UUID.randomUUID().toString()"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r1, r2)
L11:
r0.<init>(r1)
return
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.MultipartBody.Builder.<init>(java.lang.String, int, kotlin.jvm.internal.DefaultConstructorMarker):void");
}
public final Builder setType(MediaType type) {
Intrinsics.checkNotNullParameter(type, "type");
Builder $this$apply = this;
if (!Intrinsics.areEqual(type.type(), "multipart")) {
throw new IllegalArgumentException(("multipart != " + type).toString());
}
$this$apply.type = type;
return this;
}
public final Builder addPart(RequestBody body) {
Intrinsics.checkNotNullParameter(body, "body");
Builder $this$apply = this;
$this$apply.addPart(Part.INSTANCE.create(body));
return this;
}
public final Builder addPart(Headers headers, RequestBody body) {
Intrinsics.checkNotNullParameter(body, "body");
Builder $this$apply = this;
$this$apply.addPart(Part.INSTANCE.create(headers, body));
return this;
}
public final Builder addFormDataPart(String name, String value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
Builder $this$apply = this;
$this$apply.addPart(Part.INSTANCE.createFormData(name, value));
return this;
}
public final Builder addFormDataPart(String name, String filename, RequestBody body) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(body, "body");
Builder $this$apply = this;
$this$apply.addPart(Part.INSTANCE.createFormData(name, filename, body));
return this;
}
public final Builder addPart(Part part) {
Intrinsics.checkNotNullParameter(part, "part");
Builder $this$apply = this;
$this$apply.parts.add(part);
return this;
}
public final MultipartBody build() {
if (!this.parts.isEmpty()) {
return new MultipartBody(this.boundary, this.type, Util.toImmutableList(this.parts));
}
throw new IllegalStateException("Multipart body must have at least one part.".toString());
}
}
/* compiled from: MultipartBody.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0012\n\u0002\b\u0007\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u001d\u0010\r\u001a\u00020\u000e*\u00060\u000fj\u0002`\u00102\u0006\u0010\u0011\u001a\u00020\u0012H\u0000¢\u0006\u0002\b\u0013R\u0010\u0010\u0003\u001a\u00020\u00048\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\t\u001a\u00020\u00048\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\n\u001a\u00020\u00048\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u000b\u001a\u00020\u00048\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\f\u001a\u00020\u00048\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006\u0014"}, m238d2 = {"Lokhttp3/MultipartBody$Companion;", "", "()V", "ALTERNATIVE", "Lokhttp3/MediaType;", "COLONSPACE", "", "CRLF", "DASHDASH", "DIGEST", "FORM", "MIXED", "PARALLEL", "appendQuotedString", "", "Ljava/lang/StringBuilder;", "Lkotlin/text/StringBuilder;", "key", "", "appendQuotedString$okhttp", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public final void appendQuotedString$okhttp(StringBuilder appendQuotedString, String key) {
Intrinsics.checkNotNullParameter(appendQuotedString, "$this$appendQuotedString");
Intrinsics.checkNotNullParameter(key, "key");
appendQuotedString.append(Typography.quote);
int length = key.length();
for (int i = 0; i < length; i++) {
char ch = key.charAt(i);
switch (ch) {
case '\n':
appendQuotedString.append("%0A");
break;
case '\r':
appendQuotedString.append("%0D");
break;
case '\"':
appendQuotedString.append("%22");
break;
default:
appendQuotedString.append(ch);
break;
}
}
appendQuotedString.append(Typography.quote);
}
}
static {
byte b = (byte) 45;
DASHDASH = new byte[]{b, b};
}
}
@@ -0,0 +1,251 @@
package okhttp3;
import android.support.v4.media.session.PlaybackStateCompat;
import java.io.Closeable;
import java.io.IOException;
import java.net.ProtocolException;
import java.util.concurrent.TimeUnit;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.internal.http1.HeadersReader;
import okio.Buffer;
import okio.BufferedSource;
import okio.ByteString;
import okio.Okio;
import okio.Options;
import okio.Source;
import okio.Timeout;
/* compiled from: MultipartReader.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000P\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u0000 \u001c2\u00020\u0001:\u0003\u001c\u001d\u001eB\u000f\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004B\u0015\u0012\u0006\u0010\u0005\u001a\u00020\u0006\u0012\u0006\u0010\u0007\u001a\u00020\\u0006\u0002\u0010\tJ\b\u0010\u0015\u001a\u00020\u0016H\u0016J\u0010\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0019\u001a\u00020\u0018H\u0002J\b\u0010\u001a\u001a\u0004\u0018\u00010\u001bR\u0013\u0010\u0007\u001a\u00020\b8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\nR\u000e\u0010\u000b\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u000eX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u000f\u001a\b\u0018\u00010\u0010R\u00020\u0000X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u000eX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0012\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0013\u001a\u00020\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u001f"}, m238d2 = {"Lokhttp3/MultipartReader;", "Ljava/io/Closeable;", "response", "Lokhttp3/ResponseBody;", "(Lokhttp3/ResponseBody;)V", "source", "Lokio/BufferedSource;", "boundary", "", "(Lokio/BufferedSource;Ljava/lang/String;)V", "()Ljava/lang/String;", "closed", "", "crlfDashDashBoundary", "Lokio/ByteString;", "currentPart", "Lokhttp3/MultipartReader$PartSource;", "dashDashBoundary", "noMoreParts", "partCount", "", "close", "", "currentPartBytesRemaining", "", "maxResult", "nextPart", "Lokhttp3/MultipartReader$Part;", "Companion", "Part", "PartSource", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class MultipartReader implements Closeable {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private static final Options afterBoundaryOptions = Options.INSTANCE.m271of(ByteString.INSTANCE.encodeUtf8("\r\n"), ByteString.INSTANCE.encodeUtf8("--"), ByteString.INSTANCE.encodeUtf8(" "), ByteString.INSTANCE.encodeUtf8("\t"));
private final String boundary;
private boolean closed;
private final ByteString crlfDashDashBoundary;
private PartSource currentPart;
private final ByteString dashDashBoundary;
private boolean noMoreParts;
private int partCount;
private final BufferedSource source;
public MultipartReader(BufferedSource source, String boundary) throws IOException {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(boundary, "boundary");
this.source = source;
this.boundary = boundary;
this.dashDashBoundary = new Buffer().writeUtf8("--").writeUtf8(boundary).readByteString();
this.crlfDashDashBoundary = new Buffer().writeUtf8("\r\n--").writeUtf8(boundary).readByteString();
}
/* renamed from: boundary, reason: from getter */
public final String getBoundary() {
return this.boundary;
}
/* JADX WARN: Illegal instructions before constructor call */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public MultipartReader(okhttp3.ResponseBody r4) throws java.io.IOException {
/*
r3 = this;
java.lang.String r0 = "response"
kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r4, r0)
okio.BufferedSource r0 = r4.getSource()
okhttp3.MediaType r1 = r4.get$contentType()
if (r1 == 0) goto L1c
java.lang.String r2 = "boundary"
java.lang.String r1 = r1.parameter(r2)
if (r1 == 0) goto L1c
r3.<init>(r0, r1)
return
L1c:
java.net.ProtocolException r0 = new java.net.ProtocolException
java.lang.String r1 = "expected the Content-Type to have a boundary parameter"
r0.<init>(r1)
java.lang.Throwable r0 = (java.lang.Throwable) r0
throw r0
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.MultipartReader.<init>(okhttp3.ResponseBody):void");
}
public final Part nextPart() throws IOException {
if (!(!this.closed)) {
throw new IllegalStateException("closed".toString());
}
if (!this.noMoreParts) {
if (this.partCount == 0 && this.source.rangeEquals(0L, this.dashDashBoundary)) {
this.source.skip(this.dashDashBoundary.size());
} else {
while (true) {
long toSkip = currentPartBytesRemaining(PlaybackStateCompat.ACTION_PLAY_FROM_URI);
if (toSkip == 0) {
break;
}
this.source.skip(toSkip);
}
this.source.skip(this.crlfDashDashBoundary.size());
}
boolean whitespace = false;
while (true) {
switch (this.source.select(afterBoundaryOptions)) {
case -1:
throw new ProtocolException("unexpected characters after boundary");
case 0:
this.partCount++;
Headers headers = new HeadersReader(this.source).readHeaders();
PartSource partSource = new PartSource();
this.currentPart = partSource;
return new Part(headers, Okio.buffer(partSource));
case 1:
if (whitespace) {
throw new ProtocolException("unexpected characters after boundary");
}
if (this.partCount == 0) {
throw new ProtocolException("expected at least 1 part");
}
this.noMoreParts = true;
return null;
case 2:
case 3:
whitespace = true;
break;
}
}
} else {
return null;
}
}
/* compiled from: MultipartReader.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0082\u0004\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0005\u001a\u00020\u0006H\u0016J\u0018\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\bH\u0016J\b\u0010\u0003\u001a\u00020\u0004H\u0016R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\f"}, m238d2 = {"Lokhttp3/MultipartReader$PartSource;", "Lokio/Source;", "(Lokhttp3/MultipartReader;)V", "timeout", "Lokio/Timeout;", "close", "", "read", "", "sink", "Lokio/Buffer;", "byteCount", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private final class PartSource implements Source {
private final Timeout timeout = new Timeout();
public PartSource() {
}
@Override // okio.Source, java.io.Closeable, java.lang.AutoCloseable
public void close() {
if (Intrinsics.areEqual(MultipartReader.this.currentPart, this)) {
MultipartReader.this.currentPart = null;
}
}
@Override // okio.Source
public long read(Buffer sink, long byteCount) {
Intrinsics.checkNotNullParameter(sink, "sink");
if (!(byteCount >= 0)) {
throw new IllegalArgumentException(("byteCount < 0: " + byteCount).toString());
}
if (!Intrinsics.areEqual(MultipartReader.this.currentPart, this)) {
throw new IllegalStateException("closed".toString());
}
Timeout this_$iv = MultipartReader.this.source.getTimeout();
Timeout other$iv = this.timeout;
long originalTimeout$iv = this_$iv.getTimeoutNanos();
this_$iv.timeout(Timeout.INSTANCE.minTimeout(other$iv.getTimeoutNanos(), this_$iv.getTimeoutNanos()), TimeUnit.NANOSECONDS);
if (!this_$iv.getHasDeadline()) {
if (other$iv.getHasDeadline()) {
this_$iv.deadlineNanoTime(other$iv.deadlineNanoTime());
}
try {
long limit = MultipartReader.this.currentPartBytesRemaining(byteCount);
return limit == 0 ? -1L : MultipartReader.this.source.read(sink, limit);
} finally {
this_$iv.timeout(originalTimeout$iv, TimeUnit.NANOSECONDS);
if (other$iv.getHasDeadline()) {
this_$iv.clearDeadline();
}
}
}
long originalDeadline$iv = this_$iv.deadlineNanoTime();
if (other$iv.getHasDeadline()) {
this_$iv.deadlineNanoTime(Math.min(this_$iv.deadlineNanoTime(), other$iv.deadlineNanoTime()));
}
try {
long limit2 = MultipartReader.this.currentPartBytesRemaining(byteCount);
return limit2 == 0 ? -1L : MultipartReader.this.source.read(sink, limit2);
} finally {
this_$iv.timeout(originalTimeout$iv, TimeUnit.NANOSECONDS);
if (other$iv.getHasDeadline()) {
this_$iv.deadlineNanoTime(originalDeadline$iv);
}
}
}
@Override // okio.Source
/* renamed from: timeout, reason: from getter */
public Timeout getTimeout() {
return this.timeout;
}
}
/* JADX INFO: Access modifiers changed from: private */
public final long currentPartBytesRemaining(long maxResult) {
this.source.require(this.crlfDashDashBoundary.size());
long delimiterIndex = this.source.getBuffer().indexOf(this.crlfDashDashBoundary);
return delimiterIndex == -1 ? Math.min(maxResult, (this.source.getBuffer().size() - this.crlfDashDashBoundary.size()) + 1) : Math.min(maxResult, delimiterIndex);
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
if (this.closed) {
return;
}
this.closed = true;
this.currentPart = null;
this.source.close();
}
/* compiled from: MultipartReader.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0000\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\t\u0010\t\u001a\u00020\nH\u0096\u0001R\u0013\u0010\u0004\u001a\u00020\u00058\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0004\u0010\u0007R\u0013\u0010\u0002\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\\u0006\u000b"}, m238d2 = {"Lokhttp3/MultipartReader$Part;", "Ljava/io/Closeable;", "headers", "Lokhttp3/Headers;", "body", "Lokio/BufferedSource;", "(Lokhttp3/Headers;Lokio/BufferedSource;)V", "()Lokio/BufferedSource;", "()Lokhttp3/Headers;", "close", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Part implements Closeable {
private final BufferedSource body;
private final Headers headers;
@Override // java.io.Closeable, java.lang.AutoCloseable
public void close() {
this.body.close();
}
public Part(Headers headers, BufferedSource body) {
Intrinsics.checkNotNullParameter(headers, "headers");
Intrinsics.checkNotNullParameter(body, "body");
this.headers = headers;
this.body = body;
}
/* renamed from: headers, reason: from getter */
public final Headers getHeaders() {
return this.headers;
}
/* renamed from: body, reason: from getter */
public final BufferedSource getBody() {
return this.body;
}
}
/* compiled from: MultipartReader.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0080\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006¨\u0006\u0007"}, m238d2 = {"Lokhttp3/MultipartReader$Companion;", "", "()V", "afterBoundaryOptions", "Lokio/Options;", "getAfterBoundaryOptions", "()Lokio/Options;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public final Options getAfterBoundaryOptions() {
return MultipartReader.afterBoundaryOptions;
}
}
}
@@ -0,0 +1,14 @@
package okhttp3;
import kotlin.Metadata;
/* compiled from: OkHttp.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000¨\u0006\u0005"}, m238d2 = {"Lokhttp3/OkHttp;", "", "()V", "VERSION", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class OkHttp {
public static final OkHttp INSTANCE = new OkHttp();
public static final String VERSION = "4.9.3";
private OkHttp() {
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,73 @@
package okhttp3;
import java.io.IOException;
import kotlin.Metadata;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: Protocol.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0000\n\u0002\u0010\u000e\n\u0002\b\n\b\u0086\u0001\u0018\u0000 \f2\b\u0012\u0004\u0012\u00020\u00000\u0001:\u0001\fB\u000f\b\u0002\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\b\u0010\u0005\u001a\u00020\u0003H\u0016R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000j\u0002\b\u0006j\u0002\b\u0007j\u0002\b\bj\u0002\b\tj\u0002\b\nj\u0002\b\u000b¨\u0006\r"}, m238d2 = {"Lokhttp3/Protocol;", "", "protocol", "", "(Ljava/lang/String;ILjava/lang/String;)V", "toString", "HTTP_1_0", "HTTP_1_1", "SPDY_3", "HTTP_2", "H2_PRIOR_KNOWLEDGE", "QUIC", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public enum Protocol {
HTTP_1_0("http/1.0"),
HTTP_1_1("http/1.1"),
SPDY_3("spdy/3.1"),
HTTP_2("h2"),
H2_PRIOR_KNOWLEDGE("h2_prior_knowledge"),
QUIC("quic");
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private final String protocol;
@JvmStatic
public static final Protocol get(String str) throws IOException {
return INSTANCE.get(str);
}
Protocol(String protocol) {
this.protocol = protocol;
}
@Override // java.lang.Enum
public String toString() {
return this.protocol;
}
/* compiled from: Protocol.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0007¨\u0006\u0007"}, m238d2 = {"Lokhttp3/Protocol$Companion;", "", "()V", "get", "Lokhttp3/Protocol;", "protocol", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
@JvmStatic
public final Protocol get(String protocol) throws IOException {
Intrinsics.checkNotNullParameter(protocol, "protocol");
if (Intrinsics.areEqual(protocol, Protocol.HTTP_1_0.protocol)) {
return Protocol.HTTP_1_0;
}
if (Intrinsics.areEqual(protocol, Protocol.HTTP_1_1.protocol)) {
return Protocol.HTTP_1_1;
}
if (Intrinsics.areEqual(protocol, Protocol.H2_PRIOR_KNOWLEDGE.protocol)) {
return Protocol.H2_PRIOR_KNOWLEDGE;
}
if (Intrinsics.areEqual(protocol, Protocol.HTTP_2.protocol)) {
return Protocol.HTTP_2;
}
if (Intrinsics.areEqual(protocol, Protocol.SPDY_3.protocol)) {
return Protocol.SPDY_3;
}
if (Intrinsics.areEqual(protocol, Protocol.QUIC.protocol)) {
return Protocol.QUIC;
}
throw new IOException("Unexpected protocol: " + protocol);
}
}
}
@@ -0,0 +1,411 @@
package okhttp3;
import com.google.android.gms.common.internal.ImagesContract;
import com.google.common.net.HttpHeaders;
import java.net.URL;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.ReplaceWith;
import kotlin.collections.CollectionsKt;
import kotlin.collections.MapsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.internal.Util;
import okhttp3.internal.http.HttpMethod;
/* compiled from: Request.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000N\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010$\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u000b\n\u0002\u0010 \n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\b\u0018\u00002\u00020\u0001:\u0001*BA\b\u0000\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\b\u0010\b\u001a\u0004\u0018\u00010\t\u0012\u0016\u0010\n\u001a\u0012\u0012\b\u0012\u0006\u0012\u0002\b\u00030\f\u0012\u0004\u0012\u00020\u00010\u000b¢\u0006\u0002\u0010\rJ\u000f\u0010\b\u001a\u0004\u0018\u00010\tH\u0007¢\u0006\u0002\b\u001bJ\r\u0010\u000f\u001a\u00020\u0010H\u0007¢\u0006\u0002\b\u001cJ\u0010\u0010\u001d\u001a\u0004\u0018\u00010\u00052\u0006\u0010\u001e\u001a\u00020\u0005J\r\u0010\u0006\u001a\u00020\u0007H\u0007¢\u0006\u0002\b\u001fJ\u0014\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\u00050 2\u0006\u0010\u001e\u001a\u00020\u0005J\r\u0010\u0004\u001a\u00020\u0005H\u0007¢\u0006\u0002\b!J\u0006\u0010\"\u001a\u00020#J\b\u0010$\u001a\u0004\u0018\u00010\u0001J#\u0010$\u001a\u0004\u0018\u0001H%\"\u0004\b\u0000\u0010%2\u000e\u0010&\u001a\n\u0012\u0006\b\u0001\u0012\u0002H%0\\u0006\u0002\u0010'J\b\u0010(\u001a\u00020\u0005H\u0016J\r\u0010\u0002\u001a\u00020\u0003H\u0007¢\u0006\u0002\b)R\u0015\u0010\b\u001a\u0004\u0018\u00010\t8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\u000eR\u0011\u0010\u000f\u001a\u00020\u00108G¢\u0006\u0006\u001a\u0004\b\u000f\u0010\u0011R\u0013\u0010\u0006\u001a\u00020\u00078\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0012R\u0011\u0010\u0013\u001a\u00020\u00148F¢\u0006\u0006\u001a\u0004\b\u0013\u0010\u0015R\u0010\u0010\u0016\u001a\u0004\u0018\u00010\u0010X\u0082\u000e¢\u0006\u0002\n\u0000R\u0013\u0010\u0004\u001a\u00020\u00058\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0004\u0010\u0017R$\u0010\n\u001a\u0012\u0012\b\u0012\u0006\u0012\u0002\b\u00030\f\u0012\u0004\u0012\u00020\u00010\u000bX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0018\u0010\u0019R\u0013\u0010\u0002\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\u001a¨\u0006+"}, m238d2 = {"Lokhttp3/Request;", "", ImagesContract.URL, "Lokhttp3/HttpUrl;", "method", "", "headers", "Lokhttp3/Headers;", "body", "Lokhttp3/RequestBody;", "tags", "", "Ljava/lang/Class;", "(Lokhttp3/HttpUrl;Ljava/lang/String;Lokhttp3/Headers;Lokhttp3/RequestBody;Ljava/util/Map;)V", "()Lokhttp3/RequestBody;", "cacheControl", "Lokhttp3/CacheControl;", "()Lokhttp3/CacheControl;", "()Lokhttp3/Headers;", "isHttps", "", "()Z", "lazyCacheControl", "()Ljava/lang/String;", "getTags$okhttp", "()Ljava/util/Map;", "()Lokhttp3/HttpUrl;", "-deprecated_body", "-deprecated_cacheControl", "header", "name", "-deprecated_headers", "", "-deprecated_method", "newBuilder", "Lokhttp3/Request$Builder;", "tag", "T", "type", "(Ljava/lang/Class;)Ljava/lang/Object;", "toString", "-deprecated_url", "Builder", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Request {
private final RequestBody body;
private final Headers headers;
private CacheControl lazyCacheControl;
private final String method;
private final Map<Class<?>, Object> tags;
private final HttpUrl url;
public Request(HttpUrl url, String method, Headers headers, RequestBody body, Map<Class<?>, ? extends Object> tags) {
Intrinsics.checkNotNullParameter(url, "url");
Intrinsics.checkNotNullParameter(method, "method");
Intrinsics.checkNotNullParameter(headers, "headers");
Intrinsics.checkNotNullParameter(tags, "tags");
this.url = url;
this.method = method;
this.headers = headers;
this.body = body;
this.tags = tags;
}
public final HttpUrl url() {
return this.url;
}
public final String method() {
return this.method;
}
public final Headers headers() {
return this.headers;
}
public final RequestBody body() {
return this.body;
}
public final Map<Class<?>, Object> getTags$okhttp() {
return this.tags;
}
public final boolean isHttps() {
return this.url.getIsHttps();
}
public final String header(String name) {
Intrinsics.checkNotNullParameter(name, "name");
return this.headers.get(name);
}
public final List<String> headers(String name) {
Intrinsics.checkNotNullParameter(name, "name");
return this.headers.values(name);
}
public final Object tag() {
return tag(Object.class);
}
public final <T> T tag(Class<? extends T> type) {
Intrinsics.checkNotNullParameter(type, "type");
return type.cast(this.tags.get(type));
}
public final Builder newBuilder() {
return new Builder(this);
}
public final CacheControl cacheControl() {
CacheControl result = this.lazyCacheControl;
if (result == null) {
CacheControl result2 = CacheControl.INSTANCE.parse(this.headers);
this.lazyCacheControl = result2;
return result2;
}
return result;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = ImagesContract.URL, imports = {}))
/* renamed from: -deprecated_url, reason: not valid java name and from getter */
public final HttpUrl getUrl() {
return this.url;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "method", imports = {}))
/* renamed from: -deprecated_method, reason: not valid java name and from getter */
public final String getMethod() {
return this.method;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "headers", imports = {}))
/* renamed from: -deprecated_headers, reason: not valid java name and from getter */
public final Headers getHeaders() {
return this.headers;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "body", imports = {}))
/* renamed from: -deprecated_body, reason: not valid java name and from getter */
public final RequestBody getBody() {
return this.body;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "cacheControl", imports = {}))
/* renamed from: -deprecated_cacheControl, reason: not valid java name */
public final CacheControl m1721deprecated_cacheControl() {
return cacheControl();
}
public String toString() {
StringBuilder $this$buildString = new StringBuilder();
$this$buildString.append("Request{method=");
$this$buildString.append(this.method);
$this$buildString.append(", url=");
$this$buildString.append(this.url);
if (this.headers.size() != 0) {
$this$buildString.append(", headers=[");
Iterable $this$forEachIndexed$iv = this.headers;
int index = 0;
for (Pair item$iv : $this$forEachIndexed$iv) {
int index$iv = index + 1;
if (index < 0) {
CollectionsKt.throwIndexOverflow();
}
Pair $dstr$name$value = item$iv;
String name = $dstr$name$value.component1();
String value = $dstr$name$value.component2();
if (index > 0) {
$this$buildString.append(", ");
}
$this$buildString.append(name);
$this$buildString.append(':');
$this$buildString.append(value);
index = index$iv;
}
$this$buildString.append(']');
}
if (!this.tags.isEmpty()) {
$this$buildString.append(", tags=");
$this$buildString.append(this.tags);
}
$this$buildString.append('}');
String sb = $this$buildString.toString();
Intrinsics.checkNotNullExpressionValue(sb, "StringBuilder().apply(builderAction).toString()");
return sb;
}
/* compiled from: Request.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000V\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000e\n\u0002\b\u0005\n\u0002\u0010%\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0000\b\u0016\u0018\u00002\u00020\u0001B\u0007\b\u0016¢\u0006\u0002\u0010\u0002B\u000f\b\u0010\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005J\u0018\u0010%\u001a\u00020\u00002\u0006\u0010&\u001a\u00020\u00132\u0006\u0010'\u001a\u00020\u0013H\u0016J\b\u0010(\u001a\u00020\u0004H\u0016J\u0010\u0010)\u001a\u00020\u00002\u0006\u0010)\u001a\u00020*H\u0016J\u0014\u0010+\u001a\u00020\u00002\n\b\u0002\u0010\u0006\u001a\u0004\u0018\u00010\u0007H\u0017J\b\u0010,\u001a\u00020\u0000H\u0016J\b\u0010-\u001a\u00020\u0000H\u0016J\u0018\u0010.\u001a\u00020\u00002\u0006\u0010&\u001a\u00020\u00132\u0006\u0010'\u001a\u00020\u0013H\u0016J\u0010\u0010\f\u001a\u00020\u00002\u0006\u0010\f\u001a\u00020/H\u0016J\u001a\u0010\u0012\u001a\u00020\u00002\u0006\u0010\u0012\u001a\u00020\u00132\b\u0010\u0006\u001a\u0004\u0018\u00010\u0007H\u0016J\u0010\u00100\u001a\u00020\u00002\u0006\u0010\u0006\u001a\u00020\u0007H\u0016J\u0010\u00101\u001a\u00020\u00002\u0006\u0010\u0006\u001a\u00020\u0007H\u0016J\u0010\u00102\u001a\u00020\u00002\u0006\u0010\u0006\u001a\u00020\u0007H\u0016J\u0010\u00103\u001a\u00020\u00002\u0006\u0010&\u001a\u00020\u0013H\u0016J-\u00104\u001a\u00020\u0000\"\u0004\b\u0000\u001052\u000e\u00106\u001a\n\u0012\u0006\b\u0000\u0012\u0002H50\u001a2\b\u00104\u001a\u0004\u0018\u0001H5H\u0016¢\u0006\u0002\u00107J\u0012\u00104\u001a\u00020\u00002\b\u00104\u001a\u0004\u0018\u00010\u0001H\u0016J\u0010\u0010\u001f\u001a\u00020\u00002\u0006\u0010\u001f\u001a\u000208H\u0016J\u0010\u0010\u001f\u001a\u00020\u00002\u0006\u0010\u001f\u001a\u00020\u0013H\u0016J\u0010\u0010\u001f\u001a\u00020\u00002\u0006\u0010\u001f\u001a\u00020 H\u0016R\u001c\u0010\u0006\u001a\u0004\u0018\u00010\u0007X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\b\u0010\t\"\u0004\b\n\u0010\u000bR\u001a\u0010\f\u001a\u00020\rX\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000e\u0010\u000f\"\u0004\b\u0010\u0010\u0011R\u001a\u0010\u0012\u001a\u00020\u0013X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0014\u0010\u0015\"\u0004\b\u0016\u0010\u0017R*\u0010\u0018\u001a\u0012\u0012\b\u0012\u0006\u0012\u0002\b\u00030\u001a\u0012\u0004\u0012\u00020\u00010\u0019X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001b\u0010\u001c\"\u0004\b\u001d\u0010\u001eR\u001c\u0010\u001f\u001a\u0004\u0018\u00010 X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b!\u0010\"\"\u0004\b#\u0010$¨\u00069"}, m238d2 = {"Lokhttp3/Request$Builder;", "", "()V", "request", "Lokhttp3/Request;", "(Lokhttp3/Request;)V", "body", "Lokhttp3/RequestBody;", "getBody$okhttp", "()Lokhttp3/RequestBody;", "setBody$okhttp", "(Lokhttp3/RequestBody;)V", "headers", "Lokhttp3/Headers$Builder;", "getHeaders$okhttp", "()Lokhttp3/Headers$Builder;", "setHeaders$okhttp", "(Lokhttp3/Headers$Builder;)V", "method", "", "getMethod$okhttp", "()Ljava/lang/String;", "setMethod$okhttp", "(Ljava/lang/String;)V", "tags", "", "Ljava/lang/Class;", "getTags$okhttp", "()Ljava/util/Map;", "setTags$okhttp", "(Ljava/util/Map;)V", ImagesContract.URL, "Lokhttp3/HttpUrl;", "getUrl$okhttp", "()Lokhttp3/HttpUrl;", "setUrl$okhttp", "(Lokhttp3/HttpUrl;)V", "addHeader", "name", "value", "build", "cacheControl", "Lokhttp3/CacheControl;", "delete", "get", "head", "header", "Lokhttp3/Headers;", "patch", "post", "put", "removeHeader", "tag", "T", "type", "(Ljava/lang/Class;Ljava/lang/Object;)Lokhttp3/Request$Builder;", "Ljava/net/URL;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static class Builder {
private RequestBody body;
private Headers.Builder headers;
private String method;
private Map<Class<?>, Object> tags;
private HttpUrl url;
public final Builder delete() {
return delete$default(this, null, 1, null);
}
/* renamed from: getUrl$okhttp, reason: from getter */
public final HttpUrl getUrl() {
return this.url;
}
public final void setUrl$okhttp(HttpUrl httpUrl) {
this.url = httpUrl;
}
/* renamed from: getMethod$okhttp, reason: from getter */
public final String getMethod() {
return this.method;
}
public final void setMethod$okhttp(String str) {
Intrinsics.checkNotNullParameter(str, "<set-?>");
this.method = str;
}
/* renamed from: getHeaders$okhttp, reason: from getter */
public final Headers.Builder getHeaders() {
return this.headers;
}
public final void setHeaders$okhttp(Headers.Builder builder) {
Intrinsics.checkNotNullParameter(builder, "<set-?>");
this.headers = builder;
}
/* renamed from: getBody$okhttp, reason: from getter */
public final RequestBody getBody() {
return this.body;
}
public final void setBody$okhttp(RequestBody requestBody) {
this.body = requestBody;
}
public final Map<Class<?>, Object> getTags$okhttp() {
return this.tags;
}
public final void setTags$okhttp(Map<Class<?>, Object> map) {
Intrinsics.checkNotNullParameter(map, "<set-?>");
this.tags = map;
}
public Builder() {
this.tags = new LinkedHashMap();
this.method = "GET";
this.headers = new Headers.Builder();
}
public Builder(Request request) {
LinkedHashMap mutableMap;
Intrinsics.checkNotNullParameter(request, "request");
this.tags = new LinkedHashMap();
this.url = request.url();
this.method = request.method();
this.body = request.body();
if (request.getTags$okhttp().isEmpty()) {
mutableMap = new LinkedHashMap();
} else {
mutableMap = MapsKt.toMutableMap(request.getTags$okhttp());
}
this.tags = mutableMap;
this.headers = request.headers().newBuilder();
}
public Builder url(HttpUrl url) {
Intrinsics.checkNotNullParameter(url, "url");
Builder $this$apply = this;
$this$apply.url = url;
return this;
}
public Builder url(String url) {
String finalUrl;
Intrinsics.checkNotNullParameter(url, "url");
if (StringsKt.startsWith(url, "ws:", true)) {
StringBuilder sb = new StringBuilder();
sb.append("http:");
String substring = url.substring(3);
Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.String).substring(startIndex)");
sb.append(substring);
finalUrl = sb.toString();
} else if (StringsKt.startsWith(url, "wss:", true)) {
StringBuilder sb2 = new StringBuilder();
sb2.append("https:");
String substring2 = url.substring(4);
Intrinsics.checkNotNullExpressionValue(substring2, "(this as java.lang.String).substring(startIndex)");
sb2.append(substring2);
finalUrl = sb2.toString();
} else {
finalUrl = url;
}
return url(HttpUrl.INSTANCE.get(finalUrl));
}
public Builder url(URL url) {
Intrinsics.checkNotNullParameter(url, "url");
HttpUrl.Companion companion = HttpUrl.INSTANCE;
String url2 = url.toString();
Intrinsics.checkNotNullExpressionValue(url2, "url.toString()");
return url(companion.get(url2));
}
public Builder header(String name, String value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
Builder $this$apply = this;
$this$apply.headers.set(name, value);
return this;
}
public Builder addHeader(String name, String value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
Builder $this$apply = this;
$this$apply.headers.add(name, value);
return this;
}
public Builder removeHeader(String name) {
Intrinsics.checkNotNullParameter(name, "name");
Builder $this$apply = this;
$this$apply.headers.removeAll(name);
return this;
}
public Builder headers(Headers headers) {
Intrinsics.checkNotNullParameter(headers, "headers");
Builder $this$apply = this;
$this$apply.headers = headers.newBuilder();
return this;
}
public Builder cacheControl(CacheControl cacheControl) {
Intrinsics.checkNotNullParameter(cacheControl, "cacheControl");
String value = cacheControl.toString();
return value.length() == 0 ? removeHeader(HttpHeaders.CACHE_CONTROL) : header(HttpHeaders.CACHE_CONTROL, value);
}
public Builder get() {
return method("GET", null);
}
public Builder head() {
return method("HEAD", null);
}
public Builder post(RequestBody body) {
Intrinsics.checkNotNullParameter(body, "body");
return method("POST", body);
}
public static /* synthetic */ Builder delete$default(Builder builder, RequestBody requestBody, int i, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: delete");
}
if ((i & 1) != 0) {
requestBody = Util.EMPTY_REQUEST;
}
return builder.delete(requestBody);
}
public Builder delete(RequestBody body) {
return method("DELETE", body);
}
public Builder put(RequestBody body) {
Intrinsics.checkNotNullParameter(body, "body");
return method("PUT", body);
}
public Builder patch(RequestBody body) {
Intrinsics.checkNotNullParameter(body, "body");
return method("PATCH", body);
}
public Builder method(String method, RequestBody body) {
Intrinsics.checkNotNullParameter(method, "method");
Builder $this$apply = this;
if (!(method.length() > 0)) {
throw new IllegalArgumentException("method.isEmpty() == true".toString());
}
if (body == null) {
if (!(true ^ HttpMethod.requiresRequestBody(method))) {
throw new IllegalArgumentException(("method " + method + " must have a request body.").toString());
}
} else if (!HttpMethod.permitsRequestBody(method)) {
throw new IllegalArgumentException(("method " + method + " must not have a request body.").toString());
}
$this$apply.method = method;
$this$apply.body = body;
return this;
}
public Builder tag(Object tag) {
return tag(Object.class, tag);
}
public <T> Builder tag(Class<? super T> type, T tag) {
Intrinsics.checkNotNullParameter(type, "type");
Builder $this$apply = this;
if (tag == null) {
$this$apply.tags.remove(type);
} else {
if ($this$apply.tags.isEmpty()) {
$this$apply.tags = new LinkedHashMap();
}
Map<Class<?>, Object> map = $this$apply.tags;
T cast = type.cast(tag);
Intrinsics.checkNotNull(cast);
map.put(type, cast);
}
return this;
}
public Request build() {
HttpUrl httpUrl = this.url;
if (httpUrl != null) {
return new Request(httpUrl, this.method, this.headers.build(), this.body, Util.toImmutableMap(this.tags));
}
throw new IllegalStateException("url == null".toString());
}
}
}
@@ -0,0 +1,322 @@
package okhttp3;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.io.CloseableKt;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import okhttp3.internal.Util;
import okio.BufferedSink;
import okio.ByteString;
import okio.Okio;
import okio.Source;
/* compiled from: RequestBody.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b&\u0018\u0000 \u000e2\u00020\u0001:\u0001\u000eB\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0003\u001a\u00020\u0004H\u0016J\n\u0010\u0005\u001a\u0004\u0018\u00010\u0006H&J\b\u0010\u0007\u001a\u00020\bH\u0016J\b\u0010\t\u001a\u00020\bH\u0016J\u0010\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\rH&¨\u0006\u000f"}, m238d2 = {"Lokhttp3/RequestBody;", "", "()V", "contentLength", "", "contentType", "Lokhttp3/MediaType;", "isDuplex", "", "isOneShot", "writeTo", "", "sink", "Lokio/BufferedSink;", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public abstract class RequestBody {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
@JvmStatic
public static final RequestBody create(File file, MediaType mediaType) {
return INSTANCE.create(file, mediaType);
}
@JvmStatic
public static final RequestBody create(String str, MediaType mediaType) {
return INSTANCE.create(str, mediaType);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'file' argument first to fix Java", replaceWith = @ReplaceWith(expression = "file.asRequestBody(contentType)", imports = {"okhttp3.RequestBody.Companion.asRequestBody"}))
@JvmStatic
public static final RequestBody create(MediaType mediaType, File file) {
return INSTANCE.create(mediaType, file);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
@JvmStatic
public static final RequestBody create(MediaType mediaType, String str) {
return INSTANCE.create(mediaType, str);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
@JvmStatic
public static final RequestBody create(MediaType mediaType, ByteString byteString) {
return INSTANCE.create(mediaType, byteString);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType, offset, byteCount)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
@JvmStatic
public static final RequestBody create(MediaType mediaType, byte[] bArr) {
return Companion.create$default(INSTANCE, mediaType, bArr, 0, 0, 12, (Object) null);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType, offset, byteCount)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
@JvmStatic
public static final RequestBody create(MediaType mediaType, byte[] bArr, int i) {
return Companion.create$default(INSTANCE, mediaType, bArr, i, 0, 8, (Object) null);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType, offset, byteCount)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
@JvmStatic
public static final RequestBody create(MediaType mediaType, byte[] bArr, int i, int i2) {
return INSTANCE.create(mediaType, bArr, i, i2);
}
@JvmStatic
public static final RequestBody create(ByteString byteString, MediaType mediaType) {
return INSTANCE.create(byteString, mediaType);
}
@JvmStatic
public static final RequestBody create(byte[] bArr) {
return Companion.create$default(INSTANCE, bArr, (MediaType) null, 0, 0, 7, (Object) null);
}
@JvmStatic
public static final RequestBody create(byte[] bArr, MediaType mediaType) {
return Companion.create$default(INSTANCE, bArr, mediaType, 0, 0, 6, (Object) null);
}
@JvmStatic
public static final RequestBody create(byte[] bArr, MediaType mediaType, int i) {
return Companion.create$default(INSTANCE, bArr, mediaType, i, 0, 4, (Object) null);
}
@JvmStatic
public static final RequestBody create(byte[] bArr, MediaType mediaType, int i, int i2) {
return INSTANCE.create(bArr, mediaType, i, i2);
}
/* renamed from: contentType */
public abstract MediaType get$contentType();
public abstract void writeTo(BufferedSink sink) throws IOException;
public long contentLength() throws IOException {
return -1L;
}
public boolean isDuplex() {
return false;
}
public boolean isOneShot() {
return false;
}
/* compiled from: RequestBody.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0012\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u001a\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0007J.\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\t\u001a\u00020\n2\b\b\u0002\u0010\u000b\u001a\u00020\f2\b\b\u0002\u0010\r\u001a\u00020\fH\u0007J\u001a\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\t\u001a\u00020\u000eH\u0007J\u001a\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\t\u001a\u00020\u000fH\u0007J\u001d\u0010\u0010\u001a\u00020\u0004*\u00020\b2\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0006H\u0007¢\u0006\u0002\b\u0003J1\u0010\u0011\u001a\u00020\u0004*\u00020\n2\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u00062\b\b\u0002\u0010\u000b\u001a\u00020\f2\b\b\u0002\u0010\r\u001a\u00020\fH\u0007¢\u0006\u0002\b\u0003J\u001d\u0010\u0011\u001a\u00020\u0004*\u00020\u000e2\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0006H\u0007¢\u0006\u0002\b\u0003J\u001d\u0010\u0011\u001a\u00020\u0004*\u00020\u000f2\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0006H\u0007¢\u0006\u0002\b\u0003¨\u0006\u0012"}, m238d2 = {"Lokhttp3/RequestBody$Companion;", "", "()V", "create", "Lokhttp3/RequestBody;", "contentType", "Lokhttp3/MediaType;", "file", "Ljava/io/File;", "content", "", TypedValues.Cycle.S_WAVE_OFFSET, "", "byteCount", "", "Lokio/ByteString;", "asRequestBody", "toRequestBody", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType, offset, byteCount)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
@JvmStatic
public final RequestBody create(MediaType mediaType, byte[] bArr) {
return create$default(this, mediaType, bArr, 0, 0, 12, (Object) null);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType, offset, byteCount)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
@JvmStatic
public final RequestBody create(MediaType mediaType, byte[] bArr, int i) {
return create$default(this, mediaType, bArr, i, 0, 8, (Object) null);
}
@JvmStatic
public final RequestBody create(byte[] bArr) {
return create$default(this, bArr, (MediaType) null, 0, 0, 7, (Object) null);
}
@JvmStatic
public final RequestBody create(byte[] bArr, MediaType mediaType) {
return create$default(this, bArr, mediaType, 0, 0, 6, (Object) null);
}
@JvmStatic
public final RequestBody create(byte[] bArr, MediaType mediaType, int i) {
return create$default(this, bArr, mediaType, i, 0, 4, (Object) null);
}
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public static /* synthetic */ RequestBody create$default(Companion companion, String str, MediaType mediaType, int i, Object obj) {
if ((i & 1) != 0) {
mediaType = null;
}
return companion.create(str, mediaType);
}
@JvmStatic
public final RequestBody create(String toRequestBody, MediaType contentType) {
Intrinsics.checkNotNullParameter(toRequestBody, "$this$toRequestBody");
Charset charset = Charsets.UTF_8;
MediaType finalContentType = contentType;
if (contentType != null) {
Charset resolvedCharset = MediaType.charset$default(contentType, null, 1, null);
if (resolvedCharset == null) {
charset = Charsets.UTF_8;
finalContentType = MediaType.INSTANCE.parse(contentType + "; charset=utf-8");
} else {
charset = resolvedCharset;
}
}
byte[] bytes = toRequestBody.getBytes(charset);
Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
return create(bytes, finalContentType, 0, bytes.length);
}
public static /* synthetic */ RequestBody create$default(Companion companion, ByteString byteString, MediaType mediaType, int i, Object obj) {
if ((i & 1) != 0) {
mediaType = null;
}
return companion.create(byteString, mediaType);
}
@JvmStatic
public final RequestBody create(final ByteString toRequestBody, final MediaType contentType) {
Intrinsics.checkNotNullParameter(toRequestBody, "$this$toRequestBody");
return new RequestBody() { // from class: okhttp3.RequestBody$Companion$toRequestBody$1
@Override // okhttp3.RequestBody
/* renamed from: contentType, reason: from getter */
public MediaType get$contentType() {
return contentType;
}
@Override // okhttp3.RequestBody
public long contentLength() {
return ByteString.this.size();
}
@Override // okhttp3.RequestBody
public void writeTo(BufferedSink sink) {
Intrinsics.checkNotNullParameter(sink, "sink");
sink.write(ByteString.this);
}
};
}
public static /* synthetic */ RequestBody create$default(Companion companion, byte[] bArr, MediaType mediaType, int i, int i2, int i3, Object obj) {
if ((i3 & 1) != 0) {
mediaType = null;
}
if ((i3 & 2) != 0) {
i = 0;
}
if ((i3 & 4) != 0) {
i2 = bArr.length;
}
return companion.create(bArr, mediaType, i, i2);
}
@JvmStatic
public final RequestBody create(final byte[] toRequestBody, final MediaType contentType, final int offset, final int byteCount) {
Intrinsics.checkNotNullParameter(toRequestBody, "$this$toRequestBody");
Util.checkOffsetAndCount(toRequestBody.length, offset, byteCount);
return new RequestBody() { // from class: okhttp3.RequestBody$Companion$toRequestBody$2
@Override // okhttp3.RequestBody
/* renamed from: contentType, reason: from getter */
public MediaType get$contentType() {
return contentType;
}
@Override // okhttp3.RequestBody
public long contentLength() {
return byteCount;
}
@Override // okhttp3.RequestBody
public void writeTo(BufferedSink sink) {
Intrinsics.checkNotNullParameter(sink, "sink");
sink.write(toRequestBody, offset, byteCount);
}
};
}
public static /* synthetic */ RequestBody create$default(Companion companion, File file, MediaType mediaType, int i, Object obj) {
if ((i & 1) != 0) {
mediaType = null;
}
return companion.create(file, mediaType);
}
@JvmStatic
public final RequestBody create(final File asRequestBody, final MediaType contentType) {
Intrinsics.checkNotNullParameter(asRequestBody, "$this$asRequestBody");
return new RequestBody() { // from class: okhttp3.RequestBody$Companion$asRequestBody$1
@Override // okhttp3.RequestBody
/* renamed from: contentType, reason: from getter */
public MediaType get$contentType() {
return contentType;
}
@Override // okhttp3.RequestBody
public long contentLength() {
return asRequestBody.length();
}
@Override // okhttp3.RequestBody
public void writeTo(BufferedSink sink) {
Intrinsics.checkNotNullParameter(sink, "sink");
Source source = Okio.source(asRequestBody);
try {
Source source2 = source;
sink.writeAll(source2);
CloseableKt.closeFinally(source, null);
} finally {
}
}
};
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
@JvmStatic
public final RequestBody create(MediaType contentType, String content) {
Intrinsics.checkNotNullParameter(content, "content");
return create(content, contentType);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
@JvmStatic
public final RequestBody create(MediaType contentType, ByteString content) {
Intrinsics.checkNotNullParameter(content, "content");
return create(content, contentType);
}
public static /* synthetic */ RequestBody create$default(Companion companion, MediaType mediaType, byte[] bArr, int i, int i2, int i3, Object obj) {
if ((i3 & 4) != 0) {
i = 0;
}
if ((i3 & 8) != 0) {
i2 = bArr.length;
}
return companion.create(mediaType, bArr, i, i2);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toRequestBody(contentType, offset, byteCount)", imports = {"okhttp3.RequestBody.Companion.toRequestBody"}))
@JvmStatic
public final RequestBody create(MediaType contentType, byte[] content, int offset, int byteCount) {
Intrinsics.checkNotNullParameter(content, "content");
return create(content, contentType, offset, byteCount);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'file' argument first to fix Java", replaceWith = @ReplaceWith(expression = "file.asRequestBody(contentType)", imports = {"okhttp3.RequestBody.Companion.asRequestBody"}))
@JvmStatic
public final RequestBody create(MediaType contentType, File file) {
Intrinsics.checkNotNullParameter(file, "file");
return create(file, contentType);
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,349 @@
package okhttp3;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.Charset;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.io.CloseableKt;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.InlineMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import okhttp3.internal.Util;
import okio.Buffer;
import okio.BufferedSource;
import okio.ByteString;
/* compiled from: ResponseBody.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000b\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0012\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\b&\u0018\u0000 !2\u00020\u0001:\u0002 !B\u0005¢\u0006\u0002\u0010\u0002J\u0006\u0010\u0005\u001a\u00020\u0006J\u0006\u0010\u0007\u001a\u00020\bJ\u0006\u0010\t\u001a\u00020\nJ\u0006\u0010\u000b\u001a\u00020\u0004J\b\u0010\f\u001a\u00020\rH\u0002J\b\u0010\u000e\u001a\u00020\u000fH\u0016J@\u0010\u0010\u001a\u0002H\u0011\"\b\b\u0000\u0010\u0011*\u00020\u00122\u0012\u0010\u0013\u001a\u000e\u0012\u0004\u0012\u00020\u0015\u0012\u0004\u0012\u0002H\u00110\u00142\u0012\u0010\u0016\u001a\u000e\u0012\u0004\u0012\u0002H\u0011\u0012\u0004\u0012\u00020\u00170\u0014H\u0082\\u0006\u0002\u0010\u0018J\b\u0010\u0019\u001a\u00020\u001aH&J\n\u0010\u001b\u001a\u0004\u0018\u00010\u001cH&J\b\u0010\u001d\u001a\u00020\u0015H&J\u0006\u0010\u001e\u001a\u00020\u001fR\u0010\u0010\u0003\u001a\u0004\u0018\u00010\u0004X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\""}, m238d2 = {"Lokhttp3/ResponseBody;", "Ljava/io/Closeable;", "()V", "reader", "Ljava/io/Reader;", "byteStream", "Ljava/io/InputStream;", "byteString", "Lokio/ByteString;", "bytes", "", "charStream", "charset", "Ljava/nio/charset/Charset;", "close", "", "consumeSource", "T", "", "consumer", "Lkotlin/Function1;", "Lokio/BufferedSource;", "sizeMapper", "", "(Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;", "contentLength", "", "contentType", "Lokhttp3/MediaType;", "source", TypedValues.Custom.S_STRING, "", "BomAwareReader", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public abstract class ResponseBody implements Closeable {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private Reader reader;
@JvmStatic
public static final ResponseBody create(String str, MediaType mediaType) {
return INSTANCE.create(str, mediaType);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.asResponseBody(contentType, contentLength)", imports = {"okhttp3.ResponseBody.Companion.asResponseBody"}))
@JvmStatic
public static final ResponseBody create(MediaType mediaType, long j, BufferedSource bufferedSource) {
return INSTANCE.create(mediaType, j, bufferedSource);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toResponseBody(contentType)", imports = {"okhttp3.ResponseBody.Companion.toResponseBody"}))
@JvmStatic
public static final ResponseBody create(MediaType mediaType, String str) {
return INSTANCE.create(mediaType, str);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toResponseBody(contentType)", imports = {"okhttp3.ResponseBody.Companion.toResponseBody"}))
@JvmStatic
public static final ResponseBody create(MediaType mediaType, ByteString byteString) {
return INSTANCE.create(mediaType, byteString);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toResponseBody(contentType)", imports = {"okhttp3.ResponseBody.Companion.toResponseBody"}))
@JvmStatic
public static final ResponseBody create(MediaType mediaType, byte[] bArr) {
return INSTANCE.create(mediaType, bArr);
}
@JvmStatic
public static final ResponseBody create(BufferedSource bufferedSource, MediaType mediaType, long j) {
return INSTANCE.create(bufferedSource, mediaType, j);
}
@JvmStatic
public static final ResponseBody create(ByteString byteString, MediaType mediaType) {
return INSTANCE.create(byteString, mediaType);
}
@JvmStatic
public static final ResponseBody create(byte[] bArr, MediaType mediaType) {
return INSTANCE.create(bArr, mediaType);
}
/* renamed from: contentLength */
public abstract long get$contentLength();
/* renamed from: contentType */
public abstract MediaType get$contentType();
/* renamed from: source */
public abstract BufferedSource get$this_asResponseBody();
public final InputStream byteStream() {
return get$this_asResponseBody().inputStream();
}
public final byte[] bytes() throws IOException {
long contentLength$iv = get$contentLength();
if (contentLength$iv > Integer.MAX_VALUE) {
throw new IOException("Cannot buffer entire body for content length: " + contentLength$iv);
}
BufferedSource bufferedSource = get$this_asResponseBody();
try {
BufferedSource p1 = bufferedSource;
byte[] readByteArray = p1.readByteArray();
CloseableKt.closeFinally(bufferedSource, null);
int size$iv = readByteArray.length;
if (contentLength$iv == -1 || contentLength$iv == size$iv) {
return readByteArray;
}
throw new IOException("Content-Length (" + contentLength$iv + ") and stream length (" + size$iv + ") disagree");
} finally {
}
}
public final ByteString byteString() throws IOException {
long contentLength$iv = get$contentLength();
if (contentLength$iv > Integer.MAX_VALUE) {
throw new IOException("Cannot buffer entire body for content length: " + contentLength$iv);
}
BufferedSource bufferedSource = get$this_asResponseBody();
try {
BufferedSource p1 = bufferedSource;
ByteString readByteString = p1.readByteString();
CloseableKt.closeFinally(bufferedSource, null);
int size$iv = readByteString.size();
if (contentLength$iv == -1 || contentLength$iv == size$iv) {
return readByteString;
}
throw new IOException("Content-Length (" + contentLength$iv + ") and stream length (" + size$iv + ") disagree");
} finally {
}
}
/* JADX WARN: Type inference failed for: r6v1, types: [T, java.lang.Object] */
private final <T> T consumeSource(Function1<? super BufferedSource, ? extends T> consumer, Function1<? super T, Integer> sizeMapper) {
long j = get$contentLength();
if (j > Integer.MAX_VALUE) {
throw new IOException("Cannot buffer entire body for content length: " + j);
}
BufferedSource bufferedSource = get$this_asResponseBody();
try {
T invoke = consumer.invoke(bufferedSource);
InlineMarker.finallyStart(1);
CloseableKt.closeFinally(bufferedSource, null);
InlineMarker.finallyEnd(1);
int intValue = sizeMapper.invoke(invoke).intValue();
if (j == -1 || j == intValue) {
return invoke;
}
throw new IOException("Content-Length (" + j + ") and stream length (" + intValue + ") disagree");
} finally {
}
}
public final Reader charStream() {
Reader reader = this.reader;
if (reader == null) {
BomAwareReader it = new BomAwareReader(get$this_asResponseBody(), charset());
this.reader = it;
return it;
}
return reader;
}
public final String string() throws IOException {
BufferedSource bufferedSource = get$this_asResponseBody();
try {
BufferedSource source = bufferedSource;
String readString = source.readString(Util.readBomAsCharset(source, charset()));
CloseableKt.closeFinally(bufferedSource, null);
return readString;
} finally {
}
}
private final Charset charset() {
Charset charset;
MediaType mediaType = get$contentType();
return (mediaType == null || (charset = mediaType.charset(Charsets.UTF_8)) == null) ? Charsets.UTF_8 : charset;
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public void close() {
Util.closeQuietly(get$this_asResponseBody());
}
/* compiled from: ResponseBody.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0019\n\u0002\b\u0003\b\u0000\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\b\u0010\n\u001a\u00020\u000bH\u0016J \u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\r2\u0006\u0010\u0011\u001a\u00020\rH\u0016R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\t\u001a\u0004\u0018\u00010\u0001X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0012"}, m238d2 = {"Lokhttp3/ResponseBody$BomAwareReader;", "Ljava/io/Reader;", "source", "Lokio/BufferedSource;", "charset", "Ljava/nio/charset/Charset;", "(Lokio/BufferedSource;Ljava/nio/charset/Charset;)V", "closed", "", "delegate", "close", "", "read", "", "cbuf", "", "off", "len", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class BomAwareReader extends Reader {
private final Charset charset;
private boolean closed;
private Reader delegate;
private final BufferedSource source;
public BomAwareReader(BufferedSource source, Charset charset) {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(charset, "charset");
this.source = source;
this.charset = charset;
}
@Override // java.io.Reader
public int read(char[] cbuf, int off, int len) throws IOException {
Intrinsics.checkNotNullParameter(cbuf, "cbuf");
if (this.closed) {
throw new IOException("Stream closed");
}
InputStreamReader finalDelegate = this.delegate;
if (finalDelegate == null) {
InputStreamReader it = new InputStreamReader(this.source.inputStream(), Util.readBomAsCharset(this.source, this.charset));
this.delegate = it;
finalDelegate = it;
}
return finalDelegate.read(cbuf, off, len);
}
@Override // java.io.Reader, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
this.closed = true;
Reader reader = this.delegate;
if (reader == null) {
BomAwareReader $this$run = this;
$this$run.source.close();
} else {
reader.close();
}
}
}
/* compiled from: ResponseBody.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0012\n\u0000\n\u0002\u0010\t\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u001a\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0007J\"\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\t\u001a\u00020\n2\u0006\u0010\u0007\u001a\u00020\u000bH\u0007J\u001a\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\u0007\u001a\u00020\fH\u0007J\u001a\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\u0007\u001a\u00020\rH\u0007J'\u0010\u000e\u001a\u00020\u0004*\u00020\u000b2\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u00062\b\b\u0002\u0010\t\u001a\u00020\nH\u0007¢\u0006\u0002\b\u0003J\u001d\u0010\u000f\u001a\u00020\u0004*\u00020\b2\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0006H\u0007¢\u0006\u0002\b\u0003J\u001d\u0010\u000f\u001a\u00020\u0004*\u00020\f2\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0006H\u0007¢\u0006\u0002\b\u0003J\u001d\u0010\u000f\u001a\u00020\u0004*\u00020\r2\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0006H\u0007¢\u0006\u0002\b\u0003¨\u0006\u0010"}, m238d2 = {"Lokhttp3/ResponseBody$Companion;", "", "()V", "create", "Lokhttp3/ResponseBody;", "contentType", "Lokhttp3/MediaType;", "content", "", "contentLength", "", "Lokio/BufferedSource;", "", "Lokio/ByteString;", "asResponseBody", "toResponseBody", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public static /* synthetic */ ResponseBody create$default(Companion companion, String str, MediaType mediaType, int i, Object obj) {
if ((i & 1) != 0) {
mediaType = null;
}
return companion.create(str, mediaType);
}
@JvmStatic
public final ResponseBody create(String toResponseBody, MediaType contentType) {
Intrinsics.checkNotNullParameter(toResponseBody, "$this$toResponseBody");
Charset charset = Charsets.UTF_8;
MediaType finalContentType = contentType;
if (contentType != null) {
Charset resolvedCharset = MediaType.charset$default(contentType, null, 1, null);
if (resolvedCharset == null) {
charset = Charsets.UTF_8;
finalContentType = MediaType.INSTANCE.parse(contentType + "; charset=utf-8");
} else {
charset = resolvedCharset;
}
}
Buffer buffer = new Buffer().writeString(toResponseBody, charset);
return create(buffer, finalContentType, buffer.size());
}
public static /* synthetic */ ResponseBody create$default(Companion companion, byte[] bArr, MediaType mediaType, int i, Object obj) {
if ((i & 1) != 0) {
mediaType = null;
}
return companion.create(bArr, mediaType);
}
@JvmStatic
public final ResponseBody create(byte[] toResponseBody, MediaType contentType) {
Intrinsics.checkNotNullParameter(toResponseBody, "$this$toResponseBody");
return create(new Buffer().write(toResponseBody), contentType, toResponseBody.length);
}
public static /* synthetic */ ResponseBody create$default(Companion companion, ByteString byteString, MediaType mediaType, int i, Object obj) {
if ((i & 1) != 0) {
mediaType = null;
}
return companion.create(byteString, mediaType);
}
@JvmStatic
public final ResponseBody create(ByteString toResponseBody, MediaType contentType) {
Intrinsics.checkNotNullParameter(toResponseBody, "$this$toResponseBody");
return create(new Buffer().write(toResponseBody), contentType, toResponseBody.size());
}
public static /* synthetic */ ResponseBody create$default(Companion companion, BufferedSource bufferedSource, MediaType mediaType, long j, int i, Object obj) {
if ((i & 1) != 0) {
mediaType = null;
}
if ((i & 2) != 0) {
j = -1;
}
return companion.create(bufferedSource, mediaType, j);
}
@JvmStatic
public final ResponseBody create(final BufferedSource asResponseBody, final MediaType contentType, final long contentLength) {
Intrinsics.checkNotNullParameter(asResponseBody, "$this$asResponseBody");
return new ResponseBody() { // from class: okhttp3.ResponseBody$Companion$asResponseBody$1
@Override // okhttp3.ResponseBody
/* renamed from: contentType, reason: from getter */
public MediaType get$contentType() {
return contentType;
}
@Override // okhttp3.ResponseBody
/* renamed from: contentLength, reason: from getter */
public long get$contentLength() {
return contentLength;
}
@Override // okhttp3.ResponseBody
/* renamed from: source, reason: from getter */
public BufferedSource get$this_asResponseBody() {
return BufferedSource.this;
}
};
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toResponseBody(contentType)", imports = {"okhttp3.ResponseBody.Companion.toResponseBody"}))
@JvmStatic
public final ResponseBody create(MediaType contentType, String content) {
Intrinsics.checkNotNullParameter(content, "content");
return create(content, contentType);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toResponseBody(contentType)", imports = {"okhttp3.ResponseBody.Companion.toResponseBody"}))
@JvmStatic
public final ResponseBody create(MediaType contentType, byte[] content) {
Intrinsics.checkNotNullParameter(content, "content");
return create(content, contentType);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.toResponseBody(contentType)", imports = {"okhttp3.ResponseBody.Companion.toResponseBody"}))
@JvmStatic
public final ResponseBody create(MediaType contentType, ByteString content) {
Intrinsics.checkNotNullParameter(content, "content");
return create(content, contentType);
}
@Deprecated(level = DeprecationLevel.WARNING, message = "Moved to extension function. Put the 'content' argument first to fix Java", replaceWith = @ReplaceWith(expression = "content.asResponseBody(contentType, contentLength)", imports = {"okhttp3.ResponseBody.Companion.asResponseBody"}))
@JvmStatic
public final ResponseBody create(MediaType contentType, long contentLength, BufferedSource content) {
Intrinsics.checkNotNullParameter(content, "content");
return create(content, contentType, contentLength);
}
}
}
@@ -0,0 +1,74 @@
package okhttp3;
import java.net.InetSocketAddress;
import java.net.Proxy;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: Route.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0010\u000e\n\u0000\u0018\u00002\u00020\u0001B\u001d\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007¢\u0006\u0002\u0010\bJ\r\u0010\u0002\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\fJ\u0013\u0010\r\u001a\u00020\u000e2\b\u0010\u000f\u001a\u0004\u0018\u00010\u0001H\u0096\u0002J\b\u0010\u0010\u001a\u00020\u0011H\u0016J\r\u0010\u0004\u001a\u00020\u0005H\u0007¢\u0006\u0002\b\u0012J\u0006\u0010\u0013\u001a\u00020\u000eJ\r\u0010\u0006\u001a\u00020\u0007H\u0007¢\u0006\u0002\b\u0014J\b\u0010\u0015\u001a\u00020\u0016H\u0016R\u0013\u0010\u0002\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\tR\u0013\u0010\u0004\u001a\u00020\u00058\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0004\u0010\nR\u0013\u0010\u0006\u001a\u00020\u00078\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u000b¨\u0006\u0017"}, m238d2 = {"Lokhttp3/Route;", "", "address", "Lokhttp3/Address;", "proxy", "Ljava/net/Proxy;", "socketAddress", "Ljava/net/InetSocketAddress;", "(Lokhttp3/Address;Ljava/net/Proxy;Ljava/net/InetSocketAddress;)V", "()Lokhttp3/Address;", "()Ljava/net/Proxy;", "()Ljava/net/InetSocketAddress;", "-deprecated_address", "equals", "", "other", "hashCode", "", "-deprecated_proxy", "requiresTunnel", "-deprecated_socketAddress", "toString", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Route {
private final Address address;
private final Proxy proxy;
private final InetSocketAddress socketAddress;
public Route(Address address, Proxy proxy, InetSocketAddress socketAddress) {
Intrinsics.checkNotNullParameter(address, "address");
Intrinsics.checkNotNullParameter(proxy, "proxy");
Intrinsics.checkNotNullParameter(socketAddress, "socketAddress");
this.address = address;
this.proxy = proxy;
this.socketAddress = socketAddress;
}
public final Address address() {
return this.address;
}
public final Proxy proxy() {
return this.proxy;
}
public final InetSocketAddress socketAddress() {
return this.socketAddress;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "address", imports = {}))
/* renamed from: -deprecated_address, reason: not valid java name and from getter */
public final Address getAddress() {
return this.address;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "proxy", imports = {}))
/* renamed from: -deprecated_proxy, reason: not valid java name and from getter */
public final Proxy getProxy() {
return this.proxy;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "socketAddress", imports = {}))
/* renamed from: -deprecated_socketAddress, reason: not valid java name and from getter */
public final InetSocketAddress getSocketAddress() {
return this.socketAddress;
}
public final boolean requiresTunnel() {
return this.address.sslSocketFactory() != null && this.proxy.type() == Proxy.Type.HTTP;
}
public boolean equals(Object other) {
return (other instanceof Route) && Intrinsics.areEqual(((Route) other).address, this.address) && Intrinsics.areEqual(((Route) other).proxy, this.proxy) && Intrinsics.areEqual(((Route) other).socketAddress, this.socketAddress);
}
public int hashCode() {
int result = (17 * 31) + this.address.hashCode();
return (((result * 31) + this.proxy.hashCode()) * 31) + this.socketAddress.hashCode();
}
public String toString() {
return "Route{" + this.socketAddress + '}';
}
}
@@ -0,0 +1,89 @@
package okhttp3;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: TlsVersion.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0000\n\u0002\u0010\u000e\n\u0002\b\n\b\u0086\u0001\u0018\u0000 \f2\b\u0012\u0004\u0012\u00020\u00000\u0001:\u0001\fB\u000f\b\u0002\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\r\u0010\u0002\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u0006R\u0013\u0010\u0002\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\u0005j\u0002\b\u0007j\u0002\b\bj\u0002\b\tj\u0002\b\nj\u0002\b\u000b¨\u0006\r"}, m238d2 = {"Lokhttp3/TlsVersion;", "", "javaName", "", "(Ljava/lang/String;ILjava/lang/String;)V", "()Ljava/lang/String;", "-deprecated_javaName", "TLS_1_3", "TLS_1_2", "TLS_1_1", "TLS_1_0", "SSL_3_0", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public enum TlsVersion {
TLS_1_3("TLSv1.3"),
TLS_1_2("TLSv1.2"),
TLS_1_1("TLSv1.1"),
TLS_1_0("TLSv1"),
SSL_3_0("SSLv3");
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private final String javaName;
@JvmStatic
public static final TlsVersion forJavaName(String str) {
return INSTANCE.forJavaName(str);
}
TlsVersion(String javaName) {
this.javaName = javaName;
}
public final String javaName() {
return this.javaName;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "javaName", imports = {}))
/* renamed from: -deprecated_javaName, reason: not valid java name and from getter */
public final String getJavaName() {
return this.javaName;
}
/* compiled from: TlsVersion.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0007¨\u0006\u0007"}, m238d2 = {"Lokhttp3/TlsVersion$Companion;", "", "()V", "forJavaName", "Lokhttp3/TlsVersion;", "javaName", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
/* JADX WARN: Failed to restore switch over string. Please report as a decompilation issue */
@JvmStatic
public final TlsVersion forJavaName(String javaName) {
Intrinsics.checkNotNullParameter(javaName, "javaName");
switch (javaName.hashCode()) {
case -503070503:
if (javaName.equals("TLSv1.1")) {
return TlsVersion.TLS_1_1;
}
break;
case -503070502:
if (javaName.equals("TLSv1.2")) {
return TlsVersion.TLS_1_2;
}
break;
case -503070501:
if (javaName.equals("TLSv1.3")) {
return TlsVersion.TLS_1_3;
}
break;
case 79201641:
if (javaName.equals("SSLv3")) {
return TlsVersion.SSL_3_0;
}
break;
case 79923350:
if (javaName.equals("TLSv1")) {
return TlsVersion.TLS_1_0;
}
break;
}
throw new IllegalArgumentException("Unexpected TLS version: " + javaName);
}
}
}
@@ -0,0 +1,29 @@
package okhttp3;
import com.google.android.gms.common.internal.ServiceSpecificExtraArgs;
import kotlin.Metadata;
import okio.ByteString;
/* compiled from: WebSocket.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\bf\u0018\u00002\u00020\u0001:\u0001\u0012J\b\u0010\u0002\u001a\u00020\u0003H&J\u001a\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u00072\b\u0010\b\u001a\u0004\u0018\u00010\tH&J\b\u0010\n\u001a\u00020\u000bH&J\b\u0010\f\u001a\u00020\rH&J\u0010\u0010\u000e\u001a\u00020\u00052\u0006\u0010\u000f\u001a\u00020\tH&J\u0010\u0010\u000e\u001a\u00020\u00052\u0006\u0010\u0010\u001a\u00020\u0011H&¨\u0006\u0013"}, m238d2 = {"Lokhttp3/WebSocket;", "", "cancel", "", "close", "", "code", "", "reason", "", "queueSize", "", "request", "Lokhttp3/Request;", "send", "text", "bytes", "Lokio/ByteString;", "Factory", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public interface WebSocket {
/* compiled from: WebSocket.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\\u0080\u0001\u0018\u00002\u00020\u0001J\u0018\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u0007H&¨\u0006\b"}, m238d2 = {"Lokhttp3/WebSocket$Factory;", "", "newWebSocket", "Lokhttp3/WebSocket;", "request", "Lokhttp3/Request;", ServiceSpecificExtraArgs.CastExtraArgs.LISTENER, "Lokhttp3/WebSocketListener;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public interface Factory {
WebSocket newWebSocket(Request request, WebSocketListener listener);
}
void cancel();
boolean close(int code, String reason);
long queueSize();
Request request();
boolean send(String text);
boolean send(ByteString bytes);
}
@@ -0,0 +1,40 @@
package okhttp3;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okio.ByteString;
/* compiled from: WebSocketListener.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000<\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u0003\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\b&\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J \u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\nH\u0016J \u0010\u000b\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\nH\u0016J\"\u0010\f\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\r\u001a\u00020\u000e2\b\u0010\u000f\u001a\u0004\u0018\u00010\u0010H\u0016J\u0018\u0010\u0011\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0012\u001a\u00020\nH\u0016J\u0018\u0010\u0011\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0013\u001a\u00020\u0014H\u0016J\u0018\u0010\u0015\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u000f\u001a\u00020\u0010H\u0016¨\u0006\u0016"}, m238d2 = {"Lokhttp3/WebSocketListener;", "", "()V", "onClosed", "", "webSocket", "Lokhttp3/WebSocket;", "code", "", "reason", "", "onClosing", "onFailure", "t", "", "response", "Lokhttp3/Response;", "onMessage", "text", "bytes", "Lokio/ByteString;", "onOpen", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public abstract class WebSocketListener {
public void onOpen(WebSocket webSocket, Response response) {
Intrinsics.checkNotNullParameter(webSocket, "webSocket");
Intrinsics.checkNotNullParameter(response, "response");
}
public void onMessage(WebSocket webSocket, String text) {
Intrinsics.checkNotNullParameter(webSocket, "webSocket");
Intrinsics.checkNotNullParameter(text, "text");
}
public void onMessage(WebSocket webSocket, ByteString bytes) {
Intrinsics.checkNotNullParameter(webSocket, "webSocket");
Intrinsics.checkNotNullParameter(bytes, "bytes");
}
public void onClosing(WebSocket webSocket, int code, String reason) {
Intrinsics.checkNotNullParameter(webSocket, "webSocket");
Intrinsics.checkNotNullParameter(reason, "reason");
}
public void onClosed(WebSocket webSocket, int code, String reason) {
Intrinsics.checkNotNullParameter(webSocket, "webSocket");
Intrinsics.checkNotNullParameter(reason, "reason");
}
public void onFailure(WebSocket webSocket, Throwable t, Response response) {
Intrinsics.checkNotNullParameter(webSocket, "webSocket");
Intrinsics.checkNotNullParameter(t, "t");
}
}
@@ -0,0 +1,264 @@
package okhttp3.internal;
import java.net.IDN;
import java.net.InetAddress;
import java.util.Locale;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import okio.Buffer;
/* compiled from: hostnames.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000&\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u0012\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\u001a0\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u00052\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\u0005H\u0002\u001a\"\u0010\n\u001a\u0004\u0018\u00010\u000b2\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u0005H\u0002\u001a\u0010\u0010\f\u001a\u00020\u00032\u0006\u0010\u0007\u001a\u00020\bH\u0002\u001a\f\u0010\r\u001a\u00020\u0001*\u00020\u0003H\u0002\u001a\f\u0010\u000e\u001a\u0004\u0018\u00010\u0003*\u00020\u0003¨\u0006\u000f"}, m238d2 = {"decodeIpv4Suffix", "", "input", "", "pos", "", "limit", "address", "", "addressOffset", "decodeIpv6", "Ljava/net/InetAddress;", "inet6AddressToAscii", "containsInvalidHostnameAsciiCodes", "toCanonicalHost", "okhttp"}, m239k = 2, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class HostnamesKt {
public static final String toCanonicalHost(String toCanonicalHost) {
Intrinsics.checkNotNullParameter(toCanonicalHost, "$this$toCanonicalHost");
if (StringsKt.contains$default((CharSequence) toCanonicalHost, (CharSequence) ":", false, 2, (Object) null)) {
InetAddress inetAddress = (StringsKt.startsWith$default(toCanonicalHost, "[", false, 2, (Object) null) && StringsKt.endsWith$default(toCanonicalHost, "]", false, 2, (Object) null)) ? decodeIpv6(toCanonicalHost, 1, toCanonicalHost.length() - 1) : decodeIpv6(toCanonicalHost, 0, toCanonicalHost.length());
if (inetAddress == null) {
return null;
}
byte[] address = inetAddress.getAddress();
if (address.length == 16) {
Intrinsics.checkNotNullExpressionValue(address, "address");
return inet6AddressToAscii(address);
}
if (address.length == 4) {
return inetAddress.getHostAddress();
}
throw new AssertionError("Invalid IPv6 address: '" + toCanonicalHost + '\'');
}
try {
String ascii = IDN.toASCII(toCanonicalHost);
Intrinsics.checkNotNullExpressionValue(ascii, "IDN.toASCII(host)");
Locale locale = Locale.US;
Intrinsics.checkNotNullExpressionValue(locale, "Locale.US");
if (ascii == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
String result = ascii.toLowerCase(locale);
Intrinsics.checkNotNullExpressionValue(result, "(this as java.lang.String).toLowerCase(locale)");
if (!(result.length() == 0) && !containsInvalidHostnameAsciiCodes(result)) {
return result;
}
return null;
} catch (IllegalArgumentException e) {
return null;
}
}
private static final boolean containsInvalidHostnameAsciiCodes(String $this$containsInvalidHostnameAsciiCodes) {
int length = $this$containsInvalidHostnameAsciiCodes.length();
for (int i = 0; i < length; i++) {
char c = $this$containsInvalidHostnameAsciiCodes.charAt(i);
if (Intrinsics.compare((int) c, 31) <= 0 || Intrinsics.compare((int) c, 127) >= 0 || StringsKt.indexOf$default((CharSequence) " #%/:?@[\\]", c, 0, false, 6, (Object) null) != -1) {
return true;
}
}
return false;
}
/* JADX WARN: Code restructure failed: missing block: B:25:0x008d, code lost:
return null;
*/
/* JADX WARN: Removed duplicated region for block: B:15:0x0060 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static final java.net.InetAddress decodeIpv6(java.lang.String r13, int r14, int r15) {
/*
r0 = 16
byte[] r0 = new byte[r0]
r1 = 0
r2 = -1
r3 = -1
r4 = r14
r10 = r4
L9:
r11 = -1
r12 = 0
if (r10 >= r15) goto L8e
int r4 = r0.length
if (r1 != r4) goto L11
return r12
L11:
int r4 = r10 + 2
if (r4 > r15) goto L2e
r7 = 0
r8 = 4
r9 = 0
java.lang.String r5 = "::"
r4 = r13
r6 = r10
boolean r4 = kotlin.text.StringsKt.startsWith$default(r4, r5, r6, r7, r8, r9)
if (r4 == 0) goto L2e
if (r2 == r11) goto L25
return r12
L25:
int r10 = r10 + 2
int r1 = r1 + 2
r2 = r1
if (r10 != r15) goto L5a
goto L8e
L2e:
if (r1 == 0) goto L5a
r7 = 0
r8 = 4
r9 = 0
java.lang.String r5 = ":"
r4 = r13
r6 = r10
boolean r4 = kotlin.text.StringsKt.startsWith$default(r4, r5, r6, r7, r8, r9)
if (r4 == 0) goto L40
int r10 = r10 + 1
goto L5a
L40:
r7 = 0
r8 = 4
r9 = 0
java.lang.String r5 = "."
r4 = r13
r6 = r10
boolean r4 = kotlin.text.StringsKt.startsWith$default(r4, r5, r6, r7, r8, r9)
if (r4 == 0) goto L59
int r4 = r1 + (-2)
boolean r4 = decodeIpv4Suffix(r13, r3, r15, r0, r4)
if (r4 != 0) goto L56
return r12
L56:
int r1 = r1 + 2
goto L8e
L59:
return r12
L5a:
r4 = 0
r3 = r10
L5e:
if (r10 >= r15) goto L73
char r5 = r13.charAt(r10)
int r5 = okhttp3.internal.Util.parseHexDigit(r5)
if (r5 != r11) goto L6b
goto L73
L6b:
int r6 = r4 << 4
int r4 = r6 + r5
int r10 = r10 + 1
goto L5e
L73:
int r5 = r10 - r3
if (r5 == 0) goto L8d
r6 = 4
if (r5 <= r6) goto L7b
goto L8d
L7b:
int r6 = r1 + 1
int r7 = r4 >>> 8
r7 = r7 & 255(0xff, float:3.57E-43)
byte r7 = (byte) r7
r0[r1] = r7
int r1 = r6 + 1
r7 = r4 & 255(0xff, float:3.57E-43)
byte r7 = (byte) r7
r0[r6] = r7
goto L9
L8d:
return r12
L8e:
int r4 = r0.length
if (r1 == r4) goto La5
if (r2 != r11) goto L94
return r12
L94:
int r4 = r0.length
int r5 = r1 - r2
int r4 = r4 - r5
int r5 = r1 - r2
java.lang.System.arraycopy(r0, r2, r0, r4, r5)
int r4 = r0.length
int r4 = r4 - r1
int r4 = r4 + r2
r5 = 0
byte r5 = (byte) r5
java.util.Arrays.fill(r0, r2, r4, r5)
La5:
java.net.InetAddress r4 = java.net.InetAddress.getByAddress(r0)
return r4
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.HostnamesKt.decodeIpv6(java.lang.String, int, int):java.net.InetAddress");
}
private static final boolean decodeIpv4Suffix(String input, int pos, int limit, byte[] address, int addressOffset) {
int b = addressOffset;
int i = pos;
while (i < limit) {
if (b == address.length) {
return false;
}
if (b != addressOffset) {
if (input.charAt(i) != '.') {
return false;
}
i++;
}
int value = 0;
int groupOffset = i;
while (i < limit) {
char c = input.charAt(i);
if (Intrinsics.compare((int) c, 48) < 0 || Intrinsics.compare((int) c, 57) > 0) {
break;
}
if ((value == 0 && groupOffset != i) || ((value * 10) + c) - 48 > 255) {
return false;
}
i++;
}
int groupLength = i - groupOffset;
if (groupLength == 0) {
return false;
}
address[b] = (byte) value;
b++;
}
return b == addressOffset + 4;
}
private static final String inet6AddressToAscii(byte[] address) {
int longestRunOffset = -1;
int longestRunLength = 0;
int i = 0;
while (i < address.length) {
int currentRunOffset = i;
while (i < 16 && address[i] == 0 && address[i + 1] == 0) {
i += 2;
}
int currentRunLength = i - currentRunOffset;
if (currentRunLength > longestRunLength && currentRunLength >= 4) {
longestRunOffset = currentRunOffset;
longestRunLength = currentRunLength;
}
i += 2;
}
Buffer result = new Buffer();
int i2 = 0;
while (i2 < address.length) {
if (i2 == longestRunOffset) {
result.writeByte(58);
i2 += longestRunLength;
if (i2 == 16) {
result.writeByte(58);
}
} else {
if (i2 > 0) {
result.writeByte(58);
}
int group = (Util.and(address[i2], 255) << 8) | Util.and(address[i2 + 1], 255);
result.writeHexadecimalUnsignedLong(group);
i2 += 2;
}
}
return result.readUtf8();
}
}
@@ -0,0 +1,54 @@
package okhttp3.internal;
import com.google.android.gms.common.internal.ImagesContract;
import javax.net.ssl.SSLSocket;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.Cache;
import okhttp3.ConnectionSpec;
import okhttp3.Cookie;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.Request;
import okhttp3.Response;
/* compiled from: internal.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000T\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a\u0016\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00012\u0006\u0010\u0003\u001a\u00020\u0004\u001a\u001e\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00012\u0006\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0006\u001a\u00020\u0004\u001a\u001e\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000e\u001a\u0018\u0010\u000f\u001a\u0004\u0018\u00010\u00102\u0006\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00020\u0014\u001a\u0016\u0010\u0015\u001a\u00020\u00042\u0006\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u0018\u001a\u00020\u000e\u001a \u0010\u0019\u001a\u0004\u0018\u00010\u00172\u0006\u0010\u001a\u001a\u00020\u001b2\u0006\u0010\u001c\u001a\u00020\u001d2\u0006\u0010\u001e\u001a\u00020\u0004¨\u0006\u001f"}, m238d2 = {"addHeaderLenient", "Lokhttp3/Headers$Builder;", "builder", "line", "", "name", "value", "applyConnectionSpec", "", "connectionSpec", "Lokhttp3/ConnectionSpec;", "sslSocket", "Ljavax/net/ssl/SSLSocket;", "isFallback", "", "cacheGet", "Lokhttp3/Response;", "cache", "Lokhttp3/Cache;", "request", "Lokhttp3/Request;", "cookieToString", "cookie", "Lokhttp3/Cookie;", "forObsoleteRfc2965", "parseCookie", "currentTimeMillis", "", ImagesContract.URL, "Lokhttp3/HttpUrl;", "setCookie", "okhttp"}, m239k = 2, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Internal {
public static final Cookie parseCookie(long currentTimeMillis, HttpUrl url, String setCookie) {
Intrinsics.checkNotNullParameter(url, "url");
Intrinsics.checkNotNullParameter(setCookie, "setCookie");
return Cookie.INSTANCE.parse$okhttp(currentTimeMillis, url, setCookie);
}
public static final String cookieToString(Cookie cookie, boolean forObsoleteRfc2965) {
Intrinsics.checkNotNullParameter(cookie, "cookie");
return cookie.toString$okhttp(forObsoleteRfc2965);
}
public static final Headers.Builder addHeaderLenient(Headers.Builder builder, String line) {
Intrinsics.checkNotNullParameter(builder, "builder");
Intrinsics.checkNotNullParameter(line, "line");
return builder.addLenient$okhttp(line);
}
public static final Headers.Builder addHeaderLenient(Headers.Builder builder, String name, String value) {
Intrinsics.checkNotNullParameter(builder, "builder");
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
return builder.addLenient$okhttp(name, value);
}
public static final Response cacheGet(Cache cache, Request request) {
Intrinsics.checkNotNullParameter(cache, "cache");
Intrinsics.checkNotNullParameter(request, "request");
return cache.get$okhttp(request);
}
public static final void applyConnectionSpec(ConnectionSpec connectionSpec, SSLSocket sslSocket, boolean isFallback) {
Intrinsics.checkNotNullParameter(connectionSpec, "connectionSpec");
Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
connectionSpec.apply$okhttp(sslSocket, isFallback);
}
}
@@ -0,0 +1,21 @@
package okhttp3.internal;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import kotlin.Metadata;
import kotlin.annotation.AnnotationRetention;
import kotlin.annotation.AnnotationTarget;
/* compiled from: SuppressSignatureCheck.kt */
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR})
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u001b\n\u0000\b\u0087\u0002\u0018\u00002\u00020\u0001B\u0000¨\u0006\u0002"}, m238d2 = {"Lokhttp3/internal/SuppressSignatureCheck;", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CONSTRUCTOR, AnnotationTarget.CLASS, AnnotationTarget.FUNCTION})
@Documented
@Retention(RetentionPolicy.CLASS)
@kotlin.annotation.Retention(AnnotationRetention.BINARY)
/* loaded from: classes11.dex */
public @interface SuppressSignatureCheck {
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,122 @@
package okhttp3.internal.authenticator;
import com.google.android.gms.common.internal.ImagesContract;
import com.google.common.net.HttpHeaders;
import java.io.IOException;
import java.net.Authenticator;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;
import java.net.Proxy;
import java.net.SocketAddress;
import java.util.List;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import okhttp3.Address;
import okhttp3.Authenticator;
import okhttp3.Challenge;
import okhttp3.Credentials;
import okhttp3.Dns;
import okhttp3.HttpUrl;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.Route;
/* compiled from: JavaNetAuthenticator.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0018\u00002\u00020\u0001B\u000f\u0012\b\b\u0002\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\u001c\u0010\u0005\u001a\u0004\u0018\u00010\u00062\b\u0010\u0007\u001a\u0004\u0018\u00010\b2\u0006\u0010\t\u001a\u00020\nH\u0016J\u001c\u0010\u000b\u001a\u00020\f*\u00020\r2\u0006\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u0003H\u0002R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0011"}, m238d2 = {"Lokhttp3/internal/authenticator/JavaNetAuthenticator;", "Lokhttp3/Authenticator;", "defaultDns", "Lokhttp3/Dns;", "(Lokhttp3/Dns;)V", "authenticate", "Lokhttp3/Request;", "route", "Lokhttp3/Route;", "response", "Lokhttp3/Response;", "connectToInetAddress", "Ljava/net/InetAddress;", "Ljava/net/Proxy;", ImagesContract.URL, "Lokhttp3/HttpUrl;", "dns", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class JavaNetAuthenticator implements Authenticator {
private final Dns defaultDns;
@Metadata(m236bv = {1, 0, 3}, m239k = 3, m240mv = {1, 4, 0})
public final /* synthetic */ class WhenMappings {
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
static {
int[] iArr = new int[Proxy.Type.values().length];
$EnumSwitchMapping$0 = iArr;
iArr[Proxy.Type.DIRECT.ordinal()] = 1;
}
}
/* JADX WARN: Multi-variable type inference failed */
public JavaNetAuthenticator() {
this(null, 1, 0 == true ? 1 : 0);
}
public JavaNetAuthenticator(Dns defaultDns) {
Intrinsics.checkNotNullParameter(defaultDns, "defaultDns");
this.defaultDns = defaultDns;
}
public /* synthetic */ JavaNetAuthenticator(Dns dns, int i, DefaultConstructorMarker defaultConstructorMarker) {
this((i & 1) != 0 ? Dns.SYSTEM : dns);
}
@Override // okhttp3.Authenticator
public Request authenticate(Route route, Response response) throws IOException {
Proxy proxy;
Dns dns;
PasswordAuthentication auth;
Address address;
Intrinsics.checkNotNullParameter(response, "response");
List challenges = response.challenges();
Request request = response.request();
HttpUrl url = request.url();
boolean proxyAuthorization = response.code() == 407;
if (route == null || (proxy = route.proxy()) == null) {
proxy = Proxy.NO_PROXY;
}
for (Challenge challenge : challenges) {
if (StringsKt.equals("Basic", challenge.scheme(), true)) {
if (route == null || (address = route.address()) == null || (dns = address.dns()) == null) {
dns = this.defaultDns;
}
if (proxyAuthorization) {
SocketAddress address2 = proxy.address();
if (address2 == null) {
throw new NullPointerException("null cannot be cast to non-null type java.net.InetSocketAddress");
}
InetSocketAddress proxyAddress = (InetSocketAddress) address2;
String hostName = proxyAddress.getHostName();
Intrinsics.checkNotNullExpressionValue(proxy, "proxy");
auth = java.net.Authenticator.requestPasswordAuthentication(hostName, connectToInetAddress(proxy, url, dns), proxyAddress.getPort(), url.scheme(), challenge.realm(), challenge.scheme(), url.url(), Authenticator.RequestorType.PROXY);
} else {
String host = url.host();
Intrinsics.checkNotNullExpressionValue(proxy, "proxy");
auth = java.net.Authenticator.requestPasswordAuthentication(host, connectToInetAddress(proxy, url, dns), url.port(), url.scheme(), challenge.realm(), challenge.scheme(), url.url(), Authenticator.RequestorType.SERVER);
}
if (auth != null) {
String credentialHeader = proxyAuthorization ? HttpHeaders.PROXY_AUTHORIZATION : HttpHeaders.AUTHORIZATION;
String userName = auth.getUserName();
Intrinsics.checkNotNullExpressionValue(userName, "auth.userName");
char[] password = auth.getPassword();
Intrinsics.checkNotNullExpressionValue(password, "auth.password");
String credential = Credentials.basic(userName, new String(password), challenge.charset());
return request.newBuilder().header(credentialHeader, credential).build();
}
}
}
return null;
}
private final InetAddress connectToInetAddress(Proxy $this$connectToInetAddress, HttpUrl url, Dns dns) throws IOException {
Proxy.Type type = $this$connectToInetAddress.type();
if (type != null) {
switch (WhenMappings.$EnumSwitchMapping$0[type.ordinal()]) {
case 1:
return (InetAddress) CollectionsKt.first((List) dns.lookup(url.host()));
}
}
SocketAddress address = $this$connectToInetAddress.address();
if (address != null) {
InetAddress address2 = ((InetSocketAddress) address).getAddress();
Intrinsics.checkNotNullExpressionValue(address2, "(address() as InetSocketAddress).address");
return address2;
}
throw new NullPointerException("null cannot be cast to non-null type java.net.InetSocketAddress");
}
}
@@ -0,0 +1,246 @@
package okhttp3.internal.cache;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import okhttp3.Cache;
import okhttp3.Call;
import okhttp3.EventListener;
import okhttp3.Headers;
import okhttp3.Interceptor;
import okhttp3.Protocol;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.internal.Util;
import okhttp3.internal.cache.CacheStrategy;
import okhttp3.internal.connection.RealCall;
import okhttp3.internal.http.HttpHeaders;
import okhttp3.internal.http.HttpMethod;
import okhttp3.internal.http.RealResponseBody;
import okio.Buffer;
import okio.BufferedSink;
import okio.BufferedSource;
import okio.Okio;
import okio.Sink;
import okio.Source;
import okio.Timeout;
/* compiled from: CacheInterceptor.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\u0018\u0000 \u000f2\u00020\u0001:\u0001\u000fB\u000f\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003¢\u0006\u0002\u0010\u0004J\u001a\u0010\u0007\u001a\u00020\b2\b\u0010\t\u001a\u0004\u0018\u00010\n2\u0006\u0010\u000b\u001a\u00020\bH\u0002J\u0010\u0010\f\u001a\u00020\b2\u0006\u0010\r\u001a\u00020\u000eH\u0016R\u0016\u0010\u0002\u001a\u0004\u0018\u00010\u0003X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006¨\u0006\u0010"}, m238d2 = {"Lokhttp3/internal/cache/CacheInterceptor;", "Lokhttp3/Interceptor;", "cache", "Lokhttp3/Cache;", "(Lokhttp3/Cache;)V", "getCache$okhttp", "()Lokhttp3/Cache;", "cacheWritingResponse", "Lokhttp3/Response;", "cacheRequest", "Lokhttp3/internal/cache/CacheRequest;", "response", "intercept", "chain", "Lokhttp3/Interceptor$Chain;", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class CacheInterceptor implements Interceptor {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private final Cache cache;
public CacheInterceptor(Cache cache) {
this.cache = cache;
}
/* renamed from: getCache$okhttp, reason: from getter */
public final Cache getCache() {
return this.cache;
}
@Override // okhttp3.Interceptor
public Response intercept(Interceptor.Chain chain) throws IOException {
EventListener listener;
ResponseBody body;
ResponseBody body2;
Intrinsics.checkNotNullParameter(chain, "chain");
Call call = chain.call();
Cache cache = this.cache;
Response cacheCandidate = cache != null ? cache.get$okhttp(chain.request()) : null;
long now = System.currentTimeMillis();
CacheStrategy strategy = new CacheStrategy.Factory(now, chain.request(), cacheCandidate).compute();
Request networkRequest = strategy.getNetworkRequest();
Response cacheResponse = strategy.getCacheResponse();
Cache cache2 = this.cache;
if (cache2 != null) {
cache2.trackResponse$okhttp(strategy);
}
RealCall realCall = (RealCall) (!(call instanceof RealCall) ? null : call);
if (realCall == null || (listener = realCall.getEventListener()) == null) {
listener = EventListener.NONE;
}
if (cacheCandidate != null && cacheResponse == null && (body2 = cacheCandidate.body()) != null) {
Util.closeQuietly(body2);
}
if (networkRequest == null && cacheResponse == null) {
Response it = new Response.Builder().request(chain.request()).protocol(Protocol.HTTP_1_1).code(TypedValues.Position.TYPE_PERCENT_HEIGHT).message("Unsatisfiable Request (only-if-cached)").body(Util.EMPTY_RESPONSE).sentRequestAtMillis(-1L).receivedResponseAtMillis(System.currentTimeMillis()).build();
listener.satisfactionFailure(call, it);
return it;
}
if (networkRequest == null) {
Intrinsics.checkNotNull(cacheResponse);
Response it2 = cacheResponse.newBuilder().cacheResponse(INSTANCE.stripBody(cacheResponse)).build();
listener.cacheHit(call, it2);
return it2;
}
if (cacheResponse != null) {
listener.cacheConditionalHit(call, cacheResponse);
} else if (this.cache != null) {
listener.cacheMiss(call);
}
try {
Response networkResponse = chain.proceed(networkRequest);
if (networkResponse == null && cacheCandidate != null && body != null) {
}
if (cacheResponse != null) {
if (networkResponse != null && networkResponse.code() == 304) {
Response.Builder newBuilder = cacheResponse.newBuilder();
Companion companion = INSTANCE;
Response response = newBuilder.headers(companion.combine(cacheResponse.headers(), networkResponse.headers())).sentRequestAtMillis(networkResponse.sentRequestAtMillis()).receivedResponseAtMillis(networkResponse.receivedResponseAtMillis()).cacheResponse(companion.stripBody(cacheResponse)).networkResponse(companion.stripBody(networkResponse)).build();
ResponseBody body3 = networkResponse.body();
Intrinsics.checkNotNull(body3);
body3.close();
Cache cache3 = this.cache;
Intrinsics.checkNotNull(cache3);
cache3.trackConditionalCacheHit$okhttp();
this.cache.update$okhttp(cacheResponse, response);
listener.cacheHit(call, response);
return response;
}
ResponseBody body4 = cacheResponse.body();
if (body4 != null) {
Util.closeQuietly(body4);
}
}
Intrinsics.checkNotNull(networkResponse);
Response.Builder newBuilder2 = networkResponse.newBuilder();
Companion companion2 = INSTANCE;
Response response2 = newBuilder2.cacheResponse(companion2.stripBody(cacheResponse)).networkResponse(companion2.stripBody(networkResponse)).build();
if (this.cache != null) {
if (HttpHeaders.promisesBody(response2) && CacheStrategy.INSTANCE.isCacheable(response2, networkRequest)) {
CacheRequest cacheRequest = this.cache.put$okhttp(response2);
Response cacheWritingResponse = cacheWritingResponse(cacheRequest, response2);
if (cacheResponse != null) {
listener.cacheMiss(call);
}
return cacheWritingResponse;
}
if (HttpMethod.INSTANCE.invalidatesCache(networkRequest.method())) {
try {
this.cache.remove$okhttp(networkRequest);
} catch (IOException e) {
}
}
}
return response2;
} finally {
if (cacheCandidate != null && (body = cacheCandidate.body()) != null) {
Util.closeQuietly(body);
}
}
}
private final Response cacheWritingResponse(final CacheRequest cacheRequest, Response response) throws IOException {
if (cacheRequest == null) {
return response;
}
Sink cacheBodyUnbuffered = cacheRequest.getBody();
ResponseBody body = response.body();
Intrinsics.checkNotNull(body);
final BufferedSource source = body.getSource();
final BufferedSink cacheBody = Okio.buffer(cacheBodyUnbuffered);
Source source2 = new Source() { // from class: okhttp3.internal.cache.CacheInterceptor$cacheWritingResponse$cacheWritingSource$1
private boolean cacheRequestClosed;
@Override // okio.Source
public long read(Buffer sink, long byteCount) throws IOException {
Intrinsics.checkNotNullParameter(sink, "sink");
try {
long bytesRead = BufferedSource.this.read(sink, byteCount);
if (bytesRead == -1) {
if (!this.cacheRequestClosed) {
this.cacheRequestClosed = true;
cacheBody.close();
}
return -1L;
}
sink.copyTo(cacheBody.getBuffer(), sink.size() - bytesRead, bytesRead);
cacheBody.emitCompleteSegments();
return bytesRead;
} catch (IOException e) {
if (!this.cacheRequestClosed) {
this.cacheRequestClosed = true;
cacheRequest.abort();
}
throw e;
}
}
@Override // okio.Source
/* renamed from: timeout */
public Timeout getTimeout() {
return BufferedSource.this.getTimeout();
}
@Override // okio.Source, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
if (!this.cacheRequestClosed && !Util.discard(this, 100, TimeUnit.MILLISECONDS)) {
this.cacheRequestClosed = true;
cacheRequest.abort();
}
BufferedSource.this.close();
}
};
String contentType = Response.header$default(response, com.google.common.net.HttpHeaders.CONTENT_TYPE, null, 2, null);
long contentLength = response.body().getContentLength();
return response.newBuilder().body(new RealResponseBody(contentType, contentLength, Okio.buffer(source2))).build();
}
/* compiled from: CacheInterceptor.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0018\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0006\u001a\u00020\u0004H\u0002J\u0010\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\nH\u0002J\u0010\u0010\u000b\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\nH\u0002J\u0014\u0010\f\u001a\u0004\u0018\u00010\r2\b\u0010\u000e\u001a\u0004\u0018\u00010\rH\u0002¨\u0006\u000f"}, m238d2 = {"Lokhttp3/internal/cache/CacheInterceptor$Companion;", "", "()V", "combine", "Lokhttp3/Headers;", "cachedHeaders", "networkHeaders", "isContentSpecificHeader", "", "fieldName", "", "isEndToEnd", "stripBody", "Lokhttp3/Response;", "response", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
/* JADX INFO: Access modifiers changed from: private */
public final Response stripBody(Response response) {
if ((response != null ? response.body() : null) != null) {
return response.newBuilder().body(null).build();
}
return response;
}
/* JADX INFO: Access modifiers changed from: private */
public final Headers combine(Headers cachedHeaders, Headers networkHeaders) {
Headers.Builder result = new Headers.Builder();
int size = cachedHeaders.size();
for (int index = 0; index < size; index++) {
String fieldName = cachedHeaders.name(index);
String value = cachedHeaders.value(index);
if ((!StringsKt.equals(com.google.common.net.HttpHeaders.WARNING, fieldName, true) || !StringsKt.startsWith$default(value, "1", false, 2, (Object) null)) && (isContentSpecificHeader(fieldName) || !isEndToEnd(fieldName) || networkHeaders.get(fieldName) == null)) {
result.addLenient$okhttp(fieldName, value);
}
}
int size2 = networkHeaders.size();
for (int index2 = 0; index2 < size2; index2++) {
String fieldName2 = networkHeaders.name(index2);
if (!isContentSpecificHeader(fieldName2) && isEndToEnd(fieldName2)) {
result.addLenient$okhttp(fieldName2, networkHeaders.value(index2));
}
}
return result.build();
}
private final boolean isEndToEnd(String fieldName) {
return (StringsKt.equals(com.google.common.net.HttpHeaders.CONNECTION, fieldName, true) || StringsKt.equals("Keep-Alive", fieldName, true) || StringsKt.equals(com.google.common.net.HttpHeaders.PROXY_AUTHENTICATE, fieldName, true) || StringsKt.equals(com.google.common.net.HttpHeaders.PROXY_AUTHORIZATION, fieldName, true) || StringsKt.equals(com.google.common.net.HttpHeaders.f243TE, fieldName, true) || StringsKt.equals("Trailers", fieldName, true) || StringsKt.equals(com.google.common.net.HttpHeaders.TRANSFER_ENCODING, fieldName, true) || StringsKt.equals(com.google.common.net.HttpHeaders.UPGRADE, fieldName, true)) ? false : true;
}
private final boolean isContentSpecificHeader(String fieldName) {
return StringsKt.equals(com.google.common.net.HttpHeaders.CONTENT_LENGTH, fieldName, true) || StringsKt.equals(com.google.common.net.HttpHeaders.CONTENT_ENCODING, fieldName, true) || StringsKt.equals(com.google.common.net.HttpHeaders.CONTENT_TYPE, fieldName, true);
}
}
}
@@ -0,0 +1,14 @@
package okhttp3.internal.cache;
import java.io.IOException;
import kotlin.Metadata;
import okio.Sink;
/* compiled from: CacheRequest.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\bf\u0018\u00002\u00020\u0001J\b\u0010\u0002\u001a\u00020\u0003H&J\b\u0010\u0004\u001a\u00020\u0005H&¨\u0006\u0006"}, m238d2 = {"Lokhttp3/internal/cache/CacheRequest;", "", "abort", "", "body", "Lokio/Sink;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public interface CacheRequest {
void abort();
Sink body() throws IOException;
}
@@ -0,0 +1,254 @@
package okhttp3.internal.cache;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.recyclerview.widget.ItemTouchHelper;
import com.google.common.net.HttpHeaders;
import java.util.Date;
import java.util.concurrent.TimeUnit;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import okhttp3.CacheControl;
import okhttp3.Headers;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.internal.Util;
import okhttp3.internal.http.DatesKt;
/* compiled from: CacheStrategy.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\b\u0018\u0000 \u000b2\u00020\u0001:\u0002\u000b\fB\u001b\b\u0000\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\b\u0010\u0004\u001a\u0004\u0018\u00010\u0005¢\u0006\u0002\u0010\u0006R\u0013\u0010\u0004\u001a\u0004\u0018\u00010\u0005¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\bR\u0013\u0010\u0002\u001a\u0004\u0018\u00010\u0003¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\\u0006\r"}, m238d2 = {"Lokhttp3/internal/cache/CacheStrategy;", "", "networkRequest", "Lokhttp3/Request;", "cacheResponse", "Lokhttp3/Response;", "(Lokhttp3/Request;Lokhttp3/Response;)V", "getCacheResponse", "()Lokhttp3/Response;", "getNetworkRequest", "()Lokhttp3/Request;", "Companion", "Factory", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class CacheStrategy {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private final Response cacheResponse;
private final Request networkRequest;
public CacheStrategy(Request networkRequest, Response cacheResponse) {
this.networkRequest = networkRequest;
this.cacheResponse = cacheResponse;
}
public final Request getNetworkRequest() {
return this.networkRequest;
}
public final Response getCacheResponse() {
return this.cacheResponse;
}
/* compiled from: CacheStrategy.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000B\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0002\u0018\u00002\u00020\u0001B\u001f\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\b\u0010\u0006\u001a\u0004\u0018\u00010\u0007¢\u0006\u0002\u0010\bJ\b\u0010\u0017\u001a\u00020\u0003H\u0002J\u0006\u0010\u0018\u001a\u00020\u0019J\b\u0010\u001a\u001a\u00020\u0019H\u0002J\b\u0010\u001b\u001a\u00020\u0003H\u0002J\u0010\u0010\u001c\u001a\u00020\u001d2\u0006\u0010\u0004\u001a\u00020\u0005H\u0002J\b\u0010\u001e\u001a\u00020\u001dH\u0002R\u000e\u0010\t\u001a\u00020\nX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0006\u001a\u0004\u0018\u00010\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u000b\u001a\u0004\u0018\u00010\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\r\u001a\u0004\u0018\u00010\u000eX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u000f\u001a\u0004\u0018\u00010\u000eX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0010\u001a\u0004\u0018\u00010\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0003X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u0004\u001a\u00020\u0005X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0012\u0010\u0013R\u000e\u0010\u0014\u001a\u00020\u0003X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0015\u001a\u0004\u0018\u00010\u000eX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0016\u001a\u0004\u0018\u00010\fX\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u001f"}, m238d2 = {"Lokhttp3/internal/cache/CacheStrategy$Factory;", "", "nowMillis", "", "request", "Lokhttp3/Request;", "cacheResponse", "Lokhttp3/Response;", "(JLokhttp3/Request;Lokhttp3/Response;)V", "ageSeconds", "", "etag", "", "expires", "Ljava/util/Date;", "lastModified", "lastModifiedString", "receivedResponseMillis", "getRequest$okhttp", "()Lokhttp3/Request;", "sentRequestMillis", "servedDate", "servedDateString", "cacheResponseAge", "compute", "Lokhttp3/internal/cache/CacheStrategy;", "computeCandidate", "computeFreshnessLifetime", "hasConditions", "", "isFreshnessLifetimeHeuristic", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Factory {
private int ageSeconds;
private final Response cacheResponse;
private String etag;
private Date expires;
private Date lastModified;
private String lastModifiedString;
private final long nowMillis;
private long receivedResponseMillis;
private final Request request;
private long sentRequestMillis;
private Date servedDate;
private String servedDateString;
public Factory(long nowMillis, Request request, Response cacheResponse) {
Intrinsics.checkNotNullParameter(request, "request");
this.nowMillis = nowMillis;
this.request = request;
this.cacheResponse = cacheResponse;
this.ageSeconds = -1;
if (cacheResponse != null) {
this.sentRequestMillis = cacheResponse.sentRequestAtMillis();
this.receivedResponseMillis = cacheResponse.receivedResponseAtMillis();
Headers headers = cacheResponse.headers();
int size = headers.size();
for (int i = 0; i < size; i++) {
String fieldName = headers.name(i);
String value = headers.value(i);
if (StringsKt.equals(fieldName, HttpHeaders.DATE, true)) {
this.servedDate = DatesKt.toHttpDateOrNull(value);
this.servedDateString = value;
} else if (StringsKt.equals(fieldName, HttpHeaders.EXPIRES, true)) {
this.expires = DatesKt.toHttpDateOrNull(value);
} else if (StringsKt.equals(fieldName, HttpHeaders.LAST_MODIFIED, true)) {
this.lastModified = DatesKt.toHttpDateOrNull(value);
this.lastModifiedString = value;
} else if (StringsKt.equals(fieldName, HttpHeaders.ETAG, true)) {
this.etag = value;
} else if (StringsKt.equals(fieldName, HttpHeaders.AGE, true)) {
this.ageSeconds = Util.toNonNegativeInt(value, -1);
}
}
}
}
/* renamed from: getRequest$okhttp, reason: from getter */
public final Request getRequest() {
return this.request;
}
private final boolean isFreshnessLifetimeHeuristic() {
Response response = this.cacheResponse;
Intrinsics.checkNotNull(response);
return response.cacheControl().maxAgeSeconds() == -1 && this.expires == null;
}
public final CacheStrategy compute() {
CacheStrategy candidate = computeCandidate();
if (candidate.getNetworkRequest() != null && this.request.cacheControl().onlyIfCached()) {
return new CacheStrategy(null, null);
}
return candidate;
}
private final CacheStrategy computeCandidate() {
String conditionName;
String conditionName2;
if (this.cacheResponse == null) {
return new CacheStrategy(this.request, null);
}
if (this.request.isHttps() && this.cacheResponse.handshake() == null) {
return new CacheStrategy(this.request, null);
}
if (!CacheStrategy.INSTANCE.isCacheable(this.cacheResponse, this.request)) {
return new CacheStrategy(this.request, null);
}
CacheControl requestCaching = this.request.cacheControl();
if (!requestCaching.noCache() && !hasConditions(this.request)) {
CacheControl responseCaching = this.cacheResponse.cacheControl();
long ageMillis = cacheResponseAge();
long freshMillis = computeFreshnessLifetime();
if (requestCaching.maxAgeSeconds() != -1) {
freshMillis = Math.min(freshMillis, TimeUnit.SECONDS.toMillis(requestCaching.maxAgeSeconds()));
}
long minFreshMillis = requestCaching.minFreshSeconds() != -1 ? TimeUnit.SECONDS.toMillis(requestCaching.minFreshSeconds()) : 0L;
long maxStaleMillis = 0;
if (!responseCaching.mustRevalidate() && requestCaching.maxStaleSeconds() != -1) {
maxStaleMillis = TimeUnit.SECONDS.toMillis(requestCaching.maxStaleSeconds());
}
if (!responseCaching.noCache() && ageMillis + minFreshMillis < freshMillis + maxStaleMillis) {
Response.Builder builder = this.cacheResponse.newBuilder();
if (ageMillis + minFreshMillis >= freshMillis) {
builder.addHeader(HttpHeaders.WARNING, "110 HttpURLConnection \"Response is stale\"");
}
if (ageMillis > 86400000 && isFreshnessLifetimeHeuristic()) {
builder.addHeader(HttpHeaders.WARNING, "113 HttpURLConnection \"Heuristic expiration\"");
}
return new CacheStrategy(null, builder.build());
}
if (this.etag != null) {
conditionName = HttpHeaders.IF_NONE_MATCH;
conditionName2 = this.etag;
} else if (this.lastModified != null) {
conditionName = HttpHeaders.IF_MODIFIED_SINCE;
conditionName2 = this.lastModifiedString;
} else {
if (this.servedDate == null) {
return new CacheStrategy(this.request, null);
}
conditionName = HttpHeaders.IF_MODIFIED_SINCE;
conditionName2 = this.servedDateString;
}
Headers.Builder conditionalRequestHeaders = this.request.headers().newBuilder();
Intrinsics.checkNotNull(conditionName2);
conditionalRequestHeaders.addLenient$okhttp(conditionName, conditionName2);
Request conditionalRequest = this.request.newBuilder().headers(conditionalRequestHeaders.build()).build();
return new CacheStrategy(conditionalRequest, this.cacheResponse);
}
return new CacheStrategy(this.request, null);
}
private final long computeFreshnessLifetime() {
Response response = this.cacheResponse;
Intrinsics.checkNotNull(response);
CacheControl responseCaching = response.cacheControl();
if (responseCaching.maxAgeSeconds() != -1) {
return TimeUnit.SECONDS.toMillis(responseCaching.maxAgeSeconds());
}
Date expires = this.expires;
if (expires != null) {
Date date = this.servedDate;
long servedMillis = date != null ? date.getTime() : this.receivedResponseMillis;
long delta = expires.getTime() - servedMillis;
if (delta > 0) {
return delta;
}
return 0L;
}
if (this.lastModified == null || this.cacheResponse.request().url().query() != null) {
return 0L;
}
Date date2 = this.servedDate;
long servedMillis2 = date2 != null ? date2.getTime() : this.sentRequestMillis;
Date date3 = this.lastModified;
Intrinsics.checkNotNull(date3);
long delta2 = servedMillis2 - date3.getTime();
if (delta2 > 0) {
return delta2 / 10;
}
return 0L;
}
private final long cacheResponseAge() {
long receivedAge;
Date servedDate = this.servedDate;
long apparentReceivedAge = servedDate != null ? Math.max(0L, this.receivedResponseMillis - servedDate.getTime()) : 0L;
if (this.ageSeconds != -1) {
receivedAge = Math.max(apparentReceivedAge, TimeUnit.SECONDS.toMillis(this.ageSeconds));
} else {
receivedAge = apparentReceivedAge;
}
long j = this.receivedResponseMillis;
long responseDuration = j - this.sentRequestMillis;
long residentDuration = this.nowMillis - j;
return receivedAge + responseDuration + residentDuration;
}
private final boolean hasConditions(Request request) {
return (request.header(HttpHeaders.IF_MODIFIED_SINCE) == null && request.header(HttpHeaders.IF_NONE_MATCH) == null) ? false : true;
}
}
/* compiled from: CacheStrategy.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\\u0006\t"}, m238d2 = {"Lokhttp3/internal/cache/CacheStrategy$Companion;", "", "()V", "isCacheable", "", "response", "Lokhttp3/Response;", "request", "Lokhttp3/Request;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public final boolean isCacheable(Response response, Request request) {
Intrinsics.checkNotNullParameter(response, "response");
Intrinsics.checkNotNullParameter(request, "request");
switch (response.code()) {
case ItemTouchHelper.Callback.DEFAULT_DRAG_ANIMATION_DURATION /* 200 */:
case 203:
case 204:
case 300:
case 301:
case 308:
case 404:
case 405:
case 410:
case 414:
case TypedValues.Position.TYPE_TRANSITION_EASING /* 501 */:
break;
case 302:
case 307:
if (Response.header$default(response, HttpHeaders.EXPIRES, null, 2, null) == null && response.cacheControl().maxAgeSeconds() == -1 && !response.cacheControl().getIsPublic() && !response.cacheControl().getIsPrivate()) {
return false;
}
break;
default:
return false;
}
return (response.cacheControl().noStore() || request.cacheControl().noStore()) ? false : true;
}
}
}
@@ -0,0 +1,78 @@
package okhttp3.internal.cache;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.NoSuchElementException;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.markers.KMutableIterator;
import okhttp3.internal.cache.DiskLruCache;
/* compiled from: DiskLruCache.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000)\n\u0000\n\u0002\u0010)\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000*\u0001\u0000\b\n\u0018\u00002\f\u0012\b\u0012\u00060\u0002R\u00020\u00030\u0001J\t\u0010\t\u001a\u00020\nH\u0096\u0002J\r\u0010\u000b\u001a\u00060\u0002R\u00020\u0003H\u0096\u0002J\b\u0010\f\u001a\u00020\rH\u0016R$\u0010\u0004\u001a\u0018\u0012\u0014\u0012\u0012 \u0006*\b\u0018\u00010\u0005R\u00020\u00030\u0005R\u00020\u00030\u0001X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0007\u001a\b\u0018\u00010\u0002R\u00020\u0003X\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\b\u001a\b\u0018\u00010\u0002R\u00020\u0003X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u000e"}, m238d2 = {"okhttp3/internal/cache/DiskLruCache$snapshots$1", "", "Lokhttp3/internal/cache/DiskLruCache$Snapshot;", "Lokhttp3/internal/cache/DiskLruCache;", "delegate", "Lokhttp3/internal/cache/DiskLruCache$Entry;", "kotlin.jvm.PlatformType", "nextSnapshot", "removeSnapshot", "hasNext", "", "next", "remove", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class DiskLruCache$snapshots$1 implements Iterator<DiskLruCache.Snapshot>, KMutableIterator {
private final Iterator<DiskLruCache.Entry> delegate;
private DiskLruCache.Snapshot nextSnapshot;
private DiskLruCache.Snapshot removeSnapshot;
final /* synthetic */ DiskLruCache this$0;
DiskLruCache$snapshots$1(DiskLruCache this$0) {
this.this$0 = this$0;
Iterator<DiskLruCache.Entry> it = new ArrayList(this$0.getLruEntries$okhttp().values()).iterator();
Intrinsics.checkNotNullExpressionValue(it, "ArrayList(lruEntries.values).iterator()");
this.delegate = it;
}
@Override // java.util.Iterator
public boolean hasNext() {
DiskLruCache.Snapshot snapshot$okhttp;
if (this.nextSnapshot != null) {
return true;
}
synchronized (this.this$0) {
if (this.this$0.getClosed()) {
return false;
}
while (this.delegate.hasNext()) {
DiskLruCache.Entry next = this.delegate.next();
if (next != null && (snapshot$okhttp = next.snapshot$okhttp()) != null) {
this.nextSnapshot = snapshot$okhttp;
return true;
}
}
Unit unit = Unit.INSTANCE;
return false;
}
}
@Override // java.util.Iterator
public DiskLruCache.Snapshot next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
DiskLruCache.Snapshot snapshot = this.nextSnapshot;
this.removeSnapshot = snapshot;
this.nextSnapshot = null;
Intrinsics.checkNotNull(snapshot);
return snapshot;
}
@Override // java.util.Iterator
public void remove() {
DiskLruCache.Snapshot removeSnapshot = this.removeSnapshot;
if (removeSnapshot == null) {
throw new IllegalStateException("remove() before next()".toString());
}
try {
this.this$0.remove(removeSnapshot.getKey());
} catch (IOException e) {
} catch (Throwable th) {
this.removeSnapshot = null;
throw th;
}
this.removeSnapshot = null;
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,72 @@
package okhttp3.internal.cache;
import java.io.IOException;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import okio.Buffer;
import okio.ForwardingSink;
import okio.Sink;
/* compiled from: FaultHidingSink.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\b\u0010\u0018\u00002\u00020\u0001B!\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0012\u0010\u0004\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u00070\u0005¢\u0006\u0002\u0010\bJ\b\u0010\r\u001a\u00020\u0007H\u0016J\b\u0010\u000e\u001a\u00020\u0007H\u0016J\u0018\u0010\u000f\u001a\u00020\u00072\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0013H\u0016R\u000e\u0010\t\u001a\u00020\nX\u0082\u000e¢\u0006\u0002\n\u0000R\u001d\u0010\u0004\u001a\u000e\u0012\u0004\u0012\u00020\u0006\u0012\u0004\u0012\u00020\u00070\u0005¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\\u0006\u0014"}, m238d2 = {"Lokhttp3/internal/cache/FaultHidingSink;", "Lokio/ForwardingSink;", "delegate", "Lokio/Sink;", "onException", "Lkotlin/Function1;", "Ljava/io/IOException;", "", "(Lokio/Sink;Lkotlin/jvm/functions/Function1;)V", "hasErrors", "", "getOnException", "()Lkotlin/jvm/functions/Function1;", "close", "flush", "write", "source", "Lokio/Buffer;", "byteCount", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public class FaultHidingSink extends ForwardingSink {
private boolean hasErrors;
private final Function1<IOException, Unit> onException;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
/* JADX WARN: Multi-variable type inference failed */
public FaultHidingSink(Sink delegate, Function1<? super IOException, Unit> onException) {
super(delegate);
Intrinsics.checkNotNullParameter(delegate, "delegate");
Intrinsics.checkNotNullParameter(onException, "onException");
this.onException = onException;
}
public final Function1<IOException, Unit> getOnException() {
return this.onException;
}
@Override // okio.ForwardingSink, okio.Sink
public void write(Buffer source, long byteCount) {
Intrinsics.checkNotNullParameter(source, "source");
if (this.hasErrors) {
source.skip(byteCount);
return;
}
try {
super.write(source, byteCount);
} catch (IOException e) {
this.hasErrors = true;
this.onException.invoke(e);
}
}
@Override // okio.ForwardingSink, okio.Sink, java.io.Flushable
public void flush() {
if (this.hasErrors) {
return;
}
try {
super.flush();
} catch (IOException e) {
this.hasErrors = true;
this.onException.invoke(e);
}
}
@Override // okio.ForwardingSink, okio.Sink, java.io.Closeable, java.lang.AutoCloseable
public void close() {
if (this.hasErrors) {
return;
}
try {
super.close();
} catch (IOException e) {
this.hasErrors = true;
this.onException.invoke(e);
}
}
}
@@ -0,0 +1,47 @@
package okhttp3.internal.cache2;
import java.io.IOException;
import java.nio.channels.FileChannel;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okio.Buffer;
/* compiled from: FileOperator.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0000\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\u001e\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\bJ\u001e\u0010\f\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\r\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\bR\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u000e"}, m238d2 = {"Lokhttp3/internal/cache2/FileOperator;", "", "fileChannel", "Ljava/nio/channels/FileChannel;", "(Ljava/nio/channels/FileChannel;)V", "read", "", "pos", "", "sink", "Lokio/Buffer;", "byteCount", "write", "source", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class FileOperator {
private final FileChannel fileChannel;
public FileOperator(FileChannel fileChannel) {
Intrinsics.checkNotNullParameter(fileChannel, "fileChannel");
this.fileChannel = fileChannel;
}
public final void write(long pos, Buffer source, long byteCount) throws IOException {
Intrinsics.checkNotNullParameter(source, "source");
if (byteCount < 0 || byteCount > source.size()) {
throw new IndexOutOfBoundsException();
}
long mutablePos = pos;
long mutableByteCount = byteCount;
while (mutableByteCount > 0) {
long bytesWritten = this.fileChannel.transferFrom(source, mutablePos, mutableByteCount);
mutablePos += bytesWritten;
mutableByteCount -= bytesWritten;
}
}
public final void read(long pos, Buffer sink, long byteCount) {
Intrinsics.checkNotNullParameter(sink, "sink");
if (byteCount < 0) {
throw new IndexOutOfBoundsException();
}
long mutablePos = pos;
long mutableByteCount = byteCount;
while (mutableByteCount > 0) {
long bytesRead = this.fileChannel.transferTo(mutablePos, mutableByteCount, sink);
mutablePos += bytesRead;
mutableByteCount -= bytesRead;
}
}
}
@@ -0,0 +1,494 @@
package okhttp3.internal.cache2;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.internal.Util;
import okio.Buffer;
import okio.ByteString;
import okio.Source;
import okio.Timeout;
/* compiled from: Relay.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000L\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\n\n\u0002\u0010\b\n\u0002\b\u000e\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\t\u0018\u0000 :2\u00020\u0001:\u0002:;B3\b\u0002\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\b\u0010\u0004\u001a\u0004\u0018\u00010\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\t\u0012\u0006\u0010\n\u001a\u00020\u0007¢\u0006\u0002\u0010\u000bJ\u000e\u00102\u001a\u0002032\u0006\u00104\u001a\u00020\u0007J\u0006\u0010\b\u001a\u00020\tJ\b\u00105\u001a\u0004\u0018\u00010\u0005J \u00106\u001a\u0002032\u0006\u00107\u001a\u00020\t2\u0006\u00104\u001a\u00020\u00072\u0006\u00108\u001a\u00020\u0007H\u0002J\u0010\u00109\u001a\u0002032\u0006\u00104\u001a\u00020\u0007H\u0002R\u0011\u0010\f\u001a\u00020\\u0006\b\n\u0000\u001a\u0004\b\u000e\u0010\u000fR\u0011\u0010\n\u001a\u00020\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0010\u0010\u0011R\u001a\u0010\u0012\u001a\u00020\u0013X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0014\u0010\u0015\"\u0004\b\u0016\u0010\u0017R\u001c\u0010\u0002\u001a\u0004\u0018\u00010\u0003X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0018\u0010\u0019\"\u0004\b\u001a\u0010\u001bR\u0011\u0010\u001c\u001a\u00020\u00138F¢\u0006\u0006\u001a\u0004\b\u001c\u0010\u0015R\u000e\u0010\b\u001a\u00020\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010\u001d\u001a\u00020\u001eX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001f\u0010 \"\u0004\b!\u0010\"R\u001c\u0010\u0004\u001a\u0004\u0018\u00010\u0005X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b#\u0010$\"\u0004\b%\u0010&R\u0011\u0010'\u001a\u00020\\u0006\b\n\u0000\u001a\u0004\b(\u0010\u000fR\u001a\u0010\u0006\u001a\u00020\u0007X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b)\u0010\u0011\"\u0004\b*\u0010+R\u001c\u0010,\u001a\u0004\u0018\u00010-X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b.\u0010/\"\u0004\b0\u00101¨\u0006<"}, m238d2 = {"Lokhttp3/internal/cache2/Relay;", "", "file", "Ljava/io/RandomAccessFile;", "upstream", "Lokio/Source;", "upstreamPos", "", "metadata", "Lokio/ByteString;", "bufferMaxSize", "(Ljava/io/RandomAccessFile;Lokio/Source;JLokio/ByteString;J)V", "buffer", "Lokio/Buffer;", "getBuffer", "()Lokio/Buffer;", "getBufferMaxSize", "()J", "complete", "", "getComplete", "()Z", "setComplete", "(Z)V", "getFile", "()Ljava/io/RandomAccessFile;", "setFile", "(Ljava/io/RandomAccessFile;)V", "isClosed", "sourceCount", "", "getSourceCount", "()I", "setSourceCount", "(I)V", "getUpstream", "()Lokio/Source;", "setUpstream", "(Lokio/Source;)V", "upstreamBuffer", "getUpstreamBuffer", "getUpstreamPos", "setUpstreamPos", "(J)V", "upstreamReader", "Ljava/lang/Thread;", "getUpstreamReader", "()Ljava/lang/Thread;", "setUpstreamReader", "(Ljava/lang/Thread;)V", "commit", "", "upstreamSize", "newSource", "writeHeader", "prefix", "metadataSize", "writeMetadata", "Companion", "RelaySource", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Relay {
private static final long FILE_HEADER_SIZE = 32;
private static final int SOURCE_FILE = 2;
private static final int SOURCE_UPSTREAM = 1;
private final Buffer buffer;
private final long bufferMaxSize;
private boolean complete;
private RandomAccessFile file;
private final ByteString metadata;
private int sourceCount;
private Source upstream;
private final Buffer upstreamBuffer;
private long upstreamPos;
private Thread upstreamReader;
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
public static final ByteString PREFIX_CLEAN = ByteString.INSTANCE.encodeUtf8("OkHttp cache v1\n");
public static final ByteString PREFIX_DIRTY = ByteString.INSTANCE.encodeUtf8("OkHttp DIRTY :(\n");
private Relay(RandomAccessFile file, Source upstream, long upstreamPos, ByteString metadata, long bufferMaxSize) {
this.file = file;
this.upstream = upstream;
this.upstreamPos = upstreamPos;
this.metadata = metadata;
this.bufferMaxSize = bufferMaxSize;
this.upstreamBuffer = new Buffer();
this.complete = this.upstream == null;
this.buffer = new Buffer();
}
public /* synthetic */ Relay(RandomAccessFile file, Source upstream, long upstreamPos, ByteString metadata, long bufferMaxSize, DefaultConstructorMarker $constructor_marker) {
this(file, upstream, upstreamPos, metadata, bufferMaxSize);
}
public final RandomAccessFile getFile() {
return this.file;
}
public final void setFile(RandomAccessFile randomAccessFile) {
this.file = randomAccessFile;
}
public final Source getUpstream() {
return this.upstream;
}
public final void setUpstream(Source source) {
this.upstream = source;
}
public final long getUpstreamPos() {
return this.upstreamPos;
}
public final void setUpstreamPos(long j) {
this.upstreamPos = j;
}
public final long getBufferMaxSize() {
return this.bufferMaxSize;
}
public final Thread getUpstreamReader() {
return this.upstreamReader;
}
public final void setUpstreamReader(Thread thread) {
this.upstreamReader = thread;
}
public final Buffer getUpstreamBuffer() {
return this.upstreamBuffer;
}
public final boolean getComplete() {
return this.complete;
}
public final void setComplete(boolean z) {
this.complete = z;
}
public final Buffer getBuffer() {
return this.buffer;
}
public final int getSourceCount() {
return this.sourceCount;
}
public final void setSourceCount(int i) {
this.sourceCount = i;
}
public final boolean isClosed() {
return this.file == null;
}
/* JADX INFO: Access modifiers changed from: private */
public final void writeHeader(ByteString prefix, long upstreamSize, long metadataSize) throws IOException {
Buffer header = new Buffer();
header.write(prefix);
header.writeLong(upstreamSize);
header.writeLong(metadataSize);
if (!(header.size() == 32)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
RandomAccessFile randomAccessFile = this.file;
Intrinsics.checkNotNull(randomAccessFile);
FileChannel channel = randomAccessFile.getChannel();
Intrinsics.checkNotNullExpressionValue(channel, "file!!.channel");
FileOperator fileOperator = new FileOperator(channel);
fileOperator.write(0L, header, 32L);
}
private final void writeMetadata(long upstreamSize) throws IOException {
Buffer metadataBuffer = new Buffer();
metadataBuffer.write(this.metadata);
RandomAccessFile randomAccessFile = this.file;
Intrinsics.checkNotNull(randomAccessFile);
FileChannel channel = randomAccessFile.getChannel();
Intrinsics.checkNotNullExpressionValue(channel, "file!!.channel");
FileOperator fileOperator = new FileOperator(channel);
fileOperator.write(32 + upstreamSize, metadataBuffer, this.metadata.size());
}
public final void commit(long upstreamSize) throws IOException {
writeMetadata(upstreamSize);
RandomAccessFile randomAccessFile = this.file;
Intrinsics.checkNotNull(randomAccessFile);
randomAccessFile.getChannel().force(false);
writeHeader(PREFIX_CLEAN, upstreamSize, this.metadata.size());
RandomAccessFile randomAccessFile2 = this.file;
Intrinsics.checkNotNull(randomAccessFile2);
randomAccessFile2.getChannel().force(false);
synchronized (this) {
this.complete = true;
Unit unit = Unit.INSTANCE;
}
Source source = this.upstream;
if (source != null) {
Util.closeQuietly(source);
}
this.upstream = null;
}
/* renamed from: metadata, reason: from getter */
public final ByteString getMetadata() {
return this.metadata;
}
public final Source newSource() {
synchronized (this) {
if (this.file == null) {
return null;
}
this.sourceCount++;
return new RelaySource();
}
}
/* compiled from: Relay.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0080\u0004\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\t\u001a\u00020\nH\u0016J\u0018\u0010\u000b\u001a\u00020\u00062\u0006\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u0006H\u0016J\b\u0010\u0007\u001a\u00020\bH\u0016R\u0010\u0010\u0003\u001a\u0004\u0018\u00010\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u000f"}, m238d2 = {"Lokhttp3/internal/cache2/Relay$RelaySource;", "Lokio/Source;", "(Lokhttp3/internal/cache2/Relay;)V", "fileOperator", "Lokhttp3/internal/cache2/FileOperator;", "sourcePos", "", "timeout", "Lokio/Timeout;", "close", "", "read", "sink", "Lokio/Buffer;", "byteCount", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public final class RelaySource implements Source {
private FileOperator fileOperator;
private long sourcePos;
private final Timeout timeout = new Timeout();
public RelaySource() {
RandomAccessFile file = Relay.this.getFile();
Intrinsics.checkNotNull(file);
FileChannel channel = file.getChannel();
Intrinsics.checkNotNullExpressionValue(channel, "file!!.channel");
this.fileOperator = new FileOperator(channel);
}
/* JADX WARN: Code restructure failed: missing block: B:19:0x008e, code lost:
r11 = r4;
*/
/* JADX WARN: Code restructure failed: missing block: B:20:0x0091, code lost:
if (r11 != 2) goto L32;
*/
/* JADX WARN: Code restructure failed: missing block: B:21:0x0093, code lost:
r12 = java.lang.Math.min(r26, r24.this$0.getUpstreamPos() - r24.sourcePos);
r4 = r24.fileOperator;
kotlin.jvm.internal.Intrinsics.checkNotNull(r4);
r4.read(r24.sourcePos + 32, r25, r12);
r24.sourcePos += r12;
*/
/* JADX WARN: Code restructure failed: missing block: B:22:0x00b3, code lost:
return r12;
*/
/* JADX WARN: Code restructure failed: missing block: B:26:0x00b6, code lost:
r0 = r24.this$0.getUpstream();
kotlin.jvm.internal.Intrinsics.checkNotNull(r0);
r4 = r0.read(r24.this$0.getUpstreamBuffer(), r24.this$0.getBufferMaxSize());
*/
/* JADX WARN: Code restructure failed: missing block: B:27:0x00d2, code lost:
if (r4 != (-1)) goto L49;
*/
/* JADX WARN: Code restructure failed: missing block: B:28:0x00d4, code lost:
r0 = r24.this$0;
r0.commit(r0.getUpstreamPos());
*/
/* JADX WARN: Code restructure failed: missing block: B:29:0x00de, code lost:
r4 = r24.this$0;
*/
/* JADX WARN: Code restructure failed: missing block: B:30:0x00e0, code lost:
monitor-enter(r4);
*/
/* JADX WARN: Code restructure failed: missing block: B:33:0x00e2, code lost:
r9 = (java.lang.Thread) null;
r24.this$0.setUpstreamReader(null);
r5 = r24.this$0;
*/
/* JADX WARN: Code restructure failed: missing block: B:34:0x00ed, code lost:
if (r5 == null) goto L44;
*/
/* JADX WARN: Code restructure failed: missing block: B:35:0x00ef, code lost:
r5.notifyAll();
r0 = kotlin.Unit.INSTANCE;
*/
/* JADX WARN: Code restructure failed: missing block: B:36:0x00f8, code lost:
monitor-exit(r4);
*/
/* JADX WARN: Code restructure failed: missing block: B:37:0x00f9, code lost:
return -1;
*/
/* JADX WARN: Code restructure failed: missing block: B:39:0x0101, code lost:
throw new java.lang.NullPointerException("null cannot be cast to non-null type java.lang.Object");
*/
/* JADX WARN: Code restructure failed: missing block: B:42:0x0105, code lost:
r4 = java.lang.Math.min(r4, r26);
*/
/* JADX WARN: Code restructure failed: missing block: B:45:0x0119, code lost:
r24.this$0.getUpstreamBuffer().copyTo(r25, 0, r4);
r24.sourcePos += r4;
r0 = r24.fileOperator;
kotlin.jvm.internal.Intrinsics.checkNotNull(r0);
r0.write(r24.this$0.getUpstreamPos() + 32, r24.this$0.getUpstreamBuffer().clone(), r4);
r4 = r24.this$0;
*/
/* JADX WARN: Code restructure failed: missing block: B:46:0x0141, code lost:
monitor-enter(r4);
*/
/* JADX WARN: Code restructure failed: missing block: B:52:0x0151, code lost:
r24.this$0.getBuffer().write(r24.this$0.getUpstreamBuffer(), r4);
*/
/* JADX WARN: Code restructure failed: missing block: B:53:0x0166, code lost:
if (r24.this$0.getBuffer().size() <= r24.this$0.getBufferMaxSize()) goto L59;
*/
/* JADX WARN: Code restructure failed: missing block: B:54:0x0168, code lost:
r24.this$0.getBuffer().skip(r24.this$0.getBuffer().size() - r24.this$0.getBufferMaxSize());
*/
/* JADX WARN: Code restructure failed: missing block: B:55:0x0183, code lost:
r5 = r24.this$0;
r5.setUpstreamPos(r5.getUpstreamPos() + r4);
r0 = kotlin.Unit.INSTANCE;
*/
/* JADX WARN: Code restructure failed: missing block: B:56:0x018f, code lost:
monitor-exit(r4);
*/
/* JADX WARN: Code restructure failed: missing block: B:57:0x0191, code lost:
r4 = r24.this$0;
*/
/* JADX WARN: Code restructure failed: missing block: B:58:0x0193, code lost:
monitor-enter(r4);
*/
/* JADX WARN: Code restructure failed: missing block: B:61:0x0195, code lost:
r9 = (java.lang.Thread) null;
r24.this$0.setUpstreamReader(null);
r5 = r24.this$0;
*/
/* JADX WARN: Code restructure failed: missing block: B:62:0x01a1, code lost:
if (r5 == null) goto L69;
*/
/* JADX WARN: Code restructure failed: missing block: B:63:0x01a3, code lost:
r5.notifyAll();
r0 = kotlin.Unit.INSTANCE;
*/
/* JADX WARN: Code restructure failed: missing block: B:64:0x01ac, code lost:
monitor-exit(r4);
*/
/* JADX WARN: Code restructure failed: missing block: B:65:0x01ad, code lost:
return r4;
*/
/* JADX WARN: Code restructure failed: missing block: B:67:0x01b5, code lost:
throw new java.lang.NullPointerException("null cannot be cast to non-null type java.lang.Object");
*/
/* JADX WARN: Code restructure failed: missing block: B:72:0x01b9, code lost:
r0 = th;
*/
/* JADX WARN: Code restructure failed: missing block: B:73:0x01ba, code lost:
r6 = null;
*/
/* JADX WARN: Code restructure failed: missing block: B:75:0x01c0, code lost:
monitor-exit(r4);
*/
/* JADX WARN: Code restructure failed: missing block: B:76:0x01c1, code lost:
throw r0;
*/
/* JADX WARN: Code restructure failed: missing block: B:78:0x01c2, code lost:
r0 = th;
*/
/* JADX WARN: Code restructure failed: missing block: B:80:0x01cb, code lost:
monitor-enter(r24.this$0);
*/
/* JADX WARN: Code restructure failed: missing block: B:83:0x01cd, code lost:
r8 = r6;
r24.this$0.setUpstreamReader(r6);
r6 = r24.this$0;
*/
/* JADX WARN: Code restructure failed: missing block: B:84:0x01d8, code lost:
if (r6 == null) goto L91;
*/
/* JADX WARN: Code restructure failed: missing block: B:86:0x01e1, code lost:
throw new java.lang.NullPointerException("null cannot be cast to non-null type java.lang.Object");
*/
/* JADX WARN: Code restructure failed: missing block: B:87:0x01e2, code lost:
r6.notifyAll();
r5 = kotlin.Unit.INSTANCE;
*/
/* JADX WARN: Code restructure failed: missing block: B:89:0x01ec, code lost:
throw r0;
*/
/* JADX WARN: Code restructure failed: missing block: B:93:0x01bc, code lost:
r0 = th;
*/
/* JADX WARN: Code restructure failed: missing block: B:94:0x01bd, code lost:
r6 = null;
*/
/* JADX WARN: Code restructure failed: missing block: B:95:0x01c4, code lost:
r0 = th;
*/
/* JADX WARN: Code restructure failed: missing block: B:96:0x01c5, code lost:
r6 = null;
*/
/* JADX WARN: Code restructure failed: missing block: B:97:0x01c7, code lost:
r0 = th;
*/
/* JADX WARN: Code restructure failed: missing block: B:98:0x01c8, code lost:
r6 = null;
*/
@Override // okio.Source
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public long read(okio.Buffer r25, long r26) throws java.io.IOException {
/*
Method dump skipped, instructions count: 513
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.cache2.Relay.RelaySource.read(okio.Buffer, long):long");
}
@Override // okio.Source
/* renamed from: timeout, reason: from getter */
public Timeout getTimeout() {
return this.timeout;
}
@Override // okio.Source, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
if (this.fileOperator == null) {
return;
}
this.fileOperator = null;
Object fileToClose = (RandomAccessFile) null;
synchronized (Relay.this) {
Relay.this.setSourceCount(r4.getSourceCount() - 1);
if (Relay.this.getSourceCount() == 0) {
fileToClose = Relay.this.getFile();
Relay.this.setFile(null);
}
Unit unit = Unit.INSTANCE;
}
if (fileToClose != null) {
Util.closeQuietly((Closeable) fileToClose);
}
}
}
/* compiled from: Relay.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J&\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00062\u0006\u0010\u0012\u001a\u00020\u0004J\u000e\u0010\u0013\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000eR\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u0010\u0010\u0005\u001a\u00020\u00068\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0007\u001a\u00020\u00068\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\tX\u0082T¢\u0006\u0002\n\u0000¨\u0006\u0014"}, m238d2 = {"Lokhttp3/internal/cache2/Relay$Companion;", "", "()V", "FILE_HEADER_SIZE", "", "PREFIX_CLEAN", "Lokio/ByteString;", "PREFIX_DIRTY", "SOURCE_FILE", "", "SOURCE_UPSTREAM", "edit", "Lokhttp3/internal/cache2/Relay;", "file", "Ljava/io/File;", "upstream", "Lokio/Source;", "metadata", "bufferMaxSize", "read", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public final Relay edit(File file, Source upstream, ByteString metadata, long bufferMaxSize) throws IOException {
Intrinsics.checkNotNullParameter(file, "file");
Intrinsics.checkNotNullParameter(upstream, "upstream");
Intrinsics.checkNotNullParameter(metadata, "metadata");
RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
Relay result = new Relay(randomAccessFile, upstream, 0L, metadata, bufferMaxSize, null);
randomAccessFile.setLength(0L);
result.writeHeader(Relay.PREFIX_DIRTY, -1L, -1L);
return result;
}
public final Relay read(File file) throws IOException {
Intrinsics.checkNotNullParameter(file, "file");
RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
FileChannel channel = randomAccessFile.getChannel();
Intrinsics.checkNotNullExpressionValue(channel, "randomAccessFile.channel");
FileOperator fileOperator = new FileOperator(channel);
Buffer header = new Buffer();
fileOperator.read(0L, header, 32L);
ByteString prefix = header.readByteString(Relay.PREFIX_CLEAN.size());
if (!Intrinsics.areEqual(prefix, Relay.PREFIX_CLEAN)) {
throw new IOException("unreadable cache file");
}
long upstreamSize = header.readLong();
long metadataSize = header.readLong();
Buffer metadataBuffer = new Buffer();
fileOperator.read(upstreamSize + 32, metadataBuffer, metadataSize);
ByteString metadata = metadataBuffer.readByteString();
return new Relay(randomAccessFile, null, upstreamSize, metadata, 0L, null);
}
}
}
@@ -0,0 +1,70 @@
package okhttp3.internal.concurrent;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: Task.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0006\n\u0002\u0010\t\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0004\b&\u0018\u00002\u00020\u0001B\u0017\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\b\b\u0002\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\u0015\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0011\u001a\u00020\u0012H\u0000¢\u0006\u0002\b\u0019J\b\u0010\u001a\u001a\u00020\fH&J\b\u0010\u001b\u001a\u00020\u0003H\u0016R\u0011\u0010\u0004\u001a\u00020\u0005¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\bR\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\nR\u001a\u0010\u000b\u001a\u00020\fX\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\r\u0010\u000e\"\u0004\b\u000f\u0010\u0010R\u001c\u0010\u0011\u001a\u0004\u0018\u00010\u0012X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0013\u0010\u0014\"\u0004\b\u0015\u0010\u0016¨\u0006\u001c"}, m238d2 = {"Lokhttp3/internal/concurrent/Task;", "", "name", "", "cancelable", "", "(Ljava/lang/String;Z)V", "getCancelable", "()Z", "getName", "()Ljava/lang/String;", "nextExecuteNanoTime", "", "getNextExecuteNanoTime$okhttp", "()J", "setNextExecuteNanoTime$okhttp", "(J)V", "queue", "Lokhttp3/internal/concurrent/TaskQueue;", "getQueue$okhttp", "()Lokhttp3/internal/concurrent/TaskQueue;", "setQueue$okhttp", "(Lokhttp3/internal/concurrent/TaskQueue;)V", "initQueue", "", "initQueue$okhttp", "runOnce", "toString", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public abstract class Task {
private final boolean cancelable;
private final String name;
private long nextExecuteNanoTime;
private TaskQueue queue;
public abstract long runOnce();
public Task(String name, boolean cancelable) {
Intrinsics.checkNotNullParameter(name, "name");
this.name = name;
this.cancelable = cancelable;
this.nextExecuteNanoTime = -1L;
}
public final String getName() {
return this.name;
}
public /* synthetic */ Task(String str, boolean z, int i, DefaultConstructorMarker defaultConstructorMarker) {
this(str, (i & 2) != 0 ? true : z);
}
public final boolean getCancelable() {
return this.cancelable;
}
/* renamed from: getQueue$okhttp, reason: from getter */
public final TaskQueue getQueue() {
return this.queue;
}
public final void setQueue$okhttp(TaskQueue taskQueue) {
this.queue = taskQueue;
}
/* renamed from: getNextExecuteNanoTime$okhttp, reason: from getter */
public final long getNextExecuteNanoTime() {
return this.nextExecuteNanoTime;
}
public final void setNextExecuteNanoTime$okhttp(long j) {
this.nextExecuteNanoTime = j;
}
public final void initQueue$okhttp(TaskQueue queue) {
Intrinsics.checkNotNullParameter(queue, "queue");
TaskQueue taskQueue = this.queue;
if (taskQueue == queue) {
return;
}
if (!(taskQueue == null)) {
throw new IllegalStateException("task is in multiple queues".toString());
}
this.queue = queue;
}
public String toString() {
return this.name;
}
}
@@ -0,0 +1,93 @@
package okhttp3.internal.concurrent;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.InlineMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.StringCompanionObject;
/* compiled from: TaskLogger.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000*\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\u001a\u000e\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003\u001a \u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u0001H\u0002\u001a5\u0010\u000b\u001a\u0002H\f\"\u0004\b\u0000\u0010\f2\u0006\u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\t2\f\u0010\r\u001a\b\u0012\u0004\u0012\u0002H\f0\u000eH\u0080\\u0001\u0000¢\u0006\u0002\u0010\u000f\u001a*\u0010\u0010\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\t2\f\u0010\u0011\u001a\b\u0012\u0004\u0012\u00020\u00010\u000eH\u0080\\u0001\u0000\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006\u0012"}, m238d2 = {"formatDuration", "", "ns", "", "log", "", "task", "Lokhttp3/internal/concurrent/Task;", "queue", "Lokhttp3/internal/concurrent/TaskQueue;", "message", "logElapsed", "T", "block", "Lkotlin/Function0;", "(Lokhttp3/internal/concurrent/Task;Lokhttp3/internal/concurrent/TaskQueue;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;", "taskLog", "messageBlock", "okhttp"}, m239k = 2, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class TaskLoggerKt {
public static final void taskLog(Task task, TaskQueue queue, Function0<String> messageBlock) {
Intrinsics.checkNotNullParameter(task, "task");
Intrinsics.checkNotNullParameter(queue, "queue");
Intrinsics.checkNotNullParameter(messageBlock, "messageBlock");
if (TaskRunner.INSTANCE.getLogger().isLoggable(Level.FINE)) {
log(task, queue, messageBlock.invoke());
}
}
public static final <T> T logElapsed(Task task, TaskQueue queue, Function0<? extends T> block) {
Intrinsics.checkNotNullParameter(task, "task");
Intrinsics.checkNotNullParameter(queue, "queue");
Intrinsics.checkNotNullParameter(block, "block");
long startNs = -1;
boolean loggingEnabled = TaskRunner.INSTANCE.getLogger().isLoggable(Level.FINE);
if (loggingEnabled) {
startNs = queue.getTaskRunner().getBackend().nanoTime();
log(task, queue, "starting");
}
try {
T invoke = block.invoke();
InlineMarker.finallyStart(1);
if (loggingEnabled) {
log(task, queue, "finished run in " + formatDuration(queue.getTaskRunner().getBackend().nanoTime() - startNs));
}
InlineMarker.finallyEnd(1);
return invoke;
} catch (Throwable th) {
InlineMarker.finallyStart(1);
if (loggingEnabled) {
long elapsedNs = queue.getTaskRunner().getBackend().nanoTime() - startNs;
if (0 != 0) {
log(task, queue, "finished run in " + formatDuration(elapsedNs));
} else {
log(task, queue, "failed a run in " + formatDuration(elapsedNs));
}
}
InlineMarker.finallyEnd(1);
throw th;
}
}
/* JADX INFO: Access modifiers changed from: private */
public static final void log(Task task, TaskQueue queue, String message) {
Logger logger = TaskRunner.INSTANCE.getLogger();
StringBuilder sb = new StringBuilder();
sb.append(queue.getName());
sb.append(' ');
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("%-22s", Arrays.copyOf(new Object[]{message}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
sb.append(format);
sb.append(": ");
sb.append(task.getName());
logger.fine(sb.toString());
}
public static final String formatDuration(long ns) {
String s;
if (ns <= -999500000) {
s = ((ns - 500000000) / 1000000000) + " s ";
} else if (ns <= -999500) {
s = ((ns - 500000) / 1000000) + " ms";
} else if (ns <= 0) {
s = ((ns - 500) / 1000) + " µs";
} else if (ns < 999500) {
s = ((500 + ns) / 1000) + " µs";
} else if (ns < 999500000) {
s = ((500000 + ns) / 1000000) + " ms";
} else {
s = ((500000000 + ns) / 1000000000) + " s ";
}
StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
String format = String.format("%6s", Arrays.copyOf(new Object[]{s}, 1));
Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
return format;
}
}
@@ -0,0 +1,27 @@
package okhttp3.internal.concurrent;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
/* compiled from: TaskQueue.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0011\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\u0002\u001a\u00020\u0003H\u0016¨\u0006\u0004"}, m238d2 = {"okhttp3/internal/concurrent/TaskQueue$execute$1", "Lokhttp3/internal/concurrent/Task;", "runOnce", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class TaskQueue$execute$1 extends Task {
final /* synthetic */ Function0 $block;
final /* synthetic */ boolean $cancelable;
final /* synthetic */ String $name;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public TaskQueue$execute$1(Function0 $captured_local_variable$0, String $captured_local_variable$1, boolean $captured_local_variable$2, String $super_call_param$3, boolean $super_call_param$4) {
super($super_call_param$3, $super_call_param$4);
this.$block = $captured_local_variable$0;
this.$name = $captured_local_variable$1;
this.$cancelable = $captured_local_variable$2;
}
@Override // okhttp3.internal.concurrent.Task
public long runOnce() {
this.$block.invoke();
return -1L;
}
}
@@ -0,0 +1,24 @@
package okhttp3.internal.concurrent;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
/* compiled from: TaskQueue.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0011\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000*\u0001\u0000\b\n\u0018\u00002\u00020\u0001J\b\u0010\u0002\u001a\u00020\u0003H\u0016¨\u0006\u0004"}, m238d2 = {"okhttp3/internal/concurrent/TaskQueue$schedule$2", "Lokhttp3/internal/concurrent/Task;", "runOnce", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class TaskQueue$schedule$2 extends Task {
final /* synthetic */ Function0 $block;
final /* synthetic */ String $name;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public TaskQueue$schedule$2(Function0 $captured_local_variable$0, String $captured_local_variable$1, String $super_call_param$2) {
super($super_call_param$2, false, 2, null);
this.$block = $captured_local_variable$0;
this.$name = $captured_local_variable$1;
}
@Override // okhttp3.internal.concurrent.Task
public long runOnce() {
return ((Number) this.$block.invoke()).longValue();
}
}
@@ -0,0 +1,310 @@
package okhttp3.internal.concurrent;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.RejectedExecutionException;
import java.util.logging.Level;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.internal.Util;
/* compiled from: TaskQueue.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000V\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0010!\n\u0002\b\u0005\n\u0002\u0010 \n\u0002\b\u0007\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\b\u0018\u00002\u00020\u0001:\u00013B\u0017\b\u0000\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\u0006\u0010!\u001a\u00020\"J\r\u0010#\u001a\u00020\u000eH\u0000¢\u0006\u0002\b$J8\u0010%\u001a\u00020\"2\u0006\u0010\u0004\u001a\u00020\u00052\b\b\u0002\u0010&\u001a\u00020'2\b\b\u0002\u0010(\u001a\u00020\u000e2\u000e\b\u0004\u0010)\u001a\b\u0012\u0004\u0012\u00020\"0*H\u0086\\u0001\u0000J\u0006\u0010+\u001a\u00020,J.\u0010-\u001a\u00020\"2\u0006\u0010\u0004\u001a\u00020\u00052\b\b\u0002\u0010&\u001a\u00020'2\u000e\b\u0004\u0010)\u001a\b\u0012\u0004\u0012\u00020'0*H\u0086\\u0001\u0000J\u0018\u0010-\u001a\u00020\"2\u0006\u0010.\u001a\u00020\b2\b\b\u0002\u0010&\u001a\u00020'J%\u0010/\u001a\u00020\u000e2\u0006\u0010.\u001a\u00020\b2\u0006\u0010&\u001a\u00020'2\u0006\u00100\u001a\u00020\u000eH\u0000¢\u0006\u0002\b1J\u0006\u0010\u001c\u001a\u00020\"J\b\u00102\u001a\u00020\u0005H\u0016R\u001c\u0010\u0007\u001a\u0004\u0018\u00010\bX\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\t\u0010\n\"\u0004\b\u000b\u0010\fR\u001a\u0010\r\u001a\u00020\u000eX\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000f\u0010\u0010\"\u0004\b\u0011\u0010\u0012R\u001a\u0010\u0013\u001a\b\u0012\u0004\u0012\u00020\b0\u0014X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0015\u0010\u0016R\u0014\u0010\u0004\u001a\u00020\u0005X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0017\u0010\u0018R\u0017\u0010\u0019\u001a\b\u0012\u0004\u0012\u00020\b0\u001a8F¢\u0006\u0006\u001a\u0004\b\u001b\u0010\u0016R\u001a\u0010\u001c\u001a\u00020\u000eX\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001d\u0010\u0010\"\u0004\b\u001e\u0010\u0012R\u0014\u0010\u0002\u001a\u00020\u0003X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u001f\u0010 \u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u00064"}, m238d2 = {"Lokhttp3/internal/concurrent/TaskQueue;", "", "taskRunner", "Lokhttp3/internal/concurrent/TaskRunner;", "name", "", "(Lokhttp3/internal/concurrent/TaskRunner;Ljava/lang/String;)V", "activeTask", "Lokhttp3/internal/concurrent/Task;", "getActiveTask$okhttp", "()Lokhttp3/internal/concurrent/Task;", "setActiveTask$okhttp", "(Lokhttp3/internal/concurrent/Task;)V", "cancelActiveTask", "", "getCancelActiveTask$okhttp", "()Z", "setCancelActiveTask$okhttp", "(Z)V", "futureTasks", "", "getFutureTasks$okhttp", "()Ljava/util/List;", "getName$okhttp", "()Ljava/lang/String;", "scheduledTasks", "", "getScheduledTasks", "shutdown", "getShutdown$okhttp", "setShutdown$okhttp", "getTaskRunner$okhttp", "()Lokhttp3/internal/concurrent/TaskRunner;", "cancelAll", "", "cancelAllAndDecide", "cancelAllAndDecide$okhttp", "execute", "delayNanos", "", "cancelable", "block", "Lkotlin/Function0;", "idleLatch", "Ljava/util/concurrent/CountDownLatch;", "schedule", "task", "scheduleAndDecide", "recurrence", "scheduleAndDecide$okhttp", "toString", "AwaitIdleTask", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class TaskQueue {
private Task activeTask;
private boolean cancelActiveTask;
private final List<Task> futureTasks;
private final String name;
private boolean shutdown;
private final TaskRunner taskRunner;
public TaskQueue(TaskRunner taskRunner, String name) {
Intrinsics.checkNotNullParameter(taskRunner, "taskRunner");
Intrinsics.checkNotNullParameter(name, "name");
this.taskRunner = taskRunner;
this.name = name;
this.futureTasks = new ArrayList();
}
/* renamed from: getTaskRunner$okhttp, reason: from getter */
public final TaskRunner getTaskRunner() {
return this.taskRunner;
}
/* renamed from: getName$okhttp, reason: from getter */
public final String getName() {
return this.name;
}
/* renamed from: getShutdown$okhttp, reason: from getter */
public final boolean getShutdown() {
return this.shutdown;
}
public final void setShutdown$okhttp(boolean z) {
this.shutdown = z;
}
/* renamed from: getActiveTask$okhttp, reason: from getter */
public final Task getActiveTask() {
return this.activeTask;
}
public final void setActiveTask$okhttp(Task task) {
this.activeTask = task;
}
public final List<Task> getFutureTasks$okhttp() {
return this.futureTasks;
}
/* renamed from: getCancelActiveTask$okhttp, reason: from getter */
public final boolean getCancelActiveTask() {
return this.cancelActiveTask;
}
public final void setCancelActiveTask$okhttp(boolean z) {
this.cancelActiveTask = z;
}
public final List<Task> getScheduledTasks() {
List<Task> list;
synchronized (this.taskRunner) {
list = CollectionsKt.toList(this.futureTasks);
}
return list;
}
public static /* synthetic */ void schedule$default(TaskQueue taskQueue, Task task, long j, int i, Object obj) {
if ((i & 2) != 0) {
j = 0;
}
taskQueue.schedule(task, j);
}
public final void schedule(Task task, long delayNanos) {
Intrinsics.checkNotNullParameter(task, "task");
synchronized (this.taskRunner) {
if (this.shutdown) {
if (task.getCancelable()) {
if (TaskRunner.INSTANCE.getLogger().isLoggable(Level.FINE)) {
TaskLoggerKt.log(task, this, "schedule canceled (queue is shutdown)");
}
return;
} else {
if (TaskRunner.INSTANCE.getLogger().isLoggable(Level.FINE)) {
TaskLoggerKt.log(task, this, "schedule failed (queue is shutdown)");
}
throw new RejectedExecutionException();
}
}
if (scheduleAndDecide$okhttp(task, delayNanos, false)) {
this.taskRunner.kickCoordinator$okhttp(this);
}
Unit unit = Unit.INSTANCE;
}
}
public static /* synthetic */ void schedule$default(TaskQueue taskQueue, String name, long delayNanos, Function0 block, int i, Object obj) {
if ((i & 2) != 0) {
delayNanos = 0;
}
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(block, "block");
taskQueue.schedule(new TaskQueue$schedule$2(block, name, name), delayNanos);
}
public final void schedule(String name, long delayNanos, Function0<Long> block) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(block, "block");
schedule(new TaskQueue$schedule$2(block, name, name), delayNanos);
}
public static /* synthetic */ void execute$default(TaskQueue taskQueue, String name, long delayNanos, boolean cancelable, Function0 block, int i, Object obj) {
if ((i & 2) != 0) {
delayNanos = 0;
}
if ((i & 4) != 0) {
cancelable = true;
}
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(block, "block");
taskQueue.schedule(new TaskQueue$execute$1(block, name, cancelable, name, cancelable), delayNanos);
}
public final void execute(String name, long delayNanos, boolean cancelable, Function0<Unit> block) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(block, "block");
schedule(new TaskQueue$execute$1(block, name, cancelable, name, cancelable), delayNanos);
}
public final CountDownLatch idleLatch() {
synchronized (this.taskRunner) {
if (this.activeTask == null && this.futureTasks.isEmpty()) {
return new CountDownLatch(0);
}
Task existingTask = this.activeTask;
if (existingTask instanceof AwaitIdleTask) {
return ((AwaitIdleTask) existingTask).getLatch();
}
for (Task futureTask : this.futureTasks) {
if (futureTask instanceof AwaitIdleTask) {
return ((AwaitIdleTask) futureTask).getLatch();
}
}
AwaitIdleTask newTask = new AwaitIdleTask();
if (scheduleAndDecide$okhttp(newTask, 0L, false)) {
this.taskRunner.kickCoordinator$okhttp(this);
}
return newTask.getLatch();
}
}
/* compiled from: TaskQueue.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\t\n\u0000\b\u0002\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0007\u001a\u00020\bH\u0016R\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006¨\u0006\t"}, m238d2 = {"Lokhttp3/internal/concurrent/TaskQueue$AwaitIdleTask;", "Lokhttp3/internal/concurrent/Task;", "()V", "latch", "Ljava/util/concurrent/CountDownLatch;", "getLatch", "()Ljava/util/concurrent/CountDownLatch;", "runOnce", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private static final class AwaitIdleTask extends Task {
private final CountDownLatch latch;
public AwaitIdleTask() {
super(Util.okHttpName + " awaitIdle", false);
this.latch = new CountDownLatch(1);
}
public final CountDownLatch getLatch() {
return this.latch;
}
@Override // okhttp3.internal.concurrent.Task
public long runOnce() {
this.latch.countDown();
return -1L;
}
}
public final boolean scheduleAndDecide$okhttp(Task task, long delayNanos, boolean recurrence) {
String str;
Intrinsics.checkNotNullParameter(task, "task");
task.initQueue$okhttp(this);
long now = this.taskRunner.getBackend().nanoTime();
long executeNanoTime = now + delayNanos;
int existingIndex = this.futureTasks.indexOf(task);
if (existingIndex != -1) {
if (task.getNextExecuteNanoTime() > executeNanoTime) {
this.futureTasks.remove(existingIndex);
} else {
if (TaskRunner.INSTANCE.getLogger().isLoggable(Level.FINE)) {
TaskLoggerKt.log(task, this, "already scheduled");
}
return false;
}
}
task.setNextExecuteNanoTime$okhttp(executeNanoTime);
if (TaskRunner.INSTANCE.getLogger().isLoggable(Level.FINE)) {
if (recurrence) {
str = "run again after " + TaskLoggerKt.formatDuration(executeNanoTime - now);
} else {
str = "scheduled after " + TaskLoggerKt.formatDuration(executeNanoTime - now);
}
TaskLoggerKt.log(task, this, str);
}
List $this$indexOfFirst$iv = this.futureTasks;
int index$iv = 0;
Iterator<Task> it = $this$indexOfFirst$iv.iterator();
while (true) {
if (it.hasNext()) {
Object item$iv = it.next();
Task it2 = (Task) item$iv;
Task it3 = it2.getNextExecuteNanoTime() - now > delayNanos ? 1 : null;
if (it3 != null) {
break;
}
index$iv++;
} else {
index$iv = -1;
break;
}
}
int insertAt = index$iv;
if (insertAt == -1) {
insertAt = this.futureTasks.size();
}
this.futureTasks.add(insertAt, task);
return insertAt == 0;
}
public final void cancelAll() {
if (Util.assertionsEnabled && Thread.holdsLock(this)) {
StringBuilder sb = new StringBuilder();
sb.append("Thread ");
Thread currentThread = Thread.currentThread();
Intrinsics.checkNotNullExpressionValue(currentThread, "Thread.currentThread()");
sb.append(currentThread.getName());
sb.append(" MUST NOT hold lock on ");
sb.append(this);
throw new AssertionError(sb.toString());
}
Object $this$assertThreadDoesntHoldLock$iv = this.taskRunner;
synchronized ($this$assertThreadDoesntHoldLock$iv) {
if (cancelAllAndDecide$okhttp()) {
this.taskRunner.kickCoordinator$okhttp(this);
}
Unit unit = Unit.INSTANCE;
}
}
public final void shutdown() {
if (Util.assertionsEnabled && Thread.holdsLock(this)) {
StringBuilder sb = new StringBuilder();
sb.append("Thread ");
Thread currentThread = Thread.currentThread();
Intrinsics.checkNotNullExpressionValue(currentThread, "Thread.currentThread()");
sb.append(currentThread.getName());
sb.append(" MUST NOT hold lock on ");
sb.append(this);
throw new AssertionError(sb.toString());
}
Object $this$assertThreadDoesntHoldLock$iv = this.taskRunner;
synchronized ($this$assertThreadDoesntHoldLock$iv) {
this.shutdown = true;
if (cancelAllAndDecide$okhttp()) {
this.taskRunner.kickCoordinator$okhttp(this);
}
Unit unit = Unit.INSTANCE;
}
}
public final boolean cancelAllAndDecide$okhttp() {
Task task = this.activeTask;
if (task != null) {
Intrinsics.checkNotNull(task);
if (task.getCancelable()) {
this.cancelActiveTask = true;
}
}
boolean tasksCanceled = false;
int size = this.futureTasks.size() - 1;
while (size >= 0) {
int i = size;
if (this.futureTasks.get(i).getCancelable()) {
Task task$iv = this.futureTasks.get(i);
if (TaskRunner.INSTANCE.getLogger().isLoggable(Level.FINE)) {
TaskLoggerKt.log(task$iv, this, "canceled");
}
tasksCanceled = true;
this.futureTasks.remove(i);
}
size = i - 1;
}
return tasksCanceled;
}
public String toString() {
return this.name;
}
}
@@ -0,0 +1,376 @@
package okhttp3.internal.concurrent;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.LongCompanionObject;
import okhttp3.internal.Util;
/* compiled from: TaskRunner.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000J\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010!\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\r\u0018\u0000 #2\u00020\u0001:\u0003\"#$B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\f\u0010\u0013\u001a\b\u0012\u0004\u0012\u00020\t0\u0014J\u0018\u0010\u0015\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0019\u001a\u00020\rH\u0002J\b\u0010\u001a\u001a\u0004\u0018\u00010\u0018J\u0010\u0010\u001b\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u0018H\u0002J\u0006\u0010\u001c\u001a\u00020\u0016J\u0015\u0010\u001d\u001a\u00020\u00162\u0006\u0010\u001e\u001a\u00020\tH\u0000¢\u0006\u0002\b\u001fJ\u0006\u0010 \u001a\u00020\tJ\u0010\u0010!\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u0018H\u0002R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006R\u0014\u0010\u0007\u001a\b\u0012\u0004\u0012\u00020\t0\bX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\rX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u000fX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u0010\u001a\b\u0012\u0004\u0012\u00020\t0\bX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0012X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006%"}, m238d2 = {"Lokhttp3/internal/concurrent/TaskRunner;", "", "backend", "Lokhttp3/internal/concurrent/TaskRunner$Backend;", "(Lokhttp3/internal/concurrent/TaskRunner$Backend;)V", "getBackend", "()Lokhttp3/internal/concurrent/TaskRunner$Backend;", "busyQueues", "", "Lokhttp3/internal/concurrent/TaskQueue;", "coordinatorWaiting", "", "coordinatorWakeUpAt", "", "nextQueueName", "", "readyQueues", "runnable", "Ljava/lang/Runnable;", "activeQueues", "", "afterRun", "", "task", "Lokhttp3/internal/concurrent/Task;", "delayNanos", "awaitTaskToRun", "beforeRun", "cancelAll", "kickCoordinator", "taskQueue", "kickCoordinator$okhttp", "newQueue", "runTask", "Backend", "Companion", "RealBackend", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class TaskRunner {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
public static final TaskRunner INSTANCE = new TaskRunner(new RealBackend(Util.threadFactory(Util.okHttpName + " TaskRunner", true)));
private static final Logger logger;
private final Backend backend;
private final List<TaskQueue> busyQueues;
private boolean coordinatorWaiting;
private long coordinatorWakeUpAt;
private int nextQueueName;
private final List<TaskQueue> readyQueues;
private final Runnable runnable;
/* compiled from: TaskRunner.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\bf\u0018\u00002\u00020\u0001J\u0010\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0005H&J\u0010\u0010\u0006\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0005H&J\u0018\u0010\u0007\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\b\u001a\u00020\tH&J\u0010\u0010\n\u001a\u00020\u00032\u0006\u0010\u000b\u001a\u00020\fH&J\b\u0010\r\u001a\u00020\tH&¨\u0006\u000e"}, m238d2 = {"Lokhttp3/internal/concurrent/TaskRunner$Backend;", "", "beforeTask", "", "taskRunner", "Lokhttp3/internal/concurrent/TaskRunner;", "coordinatorNotify", "coordinatorWait", "nanos", "", "execute", "runnable", "Ljava/lang/Runnable;", "nanoTime", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public interface Backend {
void beforeTask(TaskRunner taskRunner);
void coordinatorNotify(TaskRunner taskRunner);
void coordinatorWait(TaskRunner taskRunner, long nanos);
void execute(Runnable runnable);
long nanoTime();
}
public TaskRunner(Backend backend) {
Intrinsics.checkNotNullParameter(backend, "backend");
this.backend = backend;
this.nextQueueName = 10000;
this.busyQueues = new ArrayList();
this.readyQueues = new ArrayList();
this.runnable = new Runnable() { // from class: okhttp3.internal.concurrent.TaskRunner$runnable$1
@Override // java.lang.Runnable
public void run() {
Task task;
while (true) {
synchronized (TaskRunner.this) {
task = TaskRunner.this.awaitTaskToRun();
}
if (task == null) {
return;
}
TaskQueue queue$iv = task.getQueue();
Intrinsics.checkNotNull(queue$iv);
long startNs$iv = -1;
boolean loggingEnabled$iv = TaskRunner.INSTANCE.getLogger().isLoggable(Level.FINE);
if (loggingEnabled$iv) {
startNs$iv = queue$iv.getTaskRunner().getBackend().nanoTime();
TaskLoggerKt.log(task, queue$iv, "starting");
}
try {
TaskRunner.this.runTask(task);
try {
Unit unit = Unit.INSTANCE;
if (loggingEnabled$iv) {
TaskLoggerKt.log(task, queue$iv, "finished run in " + TaskLoggerKt.formatDuration(queue$iv.getTaskRunner().getBackend().nanoTime() - startNs$iv));
}
} catch (Throwable th) {
if (loggingEnabled$iv) {
long elapsedNs$iv = queue$iv.getTaskRunner().getBackend().nanoTime() - startNs$iv;
if (0 != 0) {
TaskLoggerKt.log(task, queue$iv, "finished run in " + TaskLoggerKt.formatDuration(elapsedNs$iv));
} else {
TaskLoggerKt.log(task, queue$iv, "failed a run in " + TaskLoggerKt.formatDuration(elapsedNs$iv));
}
}
throw th;
}
} finally {
}
}
}
};
}
public final Backend getBackend() {
return this.backend;
}
public final void kickCoordinator$okhttp(TaskQueue taskQueue) {
Intrinsics.checkNotNullParameter(taskQueue, "taskQueue");
if (Util.assertionsEnabled && !Thread.holdsLock(this)) {
StringBuilder sb = new StringBuilder();
sb.append("Thread ");
Thread currentThread = Thread.currentThread();
Intrinsics.checkNotNullExpressionValue(currentThread, "Thread.currentThread()");
sb.append(currentThread.getName());
sb.append(" MUST hold lock on ");
sb.append(this);
throw new AssertionError(sb.toString());
}
Object $this$assertThreadHoldsLock$iv = taskQueue.getActiveTask();
if ($this$assertThreadHoldsLock$iv == null) {
if (!taskQueue.getFutureTasks$okhttp().isEmpty()) {
Util.addIfAbsent(this.readyQueues, taskQueue);
} else {
this.readyQueues.remove(taskQueue);
}
}
if (this.coordinatorWaiting) {
this.backend.coordinatorNotify(this);
} else {
this.backend.execute(this.runnable);
}
}
private final void beforeRun(Task task) {
if (Util.assertionsEnabled && !Thread.holdsLock(this)) {
StringBuilder sb = new StringBuilder();
sb.append("Thread ");
Thread currentThread = Thread.currentThread();
Intrinsics.checkNotNullExpressionValue(currentThread, "Thread.currentThread()");
sb.append(currentThread.getName());
sb.append(" MUST hold lock on ");
sb.append(this);
throw new AssertionError(sb.toString());
}
task.setNextExecuteNanoTime$okhttp(-1L);
TaskQueue queue = task.getQueue();
Intrinsics.checkNotNull(queue);
queue.getFutureTasks$okhttp().remove(task);
this.readyQueues.remove(queue);
queue.setActiveTask$okhttp(task);
this.busyQueues.add(queue);
}
/* JADX INFO: Access modifiers changed from: private */
public final void runTask(Task task) {
if (Util.assertionsEnabled && Thread.holdsLock(this)) {
StringBuilder sb = new StringBuilder();
sb.append("Thread ");
Thread currentThread = Thread.currentThread();
Intrinsics.checkNotNullExpressionValue(currentThread, "Thread.currentThread()");
sb.append(currentThread.getName());
sb.append(" MUST NOT hold lock on ");
sb.append(this);
throw new AssertionError(sb.toString());
}
Thread currentThread2 = Thread.currentThread();
Intrinsics.checkNotNullExpressionValue(currentThread2, "currentThread");
String oldName = currentThread2.getName();
currentThread2.setName(task.getName());
try {
long delayNanos = task.runOnce();
synchronized (this) {
afterRun(task, delayNanos);
Unit unit = Unit.INSTANCE;
}
currentThread2.setName(oldName);
} catch (Throwable th) {
synchronized (this) {
afterRun(task, -1L);
Unit unit2 = Unit.INSTANCE;
currentThread2.setName(oldName);
throw th;
}
}
}
private final void afterRun(Task task, long delayNanos) {
if (Util.assertionsEnabled && !Thread.holdsLock(this)) {
StringBuilder sb = new StringBuilder();
sb.append("Thread ");
Thread currentThread = Thread.currentThread();
Intrinsics.checkNotNullExpressionValue(currentThread, "Thread.currentThread()");
sb.append(currentThread.getName());
sb.append(" MUST hold lock on ");
sb.append(this);
throw new AssertionError(sb.toString());
}
TaskQueue queue = task.getQueue();
Intrinsics.checkNotNull(queue);
if (!(queue.getActiveTask() == task)) {
throw new IllegalStateException("Check failed.".toString());
}
boolean cancelActiveTask = queue.getCancelActiveTask();
queue.setCancelActiveTask$okhttp(false);
queue.setActiveTask$okhttp(null);
this.busyQueues.remove(queue);
if (delayNanos != -1 && !cancelActiveTask && !queue.getShutdown()) {
queue.scheduleAndDecide$okhttp(task, delayNanos, true);
}
if (!queue.getFutureTasks$okhttp().isEmpty()) {
this.readyQueues.add(queue);
}
}
public final Task awaitTaskToRun() {
if (Util.assertionsEnabled && !Thread.holdsLock(this)) {
StringBuilder sb = new StringBuilder();
sb.append("Thread ");
Thread currentThread = Thread.currentThread();
Intrinsics.checkNotNullExpressionValue(currentThread, "Thread.currentThread()");
sb.append(currentThread.getName());
sb.append(" MUST hold lock on ");
sb.append(this);
throw new AssertionError(sb.toString());
}
while (!this.readyQueues.isEmpty()) {
long now = this.backend.nanoTime();
long minDelayNanos = LongCompanionObject.MAX_VALUE;
Task readyTask = (Task) null;
boolean multipleReadyTasks = false;
Iterator<TaskQueue> it = this.readyQueues.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
TaskQueue queue = it.next();
Task candidate = queue.getFutureTasks$okhttp().get(0);
long candidateDelay = Math.max(0L, candidate.getNextExecuteNanoTime() - now);
if (candidateDelay > 0) {
minDelayNanos = Math.min(candidateDelay, minDelayNanos);
} else {
if (readyTask != null) {
multipleReadyTasks = true;
break;
}
readyTask = candidate;
}
}
if (readyTask != null) {
beforeRun(readyTask);
if (multipleReadyTasks || (!this.coordinatorWaiting && (!this.readyQueues.isEmpty()))) {
this.backend.execute(this.runnable);
}
return readyTask;
}
if (this.coordinatorWaiting) {
if (minDelayNanos < this.coordinatorWakeUpAt - now) {
this.backend.coordinatorNotify(this);
}
return null;
}
this.coordinatorWaiting = true;
this.coordinatorWakeUpAt = now + minDelayNanos;
try {
try {
this.backend.coordinatorWait(this, minDelayNanos);
} catch (InterruptedException e) {
cancelAll();
}
} finally {
this.coordinatorWaiting = false;
}
}
return null;
}
public final TaskQueue newQueue() {
int name;
synchronized (this) {
name = this.nextQueueName;
this.nextQueueName = name + 1;
}
StringBuilder sb = new StringBuilder();
sb.append('Q');
sb.append(name);
return new TaskQueue(this, sb.toString());
}
public final List<TaskQueue> activeQueues() {
List<TaskQueue> plus;
synchronized (this) {
plus = CollectionsKt.plus((Collection) this.busyQueues, (Iterable) this.readyQueues);
}
return plus;
}
public final void cancelAll() {
for (int i = this.busyQueues.size() - 1; i >= 0; i--) {
this.busyQueues.get(i).cancelAllAndDecide$okhttp();
}
for (int i2 = this.readyQueues.size() - 1; i2 >= 0; i2--) {
TaskQueue queue = this.readyQueues.get(i2);
queue.cancelAllAndDecide$okhttp();
if (queue.getFutureTasks$okhttp().isEmpty()) {
this.readyQueues.remove(i2);
}
}
}
/* compiled from: TaskRunner.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\u0010\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\nH\u0016J\u0010\u0010\u000b\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\nH\u0016J\u0018\u0010\f\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\n2\u0006\u0010\r\u001a\u00020\u000eH\u0016J\u0010\u0010\u000f\u001a\u00020\b2\u0006\u0010\u0010\u001a\u00020\u0011H\u0016J\b\u0010\u0012\u001a\u00020\u000eH\u0016J\u0006\u0010\u0013\u001a\u00020\bR\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0014"}, m238d2 = {"Lokhttp3/internal/concurrent/TaskRunner$RealBackend;", "Lokhttp3/internal/concurrent/TaskRunner$Backend;", "threadFactory", "Ljava/util/concurrent/ThreadFactory;", "(Ljava/util/concurrent/ThreadFactory;)V", "executor", "Ljava/util/concurrent/ThreadPoolExecutor;", "beforeTask", "", "taskRunner", "Lokhttp3/internal/concurrent/TaskRunner;", "coordinatorNotify", "coordinatorWait", "nanos", "", "execute", "runnable", "Ljava/lang/Runnable;", "nanoTime", "shutdown", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class RealBackend implements Backend {
private final ThreadPoolExecutor executor;
public RealBackend(ThreadFactory threadFactory) {
Intrinsics.checkNotNullParameter(threadFactory, "threadFactory");
this.executor = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue(), threadFactory);
}
@Override // okhttp3.internal.concurrent.TaskRunner.Backend
public void beforeTask(TaskRunner taskRunner) {
Intrinsics.checkNotNullParameter(taskRunner, "taskRunner");
}
@Override // okhttp3.internal.concurrent.TaskRunner.Backend
public long nanoTime() {
return System.nanoTime();
}
@Override // okhttp3.internal.concurrent.TaskRunner.Backend
public void coordinatorNotify(TaskRunner taskRunner) {
Intrinsics.checkNotNullParameter(taskRunner, "taskRunner");
taskRunner.notify();
}
@Override // okhttp3.internal.concurrent.TaskRunner.Backend
public void coordinatorWait(TaskRunner taskRunner, long nanos) throws InterruptedException {
Intrinsics.checkNotNullParameter(taskRunner, "taskRunner");
long ms = nanos / 1000000;
long ns = nanos - (1000000 * ms);
if (ms > 0 || nanos > 0) {
taskRunner.wait(ms, (int) ns);
}
}
@Override // okhttp3.internal.concurrent.TaskRunner.Backend
public void execute(Runnable runnable) {
Intrinsics.checkNotNullParameter(runnable, "runnable");
this.executor.execute(runnable);
}
public final void shutdown() {
this.executor.shutdown();
}
}
/* compiled from: TaskRunner.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0010\u0010\u0003\u001a\u00020\u00048\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\u0005\u001a\u00020\u0006¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\\u0006\t"}, m238d2 = {"Lokhttp3/internal/concurrent/TaskRunner$Companion;", "", "()V", "INSTANCE", "Lokhttp3/internal/concurrent/TaskRunner;", "logger", "Ljava/util/logging/Logger;", "getLogger", "()Ljava/util/logging/Logger;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public final Logger getLogger() {
return TaskRunner.logger;
}
}
static {
Logger logger2 = Logger.getLogger(TaskRunner.class.getName());
Intrinsics.checkNotNullExpressionValue(logger2, "Logger.getLogger(TaskRunner::class.java.name)");
logger = logger2;
}
}
@@ -0,0 +1,27 @@
package okhttp3.internal.connection;
import java.io.IOException;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.Interceptor;
import okhttp3.Response;
import okhttp3.internal.http.RealInterceptorChain;
/* compiled from: ConnectInterceptor.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0016¨\u0006\u0007"}, m238d2 = {"Lokhttp3/internal/connection/ConnectInterceptor;", "Lokhttp3/Interceptor;", "()V", "intercept", "Lokhttp3/Response;", "chain", "Lokhttp3/Interceptor$Chain;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class ConnectInterceptor implements Interceptor {
public static final ConnectInterceptor INSTANCE = new ConnectInterceptor();
private ConnectInterceptor() {
}
@Override // okhttp3.Interceptor
public Response intercept(Interceptor.Chain chain) throws IOException {
Intrinsics.checkNotNullParameter(chain, "chain");
RealInterceptorChain realChain = (RealInterceptorChain) chain;
Exchange exchange = realChain.getCall().initExchange$okhttp((RealInterceptorChain) chain);
RealInterceptorChain connectedChain = RealInterceptorChain.copy$okhttp$default(realChain, 0, exchange, null, 0, 0, 0, 61, null);
return connectedChain.proceed(realChain.getRequest());
}
}
@@ -0,0 +1,88 @@
package okhttp3.internal.connection;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.ProtocolException;
import java.net.UnknownServiceException;
import java.security.cert.CertificateException;
import java.util.Arrays;
import java.util.List;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSocket;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.ConnectionSpec;
/* compiled from: ConnectionSpecSelector.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00006\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0000\u0018\u00002\u00020\u0001B\u0013\u0012\f\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003¢\u0006\u0002\u0010\u0005J\u000e\u0010\u000b\u001a\u00020\u00042\u0006\u0010\f\u001a\u00020\rJ\u000e\u0010\u000e\u001a\u00020\u00072\u0006\u0010\u000f\u001a\u00020\u0010J\u0010\u0010\b\u001a\u00020\u00072\u0006\u0010\u0011\u001a\u00020\rH\u0002R\u0014\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\nX\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0012"}, m238d2 = {"Lokhttp3/internal/connection/ConnectionSpecSelector;", "", "connectionSpecs", "", "Lokhttp3/ConnectionSpec;", "(Ljava/util/List;)V", "isFallback", "", "isFallbackPossible", "nextModeIndex", "", "configureSecureSocket", "sslSocket", "Ljavax/net/ssl/SSLSocket;", "connectionFailed", "e", "Ljava/io/IOException;", "socket", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class ConnectionSpecSelector {
private final List<ConnectionSpec> connectionSpecs;
private boolean isFallback;
private boolean isFallbackPossible;
private int nextModeIndex;
public ConnectionSpecSelector(List<ConnectionSpec> connectionSpecs) {
Intrinsics.checkNotNullParameter(connectionSpecs, "connectionSpecs");
this.connectionSpecs = connectionSpecs;
}
public final ConnectionSpec configureSecureSocket(SSLSocket sslSocket) throws IOException {
Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
ConnectionSpec tlsConfiguration = (ConnectionSpec) null;
int i = this.nextModeIndex;
int size = this.connectionSpecs.size();
while (true) {
if (i >= size) {
break;
}
ConnectionSpec connectionSpec = this.connectionSpecs.get(i);
if (connectionSpec.isCompatible(sslSocket)) {
tlsConfiguration = connectionSpec;
this.nextModeIndex = i + 1;
break;
}
i++;
}
if (tlsConfiguration == null) {
StringBuilder sb = new StringBuilder();
sb.append("Unable to find acceptable protocols. isFallback=");
sb.append(this.isFallback);
sb.append(',');
sb.append(" modes=");
sb.append(this.connectionSpecs);
sb.append(',');
sb.append(" supported protocols=");
String[] enabledProtocols = sslSocket.getEnabledProtocols();
Intrinsics.checkNotNull(enabledProtocols);
String arrays = Arrays.toString(enabledProtocols);
Intrinsics.checkNotNullExpressionValue(arrays, "java.util.Arrays.toString(this)");
sb.append(arrays);
throw new UnknownServiceException(sb.toString());
}
this.isFallbackPossible = isFallbackPossible(sslSocket);
tlsConfiguration.apply$okhttp(sslSocket, this.isFallback);
return tlsConfiguration;
}
public final boolean connectionFailed(IOException e) {
Intrinsics.checkNotNullParameter(e, "e");
this.isFallback = true;
if (this.isFallbackPossible && !(e instanceof ProtocolException) && !(e instanceof InterruptedIOException)) {
return (((e instanceof SSLHandshakeException) && (e.getCause() instanceof CertificateException)) || (e instanceof SSLPeerUnverifiedException) || !(e instanceof SSLException)) ? false : true;
}
return false;
}
private final boolean isFallbackPossible(SSLSocket socket) {
int size = this.connectionSpecs.size();
for (int i = this.nextModeIndex; i < size; i++) {
if (this.connectionSpecs.get(i).isCompatible(socket)) {
return true;
}
}
return false;
}
}
@@ -0,0 +1,366 @@
package okhttp3.internal.connection;
import androidx.core.app.NotificationCompat;
import com.google.common.net.HttpHeaders;
import java.io.IOException;
import java.net.ProtocolException;
import java.net.SocketException;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.EventListener;
import okhttp3.Headers;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.internal.http.ExchangeCodec;
import okhttp3.internal.http.RealResponseBody;
import okhttp3.internal.ws.RealWebSocket;
import okio.Buffer;
import okio.ForwardingSink;
import okio.ForwardingSource;
import okio.Okio;
import okio.Sink;
import okio.Source;
/* compiled from: Exchange.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000z\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u000b\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\u0018\u00002\u00020\u0001:\u0002ABB%\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\\u0006\u0002\u0010\nJ7\u0010\u001c\u001a\u0002H\u001d\"\n\b\u0000\u0010\u001d*\u0004\u0018\u00010\u001e2\u0006\u0010\u001f\u001a\u00020 2\u0006\u0010!\u001a\u00020\u00162\u0006\u0010\"\u001a\u00020\u00162\u0006\u0010#\u001a\u0002H\u001d¢\u0006\u0002\u0010$J\u0006\u0010%\u001a\u00020&J\u0016\u0010'\u001a\u00020(2\u0006\u0010)\u001a\u00020*2\u0006\u0010+\u001a\u00020\u0016J\u0006\u0010,\u001a\u00020&J\u0006\u0010-\u001a\u00020&J\u0006\u0010.\u001a\u00020&J\u0006\u0010/\u001a\u000200J\u0006\u00101\u001a\u00020&J\u0006\u00102\u001a\u00020&J\u000e\u00103\u001a\u0002042\u0006\u00105\u001a\u000206J\u0010\u00107\u001a\u0004\u0018\u0001082\u0006\u00109\u001a\u00020\u0016J\u000e\u0010:\u001a\u00020&2\u0006\u00105\u001a\u000206J\u0006\u0010;\u001a\u00020&J\u0010\u0010<\u001a\u00020&2\u0006\u0010#\u001a\u00020\u001eH\u0002J\u0006\u0010=\u001a\u00020>J\u0006\u0010?\u001a\u00020&J\u000e\u0010@\u001a\u00020&2\u0006\u0010)\u001a\u00020*R\u0014\u0010\u0002\u001a\u00020\u0003X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\fR\u000e\u0010\b\u001a\u00020\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\r\u001a\u00020\u000eX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u000f\u0010\u0010R\u0014\u0010\u0004\u001a\u00020\u0005X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0011\u0010\u0012R\u0014\u0010\u0006\u001a\u00020\u0007X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0013\u0010\u0014R\u0014\u0010\u0015\u001a\u00020\u00168@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\u0017\u0010\u0018R\u001e\u0010\u001a\u001a\u00020\u00162\u0006\u0010\u0019\u001a\u00020\u0016@BX\u0080\u000e¢\u0006\b\n\u0000\u001a\u0004\b\u001b\u0010\u0018¨\u0006C"}, m238d2 = {"Lokhttp3/internal/connection/Exchange;", "", NotificationCompat.CATEGORY_CALL, "Lokhttp3/internal/connection/RealCall;", "eventListener", "Lokhttp3/EventListener;", "finder", "Lokhttp3/internal/connection/ExchangeFinder;", "codec", "Lokhttp3/internal/http/ExchangeCodec;", "(Lokhttp3/internal/connection/RealCall;Lokhttp3/EventListener;Lokhttp3/internal/connection/ExchangeFinder;Lokhttp3/internal/http/ExchangeCodec;)V", "getCall$okhttp", "()Lokhttp3/internal/connection/RealCall;", "connection", "Lokhttp3/internal/connection/RealConnection;", "getConnection$okhttp", "()Lokhttp3/internal/connection/RealConnection;", "getEventListener$okhttp", "()Lokhttp3/EventListener;", "getFinder$okhttp", "()Lokhttp3/internal/connection/ExchangeFinder;", "isCoalescedConnection", "", "isCoalescedConnection$okhttp", "()Z", "<set-?>", "isDuplex", "isDuplex$okhttp", "bodyComplete", "E", "Ljava/io/IOException;", "bytesRead", "", "responseDone", "requestDone", "e", "(JZZLjava/io/IOException;)Ljava/io/IOException;", "cancel", "", "createRequestBody", "Lokio/Sink;", "request", "Lokhttp3/Request;", "duplex", "detachWithViolence", "finishRequest", "flushRequest", "newWebSocketStreams", "Lokhttp3/internal/ws/RealWebSocket$Streams;", "noNewExchangesOnConnection", "noRequestBody", "openResponseBody", "Lokhttp3/ResponseBody;", "response", "Lokhttp3/Response;", "readResponseHeaders", "Lokhttp3/Response$Builder;", "expectContinue", "responseHeadersEnd", "responseHeadersStart", "trackFailure", "trailers", "Lokhttp3/Headers;", "webSocketUpgradeFailed", "writeRequestHeaders", "RequestBodySink", "ResponseBodySource", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Exchange {
private final RealCall call;
private final ExchangeCodec codec;
private final RealConnection connection;
private final EventListener eventListener;
private final ExchangeFinder finder;
private boolean isDuplex;
public Exchange(RealCall call, EventListener eventListener, ExchangeFinder finder, ExchangeCodec codec) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(eventListener, "eventListener");
Intrinsics.checkNotNullParameter(finder, "finder");
Intrinsics.checkNotNullParameter(codec, "codec");
this.call = call;
this.eventListener = eventListener;
this.finder = finder;
this.codec = codec;
this.connection = codec.getConnection();
}
/* renamed from: getCall$okhttp, reason: from getter */
public final RealCall getCall() {
return this.call;
}
/* renamed from: getEventListener$okhttp, reason: from getter */
public final EventListener getEventListener() {
return this.eventListener;
}
/* renamed from: getFinder$okhttp, reason: from getter */
public final ExchangeFinder getFinder() {
return this.finder;
}
/* renamed from: isDuplex$okhttp, reason: from getter */
public final boolean getIsDuplex() {
return this.isDuplex;
}
/* renamed from: getConnection$okhttp, reason: from getter */
public final RealConnection getConnection() {
return this.connection;
}
public final boolean isCoalescedConnection$okhttp() {
return !Intrinsics.areEqual(this.finder.getAddress().url().host(), this.connection.getRoute().address().url().host());
}
public final void writeRequestHeaders(Request request) throws IOException {
Intrinsics.checkNotNullParameter(request, "request");
try {
this.eventListener.requestHeadersStart(this.call);
this.codec.writeRequestHeaders(request);
this.eventListener.requestHeadersEnd(this.call, request);
} catch (IOException e) {
this.eventListener.requestFailed(this.call, e);
trackFailure(e);
throw e;
}
}
public final Sink createRequestBody(Request request, boolean duplex) throws IOException {
Intrinsics.checkNotNullParameter(request, "request");
this.isDuplex = duplex;
RequestBody body = request.body();
Intrinsics.checkNotNull(body);
long contentLength = body.contentLength();
this.eventListener.requestBodyStart(this.call);
Sink rawRequestBody = this.codec.createRequestBody(request, contentLength);
return new RequestBodySink(this, rawRequestBody, contentLength);
}
public final void flushRequest() throws IOException {
try {
this.codec.flushRequest();
} catch (IOException e) {
this.eventListener.requestFailed(this.call, e);
trackFailure(e);
throw e;
}
}
public final void finishRequest() throws IOException {
try {
this.codec.finishRequest();
} catch (IOException e) {
this.eventListener.requestFailed(this.call, e);
trackFailure(e);
throw e;
}
}
public final void responseHeadersStart() {
this.eventListener.responseHeadersStart(this.call);
}
public final Response.Builder readResponseHeaders(boolean expectContinue) throws IOException {
try {
Response.Builder result = this.codec.readResponseHeaders(expectContinue);
if (result != null) {
result.initExchange$okhttp(this);
}
return result;
} catch (IOException e) {
this.eventListener.responseFailed(this.call, e);
trackFailure(e);
throw e;
}
}
public final void responseHeadersEnd(Response response) {
Intrinsics.checkNotNullParameter(response, "response");
this.eventListener.responseHeadersEnd(this.call, response);
}
public final ResponseBody openResponseBody(Response response) throws IOException {
Intrinsics.checkNotNullParameter(response, "response");
try {
String contentType = Response.header$default(response, HttpHeaders.CONTENT_TYPE, null, 2, null);
long contentLength = this.codec.reportedContentLength(response);
Source rawSource = this.codec.openResponseBodySource(response);
ResponseBodySource source = new ResponseBodySource(this, rawSource, contentLength);
return new RealResponseBody(contentType, contentLength, Okio.buffer(source));
} catch (IOException e) {
this.eventListener.responseFailed(this.call, e);
trackFailure(e);
throw e;
}
}
public final Headers trailers() throws IOException {
return this.codec.trailers();
}
public final RealWebSocket.Streams newWebSocketStreams() throws SocketException {
this.call.timeoutEarlyExit();
return this.codec.getConnection().newWebSocketStreams$okhttp(this);
}
public final void webSocketUpgradeFailed() {
bodyComplete(-1L, true, true, null);
}
public final void noNewExchangesOnConnection() {
this.codec.getConnection().noNewExchanges$okhttp();
}
public final void cancel() {
this.codec.cancel();
}
public final void detachWithViolence() {
this.codec.cancel();
this.call.messageDone$okhttp(this, true, true, null);
}
private final void trackFailure(IOException e) {
this.finder.trackFailure(e);
this.codec.getConnection().trackFailure$okhttp(this.call, e);
}
public final <E extends IOException> E bodyComplete(long bytesRead, boolean responseDone, boolean requestDone, E e) {
if (e != null) {
trackFailure(e);
}
if (requestDone) {
if (e != null) {
this.eventListener.requestFailed(this.call, e);
} else {
this.eventListener.requestBodyEnd(this.call, bytesRead);
}
}
if (responseDone) {
if (e != null) {
this.eventListener.responseFailed(this.call, e);
} else {
this.eventListener.responseBodyEnd(this.call, bytesRead);
}
}
return (E) this.call.messageDone$okhttp(this, requestDone, responseDone, e);
}
public final void noRequestBody() {
this.call.messageDone$okhttp(this, true, false, null);
}
/* compiled from: Exchange.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0082\u0004\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\b\u0010\u000b\u001a\u00020\fH\u0016J!\u0010\r\u001a\u0002H\u000e\"\n\b\u0000\u0010\u000e*\u0004\u0018\u00010\u000f2\u0006\u0010\u0010\u001a\u0002H\u000eH\u0002¢\u0006\u0002\u0010\u0011J\b\u0010\u0012\u001a\u00020\fH\u0016J\u0018\u0010\u0013\u001a\u00020\f2\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u0005H\u0016R\u000e\u0010\u0007\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0017"}, m238d2 = {"Lokhttp3/internal/connection/Exchange$RequestBodySink;", "Lokio/ForwardingSink;", "delegate", "Lokio/Sink;", "contentLength", "", "(Lokhttp3/internal/connection/Exchange;Lokio/Sink;J)V", "bytesReceived", "closed", "", "completed", "close", "", "complete", "E", "Ljava/io/IOException;", "e", "(Ljava/io/IOException;)Ljava/io/IOException;", "flush", "write", "source", "Lokio/Buffer;", "byteCount", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private final class RequestBodySink extends ForwardingSink {
private long bytesReceived;
private boolean closed;
private boolean completed;
private final long contentLength;
final /* synthetic */ Exchange this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public RequestBodySink(Exchange this$0, Sink delegate, long contentLength) {
super(delegate);
Intrinsics.checkNotNullParameter(delegate, "delegate");
this.this$0 = this$0;
this.contentLength = contentLength;
}
@Override // okio.ForwardingSink, okio.Sink
public void write(Buffer source, long byteCount) throws IOException {
Intrinsics.checkNotNullParameter(source, "source");
if (!(!this.closed)) {
throw new IllegalStateException("closed".toString());
}
long j = this.contentLength;
if (j != -1 && this.bytesReceived + byteCount > j) {
throw new ProtocolException("expected " + this.contentLength + " bytes but received " + (this.bytesReceived + byteCount));
}
try {
super.write(source, byteCount);
this.bytesReceived += byteCount;
} catch (IOException e) {
throw complete(e);
}
}
@Override // okio.ForwardingSink, okio.Sink, java.io.Flushable
public void flush() throws IOException {
try {
super.flush();
} catch (IOException e) {
throw complete(e);
}
}
@Override // okio.ForwardingSink, okio.Sink, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
if (this.closed) {
return;
}
this.closed = true;
long j = this.contentLength;
if (j != -1 && this.bytesReceived != j) {
throw new ProtocolException("unexpected end of stream");
}
try {
super.close();
complete(null);
} catch (IOException e) {
throw complete(e);
}
}
private final <E extends IOException> E complete(E e) {
if (this.completed) {
return e;
}
this.completed = true;
return (E) this.this$0.bodyComplete(this.bytesReceived, false, true, e);
}
}
/* compiled from: Exchange.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0080\u0004\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\b\u0010\f\u001a\u00020\rH\u0016J\u001f\u0010\u000e\u001a\u0002H\u000f\"\n\b\u0000\u0010\u000f*\u0004\u0018\u00010\u00102\u0006\u0010\u0011\u001a\u0002H\u000f¢\u0006\u0002\u0010\u0012J\u0018\u0010\u0013\u001a\u00020\u00052\u0006\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u0005H\u0016R\u000e\u0010\u0007\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\tX\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0017"}, m238d2 = {"Lokhttp3/internal/connection/Exchange$ResponseBodySource;", "Lokio/ForwardingSource;", "delegate", "Lokio/Source;", "contentLength", "", "(Lokhttp3/internal/connection/Exchange;Lokio/Source;J)V", "bytesReceived", "closed", "", "completed", "invokeStartEvent", "close", "", "complete", "E", "Ljava/io/IOException;", "e", "(Ljava/io/IOException;)Ljava/io/IOException;", "read", "sink", "Lokio/Buffer;", "byteCount", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public final class ResponseBodySource extends ForwardingSource {
private long bytesReceived;
private boolean closed;
private boolean completed;
private final long contentLength;
private boolean invokeStartEvent;
final /* synthetic */ Exchange this$0;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public ResponseBodySource(Exchange this$0, Source delegate, long contentLength) {
super(delegate);
Intrinsics.checkNotNullParameter(delegate, "delegate");
this.this$0 = this$0;
this.contentLength = contentLength;
this.invokeStartEvent = true;
if (contentLength == 0) {
complete(null);
}
}
@Override // okio.ForwardingSource, okio.Source
public long read(Buffer sink, long byteCount) throws IOException {
Intrinsics.checkNotNullParameter(sink, "sink");
if (!(!this.closed)) {
throw new IllegalStateException("closed".toString());
}
try {
long read = delegate().read(sink, byteCount);
if (this.invokeStartEvent) {
this.invokeStartEvent = false;
this.this$0.getEventListener().responseBodyStart(this.this$0.getCall());
}
if (read == -1) {
complete(null);
return -1L;
}
long newBytesReceived = this.bytesReceived + read;
long j = this.contentLength;
if (j != -1 && newBytesReceived > j) {
throw new ProtocolException("expected " + this.contentLength + " bytes but received " + newBytesReceived);
}
this.bytesReceived = newBytesReceived;
if (newBytesReceived == j) {
complete(null);
}
return read;
} catch (IOException e) {
throw complete(e);
}
}
@Override // okio.ForwardingSource, okio.Source, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
if (this.closed) {
return;
}
this.closed = true;
try {
super.close();
complete(null);
} catch (IOException e) {
throw complete(e);
}
}
public final <E extends IOException> E complete(E e) {
if (this.completed) {
return e;
}
this.completed = true;
if (e == null && this.invokeStartEvent) {
this.invokeStartEvent = false;
this.this$0.getEventListener().responseBodyStart(this.this$0.getCall());
}
return (E) this.this$0.bodyComplete(this.bytesReceived, true, false, e);
}
}
}
@@ -0,0 +1,246 @@
package okhttp3.internal.connection;
import androidx.core.app.NotificationCompat;
import com.google.android.gms.common.internal.ImagesContract;
import java.io.IOException;
import java.net.Socket;
import java.util.List;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.Address;
import okhttp3.EventListener;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Route;
import okhttp3.internal.Util;
import okhttp3.internal.connection.RouteSelector;
import okhttp3.internal.http.ExchangeCodec;
import okhttp3.internal.http.RealInterceptorChain;
import okhttp3.internal.http2.ConnectionShutdownException;
import okhttp3.internal.http2.ErrorCode;
import okhttp3.internal.http2.StreamResetException;
/* compiled from: ExchangeFinder.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000r\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B%\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\\u0006\u0002\u0010\nJ\u0016\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0019\u001a\u00020\u001a2\u0006\u0010\u001b\u001a\u00020\u001cJ0\u0010\u001d\u001a\u00020\u001e2\u0006\u0010\u001f\u001a\u00020\u000e2\u0006\u0010 \u001a\u00020\u000e2\u0006\u0010!\u001a\u00020\u000e2\u0006\u0010\"\u001a\u00020\u000e2\u0006\u0010#\u001a\u00020$H\u0002J8\u0010%\u001a\u00020\u001e2\u0006\u0010\u001f\u001a\u00020\u000e2\u0006\u0010 \u001a\u00020\u000e2\u0006\u0010!\u001a\u00020\u000e2\u0006\u0010\"\u001a\u00020\u000e2\u0006\u0010#\u001a\u00020$2\u0006\u0010&\u001a\u00020$H\u0002J\u0006\u0010'\u001a\u00020$J\n\u0010(\u001a\u0004\u0018\u00010\u0010H\u0002J\u000e\u0010)\u001a\u00020$2\u0006\u0010*\u001a\u00020+J\u000e\u0010,\u001a\u00020-2\u0006\u0010.\u001a\u00020/R\u0014\u0010\u0004\u001a\u00020\u0005X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\fR\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u000eX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u000f\u001a\u0004\u0018\u00010\u0010X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u000eX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0012\u001a\u00020\u000eX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0013\u001a\u0004\u0018\u00010\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0015\u001a\u0004\u0018\u00010\u0016X\u0082\u000e¢\u0006\u0002\n\u0000¨\u00060"}, m238d2 = {"Lokhttp3/internal/connection/ExchangeFinder;", "", "connectionPool", "Lokhttp3/internal/connection/RealConnectionPool;", "address", "Lokhttp3/Address;", NotificationCompat.CATEGORY_CALL, "Lokhttp3/internal/connection/RealCall;", "eventListener", "Lokhttp3/EventListener;", "(Lokhttp3/internal/connection/RealConnectionPool;Lokhttp3/Address;Lokhttp3/internal/connection/RealCall;Lokhttp3/EventListener;)V", "getAddress$okhttp", "()Lokhttp3/Address;", "connectionShutdownCount", "", "nextRouteToTry", "Lokhttp3/Route;", "otherFailureCount", "refusedStreamCount", "routeSelection", "Lokhttp3/internal/connection/RouteSelector$Selection;", "routeSelector", "Lokhttp3/internal/connection/RouteSelector;", "find", "Lokhttp3/internal/http/ExchangeCodec;", "client", "Lokhttp3/OkHttpClient;", "chain", "Lokhttp3/internal/http/RealInterceptorChain;", "findConnection", "Lokhttp3/internal/connection/RealConnection;", "connectTimeout", "readTimeout", "writeTimeout", "pingIntervalMillis", "connectionRetryEnabled", "", "findHealthyConnection", "doExtensiveHealthChecks", "retryAfterFailure", "retryRoute", "sameHostAndPort", ImagesContract.URL, "Lokhttp3/HttpUrl;", "trackFailure", "", "e", "Ljava/io/IOException;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class ExchangeFinder {
private final Address address;
private final RealCall call;
private final RealConnectionPool connectionPool;
private int connectionShutdownCount;
private final EventListener eventListener;
private Route nextRouteToTry;
private int otherFailureCount;
private int refusedStreamCount;
private RouteSelector.Selection routeSelection;
private RouteSelector routeSelector;
public ExchangeFinder(RealConnectionPool connectionPool, Address address, RealCall call, EventListener eventListener) {
Intrinsics.checkNotNullParameter(connectionPool, "connectionPool");
Intrinsics.checkNotNullParameter(address, "address");
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(eventListener, "eventListener");
this.connectionPool = connectionPool;
this.address = address;
this.call = call;
this.eventListener = eventListener;
}
/* renamed from: getAddress$okhttp, reason: from getter */
public final Address getAddress() {
return this.address;
}
public final ExchangeCodec find(OkHttpClient client, RealInterceptorChain chain) {
Intrinsics.checkNotNullParameter(client, "client");
Intrinsics.checkNotNullParameter(chain, "chain");
try {
RealConnection resultConnection = findHealthyConnection(chain.getConnectTimeoutMillis$okhttp(), chain.getReadTimeoutMillis(), chain.getWriteTimeoutMillis(), client.pingIntervalMillis(), client.retryOnConnectionFailure(), !Intrinsics.areEqual(chain.getRequest().method(), "GET"));
return resultConnection.newCodec$okhttp(client, chain);
} catch (IOException e) {
trackFailure(e);
throw new RouteException(e);
} catch (RouteException e2) {
trackFailure(e2.getLastConnectException());
throw e2;
}
}
private final RealConnection findHealthyConnection(int connectTimeout, int readTimeout, int writeTimeout, int pingIntervalMillis, boolean connectionRetryEnabled, boolean doExtensiveHealthChecks) throws IOException {
while (true) {
RealConnection candidate = findConnection(connectTimeout, readTimeout, writeTimeout, pingIntervalMillis, connectionRetryEnabled);
if (candidate.isHealthy(doExtensiveHealthChecks)) {
return candidate;
}
candidate.noNewExchanges$okhttp();
if (this.nextRouteToTry == null) {
RouteSelector.Selection selection = this.routeSelection;
boolean routesLeft = selection != null ? selection.hasNext() : true;
if (routesLeft) {
continue;
} else {
RouteSelector routeSelector = this.routeSelector;
boolean routesSelectionLeft = routeSelector != null ? routeSelector.hasNext() : true;
if (!routesSelectionLeft) {
throw new IOException("exhausted all routes");
}
}
}
}
}
private final RealConnection findConnection(int connectTimeout, int readTimeout, int writeTimeout, int pingIntervalMillis, boolean connectionRetryEnabled) throws IOException {
Route route;
List routes;
if (this.call.getCanceled()) {
throw new IOException("Canceled");
}
RealConnection callConnection = this.call.getConnection();
if (callConnection != null) {
Socket socket = (Socket) null;
synchronized (callConnection) {
if (callConnection.getNoNewExchanges() || !sameHostAndPort(callConnection.getRoute().address().url())) {
socket = this.call.releaseConnectionNoEvents$okhttp();
}
Unit unit = Unit.INSTANCE;
}
if (this.call.getConnection() != null) {
if (!(socket == null)) {
throw new IllegalStateException("Check failed.".toString());
}
return callConnection;
}
if (socket != null) {
Util.closeQuietly(socket);
}
this.eventListener.connectionReleased(this.call, callConnection);
}
this.refusedStreamCount = 0;
this.connectionShutdownCount = 0;
this.otherFailureCount = 0;
if (this.connectionPool.callAcquirePooledConnection(this.address, this.call, null, false)) {
RealConnection result = this.call.getConnection();
Intrinsics.checkNotNull(result);
this.eventListener.connectionAcquired(this.call, result);
return result;
}
Route route2 = this.nextRouteToTry;
if (route2 != null) {
routes = (List) null;
Intrinsics.checkNotNull(route2);
route = route2;
this.nextRouteToTry = null;
} else {
RouteSelector.Selection selection = this.routeSelection;
if (selection != null) {
Intrinsics.checkNotNull(selection);
if (selection.hasNext()) {
routes = (List) null;
RouteSelector.Selection selection2 = this.routeSelection;
Intrinsics.checkNotNull(selection2);
route = selection2.next();
}
}
RouteSelector localRouteSelector = this.routeSelector;
if (localRouteSelector == null) {
localRouteSelector = new RouteSelector(this.address, this.call.getClient().getRouteDatabase(), this.call, this.eventListener);
this.routeSelector = localRouteSelector;
}
RouteSelector.Selection localRouteSelection = localRouteSelector.next();
this.routeSelection = localRouteSelection;
List routes2 = localRouteSelection.getRoutes();
if (!this.call.getCanceled()) {
if (this.connectionPool.callAcquirePooledConnection(this.address, this.call, routes2, false)) {
RealConnection result2 = this.call.getConnection();
Intrinsics.checkNotNull(result2);
this.eventListener.connectionAcquired(this.call, result2);
return result2;
}
route = localRouteSelection.next();
routes = routes2;
} else {
throw new IOException("Canceled");
}
}
RealConnection newConnection = new RealConnection(this.connectionPool, route);
this.call.setConnectionToCancel(newConnection);
try {
newConnection.connect(connectTimeout, readTimeout, writeTimeout, pingIntervalMillis, connectionRetryEnabled, this.call, this.eventListener);
this.call.setConnectionToCancel(null);
this.call.getClient().getRouteDatabase().connected(newConnection.getRoute());
if (this.connectionPool.callAcquirePooledConnection(this.address, this.call, routes, true)) {
RealConnection result3 = this.call.getConnection();
Intrinsics.checkNotNull(result3);
this.nextRouteToTry = route;
Util.closeQuietly(newConnection.socket());
this.eventListener.connectionAcquired(this.call, result3);
return result3;
}
synchronized (newConnection) {
this.connectionPool.put(newConnection);
this.call.acquireConnectionNoEvents(newConnection);
Unit unit2 = Unit.INSTANCE;
}
this.eventListener.connectionAcquired(this.call, newConnection);
return newConnection;
} catch (Throwable th) {
this.call.setConnectionToCancel(null);
throw th;
}
}
public final void trackFailure(IOException e) {
Intrinsics.checkNotNullParameter(e, "e");
this.nextRouteToTry = null;
if ((e instanceof StreamResetException) && ((StreamResetException) e).errorCode == ErrorCode.REFUSED_STREAM) {
this.refusedStreamCount++;
} else if (e instanceof ConnectionShutdownException) {
this.connectionShutdownCount++;
} else {
this.otherFailureCount++;
}
}
public final boolean retryAfterFailure() {
RouteSelector localRouteSelector;
if (this.refusedStreamCount == 0 && this.connectionShutdownCount == 0 && this.otherFailureCount == 0) {
return false;
}
if (this.nextRouteToTry != null) {
return true;
}
Route retryRoute = retryRoute();
if (retryRoute != null) {
this.nextRouteToTry = retryRoute;
return true;
}
RouteSelector.Selection selection = this.routeSelection;
if ((selection == null || !selection.hasNext()) && (localRouteSelector = this.routeSelector) != null) {
return localRouteSelector.hasNext();
}
return true;
}
private final Route retryRoute() {
RealConnection connection;
if (this.refusedStreamCount > 1 || this.connectionShutdownCount > 1 || this.otherFailureCount > 0 || (connection = this.call.getConnection()) == null) {
return null;
}
synchronized (connection) {
if (connection.getRouteFailureCount() != 0) {
return null;
}
if (Util.canReuseConnectionFor(connection.getRoute().address().url(), this.address.url())) {
return connection.getRoute();
}
return null;
}
}
public final boolean sameHostAndPort(HttpUrl url) {
Intrinsics.checkNotNullParameter(url, "url");
HttpUrl routeUrl = this.address.url();
return url.port() == routeUrl.port() && Intrinsics.areEqual(url.host(), routeUrl.host());
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,289 @@
package okhttp3.internal.connection;
import androidx.core.app.NotificationCompat;
import java.lang.ref.Reference;
import java.net.Socket;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.TimeUnit;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.Address;
import okhttp3.ConnectionPool;
import okhttp3.Route;
import okhttp3.internal.Util;
import okhttp3.internal.concurrent.Task;
import okhttp3.internal.concurrent.TaskQueue;
import okhttp3.internal.concurrent.TaskRunner;
import okhttp3.internal.connection.RealCall;
import okhttp3.internal.platform.Platform;
/* compiled from: RealConnectionPool.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u0002\n\u0002\b\u0005*\u0001\u000e\u0018\u0000 (2\u00020\u0001:\u0001(B%\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\\u0006\u0002\u0010\nJ.\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u0018\u001a\u00020\u00192\u000e\u0010\u001a\u001a\n\u0012\u0004\u0012\u00020\u001c\u0018\u00010\u001b2\u0006\u0010\u001d\u001a\u00020\u0015J\u000e\u0010\u001e\u001a\u00020\u00072\u0006\u0010\u001f\u001a\u00020\u0007J\u000e\u0010 \u001a\u00020\u00152\u0006\u0010!\u001a\u00020\u0012J\u0006\u0010\"\u001a\u00020\u0005J\u0006\u0010#\u001a\u00020$J\u0006\u0010%\u001a\u00020\u0005J\u0018\u0010&\u001a\u00020\u00052\u0006\u0010!\u001a\u00020\u00122\u0006\u0010\u001f\u001a\u00020\u0007H\u0002J\u000e\u0010'\u001a\u00020$2\u0006\u0010!\u001a\u00020\u0012R\u000e\u0010\u000b\u001a\u00020\fX\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\r\u001a\u00020\u000eX\u0082\u0004¢\u0006\u0004\n\u0002\u0010\u000fR\u0014\u0010\u0010\u001a\b\u0012\u0004\u0012\u00020\u00120\u0011X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0013\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006)"}, m238d2 = {"Lokhttp3/internal/connection/RealConnectionPool;", "", "taskRunner", "Lokhttp3/internal/concurrent/TaskRunner;", "maxIdleConnections", "", "keepAliveDuration", "", "timeUnit", "Ljava/util/concurrent/TimeUnit;", "(Lokhttp3/internal/concurrent/TaskRunner;IJLjava/util/concurrent/TimeUnit;)V", "cleanupQueue", "Lokhttp3/internal/concurrent/TaskQueue;", "cleanupTask", "okhttp3/internal/connection/RealConnectionPool$cleanupTask$1", "Lokhttp3/internal/connection/RealConnectionPool$cleanupTask$1;", "connections", "Ljava/util/concurrent/ConcurrentLinkedQueue;", "Lokhttp3/internal/connection/RealConnection;", "keepAliveDurationNs", "callAcquirePooledConnection", "", "address", "Lokhttp3/Address;", NotificationCompat.CATEGORY_CALL, "Lokhttp3/internal/connection/RealCall;", "routes", "", "Lokhttp3/Route;", "requireMultiplexed", "cleanup", "now", "connectionBecameIdle", "connection", "connectionCount", "evictAll", "", "idleConnectionCount", "pruneAndGetAllocationCount", "put", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class RealConnectionPool {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private final TaskQueue cleanupQueue;
private final RealConnectionPool$cleanupTask$1 cleanupTask;
private final ConcurrentLinkedQueue<RealConnection> connections;
private final long keepAliveDurationNs;
private final int maxIdleConnections;
/* JADX WARN: Type inference failed for: r0v4, types: [okhttp3.internal.connection.RealConnectionPool$cleanupTask$1] */
public RealConnectionPool(TaskRunner taskRunner, int maxIdleConnections, long keepAliveDuration, TimeUnit timeUnit) {
Intrinsics.checkNotNullParameter(taskRunner, "taskRunner");
Intrinsics.checkNotNullParameter(timeUnit, "timeUnit");
this.maxIdleConnections = maxIdleConnections;
this.keepAliveDurationNs = timeUnit.toNanos(keepAliveDuration);
this.cleanupQueue = taskRunner.newQueue();
final String str = Util.okHttpName + " ConnectionPool";
this.cleanupTask = new Task(str) { // from class: okhttp3.internal.connection.RealConnectionPool$cleanupTask$1
@Override // okhttp3.internal.concurrent.Task
public long runOnce() {
return RealConnectionPool.this.cleanup(System.nanoTime());
}
};
this.connections = new ConcurrentLinkedQueue<>();
if (!(keepAliveDuration > 0)) {
throw new IllegalArgumentException(("keepAliveDuration <= 0: " + keepAliveDuration).toString());
}
}
public final int idleConnectionCount() {
boolean isEmpty;
Iterable $this$count$iv = this.connections;
if (($this$count$iv instanceof Collection) && ((Collection) $this$count$iv).isEmpty()) {
return 0;
}
int count$iv = 0;
for (Object element$iv : $this$count$iv) {
RealConnection it = (RealConnection) element$iv;
Intrinsics.checkNotNullExpressionValue(it, "it");
synchronized (it) {
isEmpty = it.getCalls().isEmpty();
}
if (isEmpty && (count$iv = count$iv + 1) < 0) {
CollectionsKt.throwCountOverflow();
}
}
return count$iv;
}
public final int connectionCount() {
return this.connections.size();
}
public final boolean callAcquirePooledConnection(Address address, RealCall call, List<Route> routes, boolean requireMultiplexed) {
Intrinsics.checkNotNullParameter(address, "address");
Intrinsics.checkNotNullParameter(call, "call");
Iterator<RealConnection> it = this.connections.iterator();
while (it.hasNext()) {
RealConnection connection = it.next();
Intrinsics.checkNotNullExpressionValue(connection, "connection");
synchronized (connection) {
if (requireMultiplexed) {
if (!connection.isMultiplexed$okhttp()) {
Unit unit = Unit.INSTANCE;
}
}
if (connection.isEligible$okhttp(address, routes)) {
call.acquireConnectionNoEvents(connection);
return true;
}
Unit unit2 = Unit.INSTANCE;
}
}
return false;
}
public final void put(RealConnection connection) {
Intrinsics.checkNotNullParameter(connection, "connection");
if (Util.assertionsEnabled && !Thread.holdsLock(connection)) {
StringBuilder sb = new StringBuilder();
sb.append("Thread ");
Thread currentThread = Thread.currentThread();
Intrinsics.checkNotNullExpressionValue(currentThread, "Thread.currentThread()");
sb.append(currentThread.getName());
sb.append(" MUST hold lock on ");
sb.append(connection);
throw new AssertionError(sb.toString());
}
this.connections.add(connection);
TaskQueue.schedule$default(this.cleanupQueue, this.cleanupTask, 0L, 2, null);
}
public final boolean connectionBecameIdle(RealConnection connection) {
Intrinsics.checkNotNullParameter(connection, "connection");
if (Util.assertionsEnabled && !Thread.holdsLock(connection)) {
StringBuilder sb = new StringBuilder();
sb.append("Thread ");
Thread currentThread = Thread.currentThread();
Intrinsics.checkNotNullExpressionValue(currentThread, "Thread.currentThread()");
sb.append(currentThread.getName());
sb.append(" MUST hold lock on ");
sb.append(connection);
throw new AssertionError(sb.toString());
}
if (connection.getNoNewExchanges() || this.maxIdleConnections == 0) {
connection.setNoNewExchanges(true);
this.connections.remove(connection);
if (!this.connections.isEmpty()) {
return true;
}
this.cleanupQueue.cancelAll();
return true;
}
TaskQueue.schedule$default(this.cleanupQueue, this.cleanupTask, 0L, 2, null);
return false;
}
public final void evictAll() {
Socket socket;
Iterator i = this.connections.iterator();
Intrinsics.checkNotNullExpressionValue(i, "connections.iterator()");
while (i.hasNext()) {
RealConnection connection = i.next();
Intrinsics.checkNotNullExpressionValue(connection, "connection");
synchronized (connection) {
if (connection.getCalls().isEmpty()) {
i.remove();
connection.setNoNewExchanges(true);
socket = connection.socket();
} else {
socket = null;
}
}
Socket socketToClose = socket;
if (socketToClose != null) {
Util.closeQuietly(socketToClose);
}
}
if (this.connections.isEmpty()) {
this.cleanupQueue.cancelAll();
}
}
public final long cleanup(long now) {
Throwable th;
int inUseConnectionCount = 0;
int idleConnectionCount = 0;
RealConnection realConnection = (RealConnection) null;
long longestIdleDurationNs = Long.MIN_VALUE;
Iterator<RealConnection> it = this.connections.iterator();
while (it.hasNext()) {
RealConnection connection = it.next();
Intrinsics.checkNotNullExpressionValue(connection, "connection");
synchronized (connection) {
try {
if (pruneAndGetAllocationCount(connection, now) > 0) {
int inUseConnectionCount2 = inUseConnectionCount + 1;
try {
Integer.valueOf(inUseConnectionCount);
inUseConnectionCount = inUseConnectionCount2;
} catch (Throwable th2) {
th = th2;
throw th;
}
} else {
idleConnectionCount++;
long idleDurationNs = now - connection.getIdleAtNs();
if (idleDurationNs > longestIdleDurationNs) {
longestIdleDurationNs = idleDurationNs;
realConnection = connection;
Unit unit = Unit.INSTANCE;
} else {
Unit unit2 = Unit.INSTANCE;
}
}
} catch (Throwable th3) {
th = th3;
}
}
}
long j = this.keepAliveDurationNs;
if (longestIdleDurationNs < j && idleConnectionCount <= this.maxIdleConnections) {
if (idleConnectionCount > 0) {
return j - longestIdleDurationNs;
}
if (inUseConnectionCount > 0) {
return j;
}
return -1L;
}
Intrinsics.checkNotNull(realConnection);
RealConnection connection2 = realConnection;
synchronized (connection2) {
if (!connection2.getCalls().isEmpty()) {
return 0L;
}
if (connection2.getIdleAtNs() + longestIdleDurationNs != now) {
return 0L;
}
connection2.setNoNewExchanges(true);
this.connections.remove(realConnection);
Util.closeQuietly(connection2.socket());
if (this.connections.isEmpty()) {
this.cleanupQueue.cancelAll();
}
return 0L;
}
}
private final int pruneAndGetAllocationCount(RealConnection connection, long now) {
if (Util.assertionsEnabled && !Thread.holdsLock(connection)) {
StringBuilder sb = new StringBuilder();
sb.append("Thread ");
Thread currentThread = Thread.currentThread();
Intrinsics.checkNotNullExpressionValue(currentThread, "Thread.currentThread()");
sb.append(currentThread.getName());
sb.append(" MUST hold lock on ");
sb.append(connection);
throw new AssertionError(sb.toString());
}
List references = connection.getCalls();
int i = 0;
while (i < references.size()) {
Reference<RealCall> reference = references.get(i);
if (reference.get() != null) {
i++;
} else {
if (reference == null) {
throw new NullPointerException("null cannot be cast to non-null type okhttp3.internal.connection.RealCall.CallReference");
}
RealCall.CallReference callReference = (RealCall.CallReference) reference;
String message = "A connection to " + connection.getRoute().address().url() + " was leaked. Did you forget to close a response body?";
Platform.INSTANCE.get().logCloseableLeak(message, callReference.getCallStackTrace());
references.remove(i);
connection.setNoNewExchanges(true);
if (references.isEmpty()) {
connection.setIdleAtNs$okhttp(now - this.keepAliveDurationNs);
return 0;
}
}
}
return references.size();
}
/* compiled from: RealConnectionPool.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u000e\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006¨\u0006\u0007"}, m238d2 = {"Lokhttp3/internal/connection/RealConnectionPool$Companion;", "", "()V", "get", "Lokhttp3/internal/connection/RealConnectionPool;", "connectionPool", "Lokhttp3/ConnectionPool;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public final RealConnectionPool get(ConnectionPool connectionPool) {
Intrinsics.checkNotNullParameter(connectionPool, "connectionPool");
return connectionPool.getDelegate();
}
}
}
@@ -0,0 +1,29 @@
package okhttp3.internal.connection;
import java.util.LinkedHashSet;
import java.util.Set;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.Route;
/* compiled from: RouteDatabase.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010#\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u000e\u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\u0005J\u000e\u0010\t\u001a\u00020\u00072\u0006\u0010\n\u001a\u00020\u0005J\u000e\u0010\u000b\u001a\u00020\f2\u0006\u0010\b\u001a\u00020\u0005R\u0014\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\r"}, m238d2 = {"Lokhttp3/internal/connection/RouteDatabase;", "", "()V", "failedRoutes", "", "Lokhttp3/Route;", "connected", "", "route", "failed", "failedRoute", "shouldPostpone", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class RouteDatabase {
private final Set<Route> failedRoutes = new LinkedHashSet();
public final synchronized void failed(Route failedRoute) {
Intrinsics.checkNotNullParameter(failedRoute, "failedRoute");
this.failedRoutes.add(failedRoute);
}
public final synchronized void connected(Route route) {
Intrinsics.checkNotNullParameter(route, "route");
this.failedRoutes.remove(route);
}
public final synchronized boolean shouldPostpone(Route route) {
Intrinsics.checkNotNullParameter(route, "route");
return this.failedRoutes.contains(route);
}
}
@@ -0,0 +1,36 @@
package okhttp3.internal.connection;
import java.io.IOException;
import kotlin.ExceptionsKt;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: RouteException.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u0002\n\u0002\b\u0002\u0018\u00002\u00060\u0001j\u0002`\u0002B\u000f\b\u0000\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005J\u000e\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u0004R\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007R\u001e\u0010\t\u001a\u00020\u00042\u0006\u0010\b\u001a\u00020\u0004@BX\u0086\u000e¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u0007¨\u0006\u000e"}, m238d2 = {"Lokhttp3/internal/connection/RouteException;", "Ljava/lang/RuntimeException;", "Lkotlin/RuntimeException;", "firstConnectException", "Ljava/io/IOException;", "(Ljava/io/IOException;)V", "getFirstConnectException", "()Ljava/io/IOException;", "<set-?>", "lastConnectException", "getLastConnectException", "addConnectException", "", "e", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class RouteException extends RuntimeException {
private final IOException firstConnectException;
private IOException lastConnectException;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public RouteException(IOException firstConnectException) {
super(firstConnectException);
Intrinsics.checkNotNullParameter(firstConnectException, "firstConnectException");
this.firstConnectException = firstConnectException;
this.lastConnectException = firstConnectException;
}
public final IOException getFirstConnectException() {
return this.firstConnectException;
}
public final IOException getLastConnectException() {
return this.lastConnectException;
}
public final void addConnectException(IOException e) {
Intrinsics.checkNotNullParameter(e, "e");
ExceptionsKt.addSuppressed(this.firstConnectException, e);
this.lastConnectException = e;
}
}
@@ -0,0 +1,224 @@
package okhttp3.internal.connection;
import androidx.core.app.NotificationCompat;
import com.google.android.gms.common.internal.ImagesContract;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.SocketAddress;
import java.net.SocketException;
import java.net.URI;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.Address;
import okhttp3.Call;
import okhttp3.EventListener;
import okhttp3.HttpUrl;
import okhttp3.Route;
import okhttp3.internal.Util;
/* compiled from: RouteSelector.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000d\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010!\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u0000 !2\u00020\u0001:\u0002!\"B%\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\\u0006\u0002\u0010\nJ\t\u0010\u0015\u001a\u00020\u0016H\u0086\u0002J\b\u0010\u0017\u001a\u00020\u0016H\u0002J\t\u0010\u0018\u001a\u00020\u0019H\u0086\u0002J\b\u0010\u001a\u001a\u00020\u0014H\u0002J\u0010\u0010\u001b\u001a\u00020\u001c2\u0006\u0010\u001d\u001a\u00020\u0014H\u0002J\u001a\u0010\u001e\u001a\u00020\u001c2\u0006\u0010\u001f\u001a\u00020 2\b\u0010\u001d\u001a\u0004\u0018\u00010\u0014H\u0002R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\r0\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u000fX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u0010\u001a\b\u0012\u0004\u0012\u00020\u00120\u0011X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0013\u001a\b\u0012\u0004\u0012\u00020\u00140\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006#"}, m238d2 = {"Lokhttp3/internal/connection/RouteSelector;", "", "address", "Lokhttp3/Address;", "routeDatabase", "Lokhttp3/internal/connection/RouteDatabase;", NotificationCompat.CATEGORY_CALL, "Lokhttp3/Call;", "eventListener", "Lokhttp3/EventListener;", "(Lokhttp3/Address;Lokhttp3/internal/connection/RouteDatabase;Lokhttp3/Call;Lokhttp3/EventListener;)V", "inetSocketAddresses", "", "Ljava/net/InetSocketAddress;", "nextProxyIndex", "", "postponedRoutes", "", "Lokhttp3/Route;", "proxies", "Ljava/net/Proxy;", "hasNext", "", "hasNextProxy", "next", "Lokhttp3/internal/connection/RouteSelector$Selection;", "nextProxy", "resetNextInetSocketAddress", "", "proxy", "resetNextProxy", ImagesContract.URL, "Lokhttp3/HttpUrl;", "Companion", "Selection", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class RouteSelector {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private final Address address;
private final Call call;
private final EventListener eventListener;
private List<? extends InetSocketAddress> inetSocketAddresses;
private int nextProxyIndex;
private final List<Route> postponedRoutes;
private List<? extends Proxy> proxies;
private final RouteDatabase routeDatabase;
public RouteSelector(Address address, RouteDatabase routeDatabase, Call call, EventListener eventListener) {
Intrinsics.checkNotNullParameter(address, "address");
Intrinsics.checkNotNullParameter(routeDatabase, "routeDatabase");
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(eventListener, "eventListener");
this.address = address;
this.routeDatabase = routeDatabase;
this.call = call;
this.eventListener = eventListener;
this.proxies = CollectionsKt.emptyList();
this.inetSocketAddresses = CollectionsKt.emptyList();
this.postponedRoutes = new ArrayList();
resetNextProxy(address.url(), address.proxy());
}
public final boolean hasNext() {
return hasNextProxy() || (this.postponedRoutes.isEmpty() ^ true);
}
public final Selection next() throws IOException {
if (!hasNext()) {
throw new NoSuchElementException();
}
List routes = new ArrayList();
while (hasNextProxy()) {
Proxy proxy = nextProxy();
for (InetSocketAddress inetSocketAddress : this.inetSocketAddresses) {
Route route = new Route(this.address, proxy, inetSocketAddress);
if (this.routeDatabase.shouldPostpone(route)) {
this.postponedRoutes.add(route);
} else {
routes.add(route);
}
}
if (!routes.isEmpty()) {
break;
}
}
if (routes.isEmpty()) {
CollectionsKt.addAll(routes, this.postponedRoutes);
this.postponedRoutes.clear();
}
return new Selection(routes);
}
/* JADX WARN: Multi-variable type inference failed */
private final void resetNextProxy(final HttpUrl url, final Proxy proxy) {
Function0<List<? extends Proxy>> function0 = new Function0<List<? extends Proxy>>() { // from class: okhttp3.internal.connection.RouteSelector$resetNextProxy$1
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(0);
}
@Override // kotlin.jvm.functions.Function0
public final List<? extends Proxy> invoke() {
Address address;
Proxy proxy2 = proxy;
if (proxy2 != null) {
return CollectionsKt.listOf(proxy2);
}
URI uri = url.uri();
if (uri.getHost() == null) {
return Util.immutableListOf(Proxy.NO_PROXY);
}
address = RouteSelector.this.address;
List proxiesOrNull = address.proxySelector().select(uri);
List list = proxiesOrNull;
return list == null || list.isEmpty() ? Util.immutableListOf(Proxy.NO_PROXY) : Util.toImmutableList(proxiesOrNull);
}
};
this.eventListener.proxySelectStart(this.call, url);
List<? extends Proxy> invoke = function0.invoke();
this.proxies = invoke;
this.nextProxyIndex = 0;
this.eventListener.proxySelectEnd(this.call, url, invoke);
}
private final boolean hasNextProxy() {
return this.nextProxyIndex < this.proxies.size();
}
private final Proxy nextProxy() throws IOException {
if (!hasNextProxy()) {
throw new SocketException("No route to " + this.address.url().host() + "; exhausted proxy configurations: " + this.proxies);
}
List<? extends Proxy> list = this.proxies;
int i = this.nextProxyIndex;
this.nextProxyIndex = i + 1;
Proxy result = list.get(i);
resetNextInetSocketAddress(result);
return result;
}
private final void resetNextInetSocketAddress(Proxy proxy) throws IOException {
String socketHost;
int socketPort;
List mutableInetSocketAddresses = new ArrayList();
this.inetSocketAddresses = mutableInetSocketAddresses;
if (proxy.type() == Proxy.Type.DIRECT || proxy.type() == Proxy.Type.SOCKS) {
socketHost = this.address.url().host();
socketPort = this.address.url().port();
} else {
SocketAddress proxyAddress = proxy.address();
if (!(proxyAddress instanceof InetSocketAddress)) {
throw new IllegalArgumentException(("Proxy.address() is not an InetSocketAddress: " + proxyAddress.getClass()).toString());
}
socketHost = INSTANCE.getSocketHost((InetSocketAddress) proxyAddress);
socketPort = ((InetSocketAddress) proxyAddress).getPort();
}
if (1 > socketPort || 65535 < socketPort) {
throw new SocketException("No route to " + socketHost + ':' + socketPort + "; port is out of range");
}
if (proxy.type() == Proxy.Type.SOCKS) {
mutableInetSocketAddresses.add(InetSocketAddress.createUnresolved(socketHost, socketPort));
return;
}
this.eventListener.dnsStart(this.call, socketHost);
List addresses = this.address.dns().lookup(socketHost);
if (addresses.isEmpty()) {
throw new UnknownHostException(this.address.dns() + " returned no addresses for " + socketHost);
}
this.eventListener.dnsEnd(this.call, socketHost, addresses);
for (InetAddress inetAddress : addresses) {
mutableInetSocketAddresses.add(new InetSocketAddress(inetAddress, socketPort));
}
}
/* compiled from: RouteSelector.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0002\u0018\u00002\u00020\u0001B\u0013\u0012\f\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003¢\u0006\u0002\u0010\u0005J\t\u0010\n\u001a\u00020\u000bH\u0086\u0002J\t\u0010\f\u001a\u00020\u0004H\u0086\u0002R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u0017\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\\u0006\r"}, m238d2 = {"Lokhttp3/internal/connection/RouteSelector$Selection;", "", "routes", "", "Lokhttp3/Route;", "(Ljava/util/List;)V", "nextRouteIndex", "", "getRoutes", "()Ljava/util/List;", "hasNext", "", "next", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Selection {
private int nextRouteIndex;
private final List<Route> routes;
public Selection(List<Route> routes) {
Intrinsics.checkNotNullParameter(routes, "routes");
this.routes = routes;
}
public final List<Route> getRoutes() {
return this.routes;
}
public final boolean hasNext() {
return this.nextRouteIndex < this.routes.size();
}
public final Route next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
List<Route> list = this.routes;
int i = this.nextRouteIndex;
this.nextRouteIndex = i + 1;
return list.get(i);
}
}
/* compiled from: RouteSelector.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0015\u0010\u0003\u001a\u00020\u0004*\u00020\u00058F¢\u0006\u0006\u001a\u0004\b\u0006\u0010\u0007¨\u0006\b"}, m238d2 = {"Lokhttp3/internal/connection/RouteSelector$Companion;", "", "()V", "socketHost", "", "Ljava/net/InetSocketAddress;", "getSocketHost", "(Ljava/net/InetSocketAddress;)Ljava/lang/String;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public final String getSocketHost(InetSocketAddress socketHost) {
Intrinsics.checkNotNullParameter(socketHost, "$this$socketHost");
InetAddress address = socketHost.getAddress();
if (address == null) {
String hostName = socketHost.getHostName();
Intrinsics.checkNotNullExpressionValue(hostName, "hostName");
return hostName;
}
String hostAddress = address.getHostAddress();
Intrinsics.checkNotNullExpressionValue(hostAddress, "address.hostAddress");
return hostAddress;
}
}
}
@@ -0,0 +1,106 @@
package okhttp3.internal.http;
import java.io.IOException;
import java.util.List;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import okhttp3.Cookie;
import okhttp3.CookieJar;
import okhttp3.Headers;
import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.internal.Util;
import okio.GzipSource;
import okio.Okio;
/* compiled from: BridgeInterceptor.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\u0016\u0010\u0005\u001a\u00020\u00062\f\u0010\u0007\u001a\b\u0012\u0004\u0012\u00020\t0\bH\u0002J\u0010\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\rH\u0016R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u000e"}, m238d2 = {"Lokhttp3/internal/http/BridgeInterceptor;", "Lokhttp3/Interceptor;", "cookieJar", "Lokhttp3/CookieJar;", "(Lokhttp3/CookieJar;)V", "cookieHeader", "", "cookies", "", "Lokhttp3/Cookie;", "intercept", "Lokhttp3/Response;", "chain", "Lokhttp3/Interceptor$Chain;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class BridgeInterceptor implements Interceptor {
private final CookieJar cookieJar;
public BridgeInterceptor(CookieJar cookieJar) {
Intrinsics.checkNotNullParameter(cookieJar, "cookieJar");
this.cookieJar = cookieJar;
}
@Override // okhttp3.Interceptor
public Response intercept(Interceptor.Chain chain) throws IOException {
ResponseBody responseBody;
Intrinsics.checkNotNullParameter(chain, "chain");
Request userRequest = chain.request();
Request.Builder requestBuilder = userRequest.newBuilder();
RequestBody body = userRequest.body();
if (body != null) {
MediaType contentType = body.getContentType();
if (contentType != null) {
requestBuilder.header(com.google.common.net.HttpHeaders.CONTENT_TYPE, contentType.getMediaType());
}
long contentLength = body.contentLength();
if (contentLength != -1) {
requestBuilder.header(com.google.common.net.HttpHeaders.CONTENT_LENGTH, String.valueOf(contentLength));
requestBuilder.removeHeader(com.google.common.net.HttpHeaders.TRANSFER_ENCODING);
} else {
requestBuilder.header(com.google.common.net.HttpHeaders.TRANSFER_ENCODING, "chunked");
requestBuilder.removeHeader(com.google.common.net.HttpHeaders.CONTENT_LENGTH);
}
}
if (userRequest.header(com.google.common.net.HttpHeaders.HOST) == null) {
requestBuilder.header(com.google.common.net.HttpHeaders.HOST, Util.toHostHeader$default(userRequest.url(), false, 1, null));
}
if (userRequest.header(com.google.common.net.HttpHeaders.CONNECTION) == null) {
requestBuilder.header(com.google.common.net.HttpHeaders.CONNECTION, "Keep-Alive");
}
boolean transparentGzip = false;
if (userRequest.header(com.google.common.net.HttpHeaders.ACCEPT_ENCODING) == null && userRequest.header(com.google.common.net.HttpHeaders.RANGE) == null) {
transparentGzip = true;
requestBuilder.header(com.google.common.net.HttpHeaders.ACCEPT_ENCODING, "gzip");
}
List cookies = this.cookieJar.loadForRequest(userRequest.url());
if (!cookies.isEmpty()) {
requestBuilder.header(com.google.common.net.HttpHeaders.COOKIE, cookieHeader(cookies));
}
if (userRequest.header(com.google.common.net.HttpHeaders.USER_AGENT) == null) {
requestBuilder.header(com.google.common.net.HttpHeaders.USER_AGENT, Util.userAgent);
}
Response networkResponse = chain.proceed(requestBuilder.build());
HttpHeaders.receiveHeaders(this.cookieJar, userRequest.url(), networkResponse.headers());
Response.Builder responseBuilder = networkResponse.newBuilder().request(userRequest);
if (transparentGzip && StringsKt.equals("gzip", Response.header$default(networkResponse, com.google.common.net.HttpHeaders.CONTENT_ENCODING, null, 2, null), true) && HttpHeaders.promisesBody(networkResponse) && (responseBody = networkResponse.body()) != null) {
GzipSource gzipSource = new GzipSource(responseBody.getSource());
Headers strippedHeaders = networkResponse.headers().newBuilder().removeAll(com.google.common.net.HttpHeaders.CONTENT_ENCODING).removeAll(com.google.common.net.HttpHeaders.CONTENT_LENGTH).build();
responseBuilder.headers(strippedHeaders);
responseBuilder.body(new RealResponseBody(Response.header$default(networkResponse, com.google.common.net.HttpHeaders.CONTENT_TYPE, null, 2, null), -1L, Okio.buffer(gzipSource)));
}
return responseBuilder.build();
}
private final String cookieHeader(List<Cookie> cookies) {
StringBuilder $this$buildString = new StringBuilder();
List<Cookie> $this$forEachIndexed$iv = cookies;
int index = 0;
for (Object item$iv : $this$forEachIndexed$iv) {
int index$iv = index + 1;
if (index < 0) {
CollectionsKt.throwIndexOverflow();
}
Cookie cookie = (Cookie) item$iv;
if (index > 0) {
$this$buildString.append("; ");
}
$this$buildString.append(cookie.name());
$this$buildString.append('=');
$this$buildString.append(cookie.value());
index = index$iv;
}
String sb = $this$buildString.toString();
Intrinsics.checkNotNullExpressionValue(sb, "StringBuilder().apply(builderAction).toString()");
return sb;
}
}
@@ -0,0 +1,32 @@
package okhttp3.internal.http;
import kotlin.Metadata;
import okhttp3.Interceptor;
/* compiled from: CallServerInterceptor.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\u0010\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0016R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\t"}, m238d2 = {"Lokhttp3/internal/http/CallServerInterceptor;", "Lokhttp3/Interceptor;", "forWebSocket", "", "(Z)V", "intercept", "Lokhttp3/Response;", "chain", "Lokhttp3/Interceptor$Chain;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class CallServerInterceptor implements Interceptor {
private final boolean forWebSocket;
public CallServerInterceptor(boolean forWebSocket) {
this.forWebSocket = forWebSocket;
}
/* JADX WARN: Code restructure failed: missing block: B:32:0x0165, code lost:
if (kotlin.text.StringsKt.equals("close", okhttp3.Response.header$default(r10, com.google.common.net.HttpHeaders.CONNECTION, null, 2, null), true) != false) goto L45;
*/
@Override // okhttp3.Interceptor
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public okhttp3.Response intercept(okhttp3.Interceptor.Chain r19) throws java.io.IOException {
/*
Method dump skipped, instructions count: 439
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.http.CallServerInterceptor.intercept(okhttp3.Interceptor$Chain):okhttp3.Response");
}
}
@@ -0,0 +1,77 @@
package okhttp3.internal.http;
import java.text.DateFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.internal.Util;
/* compiled from: dates.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000+\n\u0000\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002*\u0001\n\u001a\u000e\u0010\f\u001a\u0004\u0018\u00010\r*\u00020\u0005H\u0000\u001a\f\u0010\u000e\u001a\u00020\u0005*\u00020\rH\u0000\"\u0018\u0010\u0000\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00020\u0001X\u0082\u0004¢\u0006\u0004\n\u0002\u0010\u0003\"\u0016\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00050\u0001X\u0082\u0004¢\u0006\u0004\n\u0002\u0010\u0006\"\u000e\u0010\u0007\u001a\u00020\bX\u0080T¢\u0006\u0002\n\u0000\"\u0010\u0010\t\u001a\u00020\nX\u0082\u0004¢\u0006\u0004\n\u0002\u0010\u000b¨\u0006\u000f"}, m238d2 = {"BROWSER_COMPATIBLE_DATE_FORMATS", "", "Ljava/text/DateFormat;", "[Ljava/text/DateFormat;", "BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS", "", "[Ljava/lang/String;", "MAX_DATE", "", "STANDARD_DATE_FORMAT", "okhttp3/internal/http/DatesKt$STANDARD_DATE_FORMAT$1", "Lokhttp3/internal/http/DatesKt$STANDARD_DATE_FORMAT$1;", "toHttpDateOrNull", "Ljava/util/Date;", "toHttpDateString", "okhttp"}, m239k = 2, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class DatesKt {
private static final DateFormat[] BROWSER_COMPATIBLE_DATE_FORMATS;
private static final String[] BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS;
public static final long MAX_DATE = 253402300799999L;
private static final DatesKt$STANDARD_DATE_FORMAT$1 STANDARD_DATE_FORMAT = new ThreadLocal<DateFormat>() { // from class: okhttp3.internal.http.DatesKt$STANDARD_DATE_FORMAT$1
/* JADX INFO: Access modifiers changed from: protected */
@Override // java.lang.ThreadLocal
public DateFormat initialValue() {
SimpleDateFormat $this$apply = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
$this$apply.setLenient(false);
$this$apply.setTimeZone(Util.UTC);
return $this$apply;
}
};
/* JADX WARN: Type inference failed for: r0v0, types: [okhttp3.internal.http.DatesKt$STANDARD_DATE_FORMAT$1] */
static {
String[] strArr = {"EEE, dd MMM yyyy HH:mm:ss zzz", "EEEE, dd-MMM-yy HH:mm:ss zzz", "EEE MMM d HH:mm:ss yyyy", "EEE, dd-MMM-yyyy HH:mm:ss z", "EEE, dd-MMM-yyyy HH-mm-ss z", "EEE, dd MMM yy HH:mm:ss z", "EEE dd-MMM-yyyy HH:mm:ss z", "EEE dd MMM yyyy HH:mm:ss z", "EEE dd-MMM-yyyy HH-mm-ss z", "EEE dd-MMM-yy HH:mm:ss z", "EEE dd MMM yy HH:mm:ss z", "EEE,dd-MMM-yy HH:mm:ss z", "EEE,dd-MMM-yyyy HH:mm:ss z", "EEE, dd-MM-yyyy HH:mm:ss z", "EEE MMM d yyyy HH:mm:ss z"};
BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS = strArr;
BROWSER_COMPATIBLE_DATE_FORMATS = new DateFormat[strArr.length];
}
public static final Date toHttpDateOrNull(String toHttpDateOrNull) {
Intrinsics.checkNotNullParameter(toHttpDateOrNull, "$this$toHttpDateOrNull");
if (toHttpDateOrNull.length() == 0) {
return null;
}
ParsePosition position = new ParsePosition(0);
Date parse = STANDARD_DATE_FORMAT.get().parse(toHttpDateOrNull, position);
if (position.getIndex() == toHttpDateOrNull.length()) {
return parse;
}
String[] strArr = BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS;
synchronized (strArr) {
int length = strArr.length;
for (int i = 0; i < length; i++) {
DateFormat[] dateFormatArr = BROWSER_COMPATIBLE_DATE_FORMATS;
DateFormat format = dateFormatArr[i];
if (format == null) {
SimpleDateFormat $this$apply = new SimpleDateFormat(BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS[i], Locale.US);
$this$apply.setTimeZone(Util.UTC);
format = $this$apply;
dateFormatArr[i] = format;
}
position.setIndex(0);
Date parse2 = format.parse(toHttpDateOrNull, position);
if (position.getIndex() != 0) {
return parse2;
}
}
Unit unit = Unit.INSTANCE;
return null;
}
}
public static final String toHttpDateString(Date toHttpDateString) {
Intrinsics.checkNotNullParameter(toHttpDateString, "$this$toHttpDateString");
String format = STANDARD_DATE_FORMAT.get().format(toHttpDateString);
Intrinsics.checkNotNullExpressionValue(format, "STANDARD_DATE_FORMAT.get().format(this)");
return format;
}
}
@@ -0,0 +1,50 @@
package okhttp3.internal.http;
import java.io.IOException;
import kotlin.Metadata;
import okhttp3.Headers;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.internal.connection.RealConnection;
import okio.Sink;
import okio.Source;
/* compiled from: ExchangeCodec.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000N\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\bf\u0018\u0000 \u001c2\u00020\u0001:\u0001\u001cJ\b\u0010\u0006\u001a\u00020\u0007H&J\u0018\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\rH&J\b\u0010\u000e\u001a\u00020\u0007H&J\b\u0010\u000f\u001a\u00020\u0007H&J\u0010\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0013H&J\u0012\u0010\u0014\u001a\u0004\u0018\u00010\u00152\u0006\u0010\u0016\u001a\u00020\u0017H&J\u0010\u0010\u0018\u001a\u00020\r2\u0006\u0010\u0012\u001a\u00020\u0013H&J\b\u0010\u0019\u001a\u00020\u001aH&J\u0010\u0010\u001b\u001a\u00020\u00072\u0006\u0010\n\u001a\u00020\u000bH&R\u0012\u0010\u0002\u001a\u00020\u0003X¦\u0004¢\u0006\u0006\u001a\u0004\b\u0004\u0010\u0005¨\u0006\u001d"}, m238d2 = {"Lokhttp3/internal/http/ExchangeCodec;", "", "connection", "Lokhttp3/internal/connection/RealConnection;", "getConnection", "()Lokhttp3/internal/connection/RealConnection;", "cancel", "", "createRequestBody", "Lokio/Sink;", "request", "Lokhttp3/Request;", "contentLength", "", "finishRequest", "flushRequest", "openResponseBodySource", "Lokio/Source;", "response", "Lokhttp3/Response;", "readResponseHeaders", "Lokhttp3/Response$Builder;", "expectContinue", "", "reportedContentLength", "trailers", "Lokhttp3/Headers;", "writeRequestHeaders", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public interface ExchangeCodec {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = Companion.$$INSTANCE;
public static final int DISCARD_STREAM_TIMEOUT_MILLIS = 100;
void cancel();
Sink createRequestBody(Request request, long contentLength) throws IOException;
void finishRequest() throws IOException;
void flushRequest() throws IOException;
RealConnection getConnection();
Source openResponseBodySource(Response response) throws IOException;
Response.Builder readResponseHeaders(boolean expectContinue) throws IOException;
long reportedContentLength(Response response) throws IOException;
Headers trailers() throws IOException;
void writeRequestHeaders(Request request) throws IOException;
/* compiled from: ExchangeCodec.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000¨\u0006\u0005"}, m238d2 = {"Lokhttp3/internal/http/ExchangeCodec$Companion;", "", "()V", "DISCARD_STREAM_TIMEOUT_MILLIS", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
static final /* synthetic */ Companion $$INSTANCE = new Companion();
public static final int DISCARD_STREAM_TIMEOUT_MILLIS = 100;
private Companion() {
}
}
}
@@ -0,0 +1,256 @@
package okhttp3.internal.http;
import com.google.android.gms.common.internal.ImagesContract;
import java.io.EOFException;
import java.util.ArrayList;
import java.util.List;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import okhttp3.Challenge;
import okhttp3.Cookie;
import okhttp3.CookieJar;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.Response;
import okhttp3.internal.Util;
import okhttp3.internal.platform.Platform;
import okio.Buffer;
import okio.ByteString;
/* compiled from: HttpHeaders.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000R\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010!\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0005\n\u0000\u001a\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0007\u001a\u0018\u0010\u0007\u001a\b\u0012\u0004\u0012\u00020\t0\b*\u00020\n2\u0006\u0010\u000b\u001a\u00020\f\u001a\n\u0010\r\u001a\u00020\u0004*\u00020\u0006\u001a\u001a\u0010\u000e\u001a\u00020\u000f*\u00020\u00102\f\u0010\u0011\u001a\b\u0012\u0004\u0012\u00020\t0\u0012H\u0002\u001a\u000e\u0010\u0013\u001a\u0004\u0018\u00010\f*\u00020\u0010H\u0002\u001a\u000e\u0010\u0014\u001a\u0004\u0018\u00010\f*\u00020\u0010H\u0002\u001a\u001a\u0010\u0015\u001a\u00020\u000f*\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0019\u001a\u00020\n\u001a\f\u0010\u001a\u001a\u00020\u0004*\u00020\u0010H\u0002\u001a\u0014\u0010\u001b\u001a\u00020\u0004*\u00020\u00102\u0006\u0010\u001c\u001a\u00020\u001dH\u0002\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000\"\u000e\u0010\u0002\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u001e"}, m238d2 = {"QUOTED_STRING_DELIMITERS", "Lokio/ByteString;", "TOKEN_DELIMITERS", "hasBody", "", "response", "Lokhttp3/Response;", "parseChallenges", "", "Lokhttp3/Challenge;", "Lokhttp3/Headers;", "headerName", "", "promisesBody", "readChallengeHeader", "", "Lokio/Buffer;", "result", "", "readQuotedString", "readToken", "receiveHeaders", "Lokhttp3/CookieJar;", ImagesContract.URL, "Lokhttp3/HttpUrl;", "headers", "skipCommasAndWhitespace", "startsWith", "prefix", "", "okhttp"}, m239k = 2, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class HttpHeaders {
private static final ByteString QUOTED_STRING_DELIMITERS = ByteString.INSTANCE.encodeUtf8("\"\\");
private static final ByteString TOKEN_DELIMITERS = ByteString.INSTANCE.encodeUtf8("\t ,=");
public static final List<Challenge> parseChallenges(Headers parseChallenges, String headerName) {
Intrinsics.checkNotNullParameter(parseChallenges, "$this$parseChallenges");
Intrinsics.checkNotNullParameter(headerName, "headerName");
List result = new ArrayList();
int size = parseChallenges.size();
for (int h = 0; h < size; h++) {
if (StringsKt.equals(headerName, parseChallenges.name(h), true)) {
Buffer header = new Buffer().writeUtf8(parseChallenges.value(h));
try {
readChallengeHeader(header, result);
} catch (EOFException e) {
Platform.INSTANCE.get().log("Unable to parse challenge", 5, e);
}
}
}
return result;
}
/* JADX WARN: Code restructure failed: missing block: B:22:0x0091, code lost:
r12.add(new okhttp3.Challenge(r2, (java.util.Map<java.lang.String, java.lang.String>) r7));
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static final void readChallengeHeader(okio.Buffer r11, java.util.List<okhttp3.Challenge> r12) throws java.io.EOFException {
/*
r0 = 0
r1 = r0
java.lang.String r1 = (java.lang.String) r1
L4:
if (r1 != 0) goto L11
skipCommasAndWhitespace(r11)
java.lang.String r1 = readToken(r11)
if (r1 != 0) goto L11
return
L11:
r2 = r1
boolean r3 = skipCommasAndWhitespace(r11)
java.lang.String r1 = readToken(r11)
if (r1 != 0) goto L30
boolean r0 = r11.exhausted()
if (r0 != 0) goto L23
return
L23:
okhttp3.Challenge r0 = new okhttp3.Challenge
java.util.Map r4 = kotlin.collections.MapsKt.emptyMap()
r0.<init>(r2, r4)
r12.add(r0)
return
L30:
r4 = 61
byte r4 = (byte) r4
int r5 = okhttp3.internal.Util.skipAll(r11, r4)
boolean r6 = skipCommasAndWhitespace(r11)
if (r3 != 0) goto L71
if (r6 != 0) goto L45
boolean r7 = r11.exhausted()
if (r7 == 0) goto L71
L45:
okhttp3.Challenge r4 = new okhttp3.Challenge
java.lang.StringBuilder r7 = new java.lang.StringBuilder
r7.<init>()
r7.append(r1)
java.lang.String r8 = "="
java.lang.CharSequence r8 = (java.lang.CharSequence) r8
java.lang.String r8 = kotlin.text.StringsKt.repeat(r8, r5)
r7.append(r8)
java.lang.String r7 = r7.toString()
java.util.Map r7 = java.util.Collections.singletonMap(r0, r7)
java.lang.String r8 = "Collections.singletonMap…ek + \"=\".repeat(eqCount))"
kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r7, r8)
r4.<init>(r2, r7)
r12.add(r4)
r1 = r0
java.lang.String r1 = (java.lang.String) r1
goto L4
L71:
java.util.LinkedHashMap r7 = new java.util.LinkedHashMap
r7.<init>()
java.util.Map r7 = (java.util.Map) r7
int r8 = okhttp3.internal.Util.skipAll(r11, r4)
int r5 = r5 + r8
L7d:
if (r1 != 0) goto L8f
java.lang.String r1 = readToken(r11)
boolean r8 = skipCommasAndWhitespace(r11)
if (r8 == 0) goto L8b
goto L91
L8b:
int r5 = okhttp3.internal.Util.skipAll(r11, r4)
L8f:
if (r5 != 0) goto L9b
L91:
okhttp3.Challenge r4 = new okhttp3.Challenge
r4.<init>(r2, r7)
r12.add(r4)
goto L4
L9b:
r8 = 1
if (r5 <= r8) goto L9f
return
L9f:
boolean r8 = skipCommasAndWhitespace(r11)
if (r8 == 0) goto La6
return
La6:
r8 = 34
byte r8 = (byte) r8
boolean r8 = startsWith(r11, r8)
if (r8 == 0) goto Lb5
java.lang.String r8 = readQuotedString(r11)
goto Lb9
Lb5:
java.lang.String r8 = readToken(r11)
Lb9:
if (r8 == 0) goto Ld5
java.lang.Object r9 = r7.put(r1, r8)
java.lang.String r9 = (java.lang.String) r9
r1 = r0
java.lang.String r1 = (java.lang.String) r1
if (r9 == 0) goto Lc7
return
Lc7:
boolean r10 = skipCommasAndWhitespace(r11)
if (r10 != 0) goto Ld4
boolean r10 = r11.exhausted()
if (r10 != 0) goto Ld4
return
Ld4:
goto L7d
Ld5:
return
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.http.HttpHeaders.readChallengeHeader(okio.Buffer, java.util.List):void");
}
private static final boolean skipCommasAndWhitespace(Buffer $this$skipCommasAndWhitespace) {
boolean commaFound = false;
while (!$this$skipCommasAndWhitespace.exhausted()) {
switch ($this$skipCommasAndWhitespace.getByte(0L)) {
case 9:
case 32:
$this$skipCommasAndWhitespace.readByte();
break;
case 44:
$this$skipCommasAndWhitespace.readByte();
commaFound = true;
break;
default:
return commaFound;
}
}
return commaFound;
}
private static final boolean startsWith(Buffer $this$startsWith, byte prefix) {
return !$this$startsWith.exhausted() && $this$startsWith.getByte(0L) == prefix;
}
private static final String readQuotedString(Buffer $this$readQuotedString) throws EOFException {
byte b = (byte) 34;
if (!($this$readQuotedString.readByte() == b)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
Buffer result = new Buffer();
while (true) {
long i = $this$readQuotedString.indexOfElement(QUOTED_STRING_DELIMITERS);
if (i == -1) {
return null;
}
if ($this$readQuotedString.getByte(i) == b) {
result.write($this$readQuotedString, i);
$this$readQuotedString.readByte();
return result.readUtf8();
}
if ($this$readQuotedString.size() == i + 1) {
return null;
}
result.write($this$readQuotedString, i);
$this$readQuotedString.readByte();
result.write($this$readQuotedString, 1L);
}
}
private static final String readToken(Buffer $this$readToken) {
long tokenSize = $this$readToken.indexOfElement(TOKEN_DELIMITERS);
if (tokenSize == -1) {
tokenSize = $this$readToken.size();
}
if (tokenSize != 0) {
return $this$readToken.readUtf8(tokenSize);
}
return null;
}
public static final void receiveHeaders(CookieJar receiveHeaders, HttpUrl url, Headers headers) {
Intrinsics.checkNotNullParameter(receiveHeaders, "$this$receiveHeaders");
Intrinsics.checkNotNullParameter(url, "url");
Intrinsics.checkNotNullParameter(headers, "headers");
if (receiveHeaders == CookieJar.NO_COOKIES) {
return;
}
List cookies = Cookie.INSTANCE.parseAll(url, headers);
if (cookies.isEmpty()) {
return;
}
receiveHeaders.saveFromResponse(url, cookies);
}
public static final boolean promisesBody(Response promisesBody) {
Intrinsics.checkNotNullParameter(promisesBody, "$this$promisesBody");
if (Intrinsics.areEqual(promisesBody.request().method(), "HEAD")) {
return false;
}
int responseCode = promisesBody.code();
return (((responseCode >= 100 && responseCode < 200) || responseCode == 204 || responseCode == 304) && Util.headersContentLength(promisesBody) == -1 && !StringsKt.equals("chunked", Response.header$default(promisesBody, com.google.common.net.HttpHeaders.TRANSFER_ENCODING, null, 2, null), true)) ? false : true;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "No longer supported", replaceWith = @ReplaceWith(expression = "response.promisesBody()", imports = {}))
public static final boolean hasBody(Response response) {
Intrinsics.checkNotNullParameter(response, "response");
return promisesBody(response);
}
}
@@ -0,0 +1,42 @@
package okhttp3.internal.http;
import kotlin.Metadata;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: HttpMethod.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0005\\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u000e\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006J\u0010\u0010\u0007\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0007J\u000e\u0010\b\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006J\u000e\u0010\t\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006J\u0010\u0010\n\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0007¨\u0006\u000b"}, m238d2 = {"Lokhttp3/internal/http/HttpMethod;", "", "()V", "invalidatesCache", "", "method", "", "permitsRequestBody", "redirectsToGet", "redirectsWithBody", "requiresRequestBody", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class HttpMethod {
public static final HttpMethod INSTANCE = new HttpMethod();
private HttpMethod() {
}
public final boolean invalidatesCache(String method) {
Intrinsics.checkNotNullParameter(method, "method");
return Intrinsics.areEqual(method, "POST") || Intrinsics.areEqual(method, "PATCH") || Intrinsics.areEqual(method, "PUT") || Intrinsics.areEqual(method, "DELETE") || Intrinsics.areEqual(method, "MOVE");
}
@JvmStatic
public static final boolean requiresRequestBody(String method) {
Intrinsics.checkNotNullParameter(method, "method");
return Intrinsics.areEqual(method, "POST") || Intrinsics.areEqual(method, "PUT") || Intrinsics.areEqual(method, "PATCH") || Intrinsics.areEqual(method, "PROPPATCH") || Intrinsics.areEqual(method, "REPORT");
}
@JvmStatic
public static final boolean permitsRequestBody(String method) {
Intrinsics.checkNotNullParameter(method, "method");
return (Intrinsics.areEqual(method, "GET") || Intrinsics.areEqual(method, "HEAD")) ? false : true;
}
public final boolean redirectsWithBody(String method) {
Intrinsics.checkNotNullParameter(method, "method");
return Intrinsics.areEqual(method, "PROPFIND");
}
public final boolean redirectsToGet(String method) {
Intrinsics.checkNotNullParameter(method, "method");
return !Intrinsics.areEqual(method, "PROPFIND");
}
}
@@ -0,0 +1,209 @@
package okhttp3.internal.http;
import androidx.core.app.NotificationCompat;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.Call;
import okhttp3.Connection;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.internal.Util;
import okhttp3.internal.connection.Exchange;
import okhttp3.internal.connection.RealCall;
/* compiled from: RealInterceptorChain.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000L\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u000f\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u00002\u00020\u0001BM\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00060\u0005\u0012\u0006\u0010\u0007\u001a\u00020\b\u0012\b\u0010\t\u001a\u0004\u0018\u00010\n\u0012\u0006\u0010\u000b\u001a\u00020\f\u0012\u0006\u0010\r\u001a\u00020\b\u0012\u0006\u0010\u000e\u001a\u00020\b\u0012\u0006\u0010\u000f\u001a\u00020\\u0006\u0002\u0010\u0010J\b\u0010\u0002\u001a\u00020\u001cH\u0016J\b\u0010\r\u001a\u00020\bH\u0016J\n\u0010\u001d\u001a\u0004\u0018\u00010\u001eH\u0016JK\u0010\u001f\u001a\u00020\u00002\b\b\u0002\u0010\u0007\u001a\u00020\b2\n\b\u0002\u0010\t\u001a\u0004\u0018\u00010\n2\b\b\u0002\u0010\u000b\u001a\u00020\f2\b\b\u0002\u0010\r\u001a\u00020\b2\b\b\u0002\u0010\u000e\u001a\u00020\b2\b\b\u0002\u0010\u000f\u001a\u00020\bH\u0000¢\u0006\u0002\b J\u0010\u0010!\u001a\u00020\"2\u0006\u0010\u000b\u001a\u00020\fH\u0016J\b\u0010\u000e\u001a\u00020\bH\u0016J\b\u0010\u000b\u001a\u00020\fH\u0016J\u0018\u0010#\u001a\u00020\u00012\u0006\u0010$\u001a\u00020\b2\u0006\u0010%\u001a\u00020&H\u0016J\u0018\u0010'\u001a\u00020\u00012\u0006\u0010$\u001a\u00020\b2\u0006\u0010%\u001a\u00020&H\u0016J\u0018\u0010(\u001a\u00020\u00012\u0006\u0010$\u001a\u00020\b2\u0006\u0010%\u001a\u00020&H\u0016J\b\u0010\u000f\u001a\u00020\bH\u0016R\u0014\u0010\u0002\u001a\u00020\u0003X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0011\u0010\u0012R\u000e\u0010\u0013\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\r\u001a\u00020\bX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0014\u0010\u0015R\u0016\u0010\t\u001a\u0004\u0018\u00010\nX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0016\u0010\u0017R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00060\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u000e\u001a\u00020\bX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0018\u0010\u0015R\u0014\u0010\u000b\u001a\u00020\fX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0019\u0010\u001aR\u0014\u0010\u000f\u001a\u00020\bX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u001b\u0010\u0015¨\u0006)"}, m238d2 = {"Lokhttp3/internal/http/RealInterceptorChain;", "Lokhttp3/Interceptor$Chain;", NotificationCompat.CATEGORY_CALL, "Lokhttp3/internal/connection/RealCall;", "interceptors", "", "Lokhttp3/Interceptor;", "index", "", "exchange", "Lokhttp3/internal/connection/Exchange;", "request", "Lokhttp3/Request;", "connectTimeoutMillis", "readTimeoutMillis", "writeTimeoutMillis", "(Lokhttp3/internal/connection/RealCall;Ljava/util/List;ILokhttp3/internal/connection/Exchange;Lokhttp3/Request;III)V", "getCall$okhttp", "()Lokhttp3/internal/connection/RealCall;", "calls", "getConnectTimeoutMillis$okhttp", "()I", "getExchange$okhttp", "()Lokhttp3/internal/connection/Exchange;", "getReadTimeoutMillis$okhttp", "getRequest$okhttp", "()Lokhttp3/Request;", "getWriteTimeoutMillis$okhttp", "Lokhttp3/Call;", "connection", "Lokhttp3/Connection;", "copy", "copy$okhttp", "proceed", "Lokhttp3/Response;", "withConnectTimeout", "timeout", "unit", "Ljava/util/concurrent/TimeUnit;", "withReadTimeout", "withWriteTimeout", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class RealInterceptorChain implements Interceptor.Chain {
private final RealCall call;
private int calls;
private final int connectTimeoutMillis;
private final Exchange exchange;
private final int index;
private final List<Interceptor> interceptors;
private final int readTimeoutMillis;
private final Request request;
private final int writeTimeoutMillis;
/* JADX WARN: Multi-variable type inference failed */
public RealInterceptorChain(RealCall call, List<? extends Interceptor> interceptors, int index, Exchange exchange, Request request, int connectTimeoutMillis, int readTimeoutMillis, int writeTimeoutMillis) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(interceptors, "interceptors");
Intrinsics.checkNotNullParameter(request, "request");
this.call = call;
this.interceptors = interceptors;
this.index = index;
this.exchange = exchange;
this.request = request;
this.connectTimeoutMillis = connectTimeoutMillis;
this.readTimeoutMillis = readTimeoutMillis;
this.writeTimeoutMillis = writeTimeoutMillis;
}
/* renamed from: getCall$okhttp, reason: from getter */
public final RealCall getCall() {
return this.call;
}
/* renamed from: getExchange$okhttp, reason: from getter */
public final Exchange getExchange() {
return this.exchange;
}
/* renamed from: getRequest$okhttp, reason: from getter */
public final Request getRequest() {
return this.request;
}
public final int getConnectTimeoutMillis$okhttp() {
return this.connectTimeoutMillis;
}
/* renamed from: getReadTimeoutMillis$okhttp, reason: from getter */
public final int getReadTimeoutMillis() {
return this.readTimeoutMillis;
}
/* renamed from: getWriteTimeoutMillis$okhttp, reason: from getter */
public final int getWriteTimeoutMillis() {
return this.writeTimeoutMillis;
}
public static /* synthetic */ RealInterceptorChain copy$okhttp$default(RealInterceptorChain realInterceptorChain, int i, Exchange exchange, Request request, int i2, int i3, int i4, int i5, Object obj) {
Exchange exchange2;
Request request2;
int i6;
int i7;
int i8;
if ((i5 & 1) != 0) {
i = realInterceptorChain.index;
}
if ((i5 & 2) == 0) {
exchange2 = exchange;
} else {
exchange2 = realInterceptorChain.exchange;
}
if ((i5 & 4) == 0) {
request2 = request;
} else {
request2 = realInterceptorChain.request;
}
if ((i5 & 8) == 0) {
i6 = i2;
} else {
i6 = realInterceptorChain.connectTimeoutMillis;
}
if ((i5 & 16) == 0) {
i7 = i3;
} else {
i7 = realInterceptorChain.readTimeoutMillis;
}
if ((i5 & 32) == 0) {
i8 = i4;
} else {
i8 = realInterceptorChain.writeTimeoutMillis;
}
return realInterceptorChain.copy$okhttp(i, exchange2, request2, i6, i7, i8);
}
public final RealInterceptorChain copy$okhttp(int index, Exchange exchange, Request request, int connectTimeoutMillis, int readTimeoutMillis, int writeTimeoutMillis) {
Intrinsics.checkNotNullParameter(request, "request");
return new RealInterceptorChain(this.call, this.interceptors, index, exchange, request, connectTimeoutMillis, readTimeoutMillis, writeTimeoutMillis);
}
@Override // okhttp3.Interceptor.Chain
public Connection connection() {
Exchange exchange = this.exchange;
return exchange != null ? exchange.getConnection() : null;
}
@Override // okhttp3.Interceptor.Chain
/* renamed from: connectTimeoutMillis, reason: from getter */
public int getConnectTimeoutMillis() {
return this.connectTimeoutMillis;
}
@Override // okhttp3.Interceptor.Chain
public Interceptor.Chain withConnectTimeout(int timeout, TimeUnit unit) {
Intrinsics.checkNotNullParameter(unit, "unit");
if (this.exchange == null) {
return copy$okhttp$default(this, 0, null, null, Util.checkDuration("connectTimeout", timeout, unit), 0, 0, 55, null);
}
throw new IllegalStateException("Timeouts can't be adjusted in a network interceptor".toString());
}
@Override // okhttp3.Interceptor.Chain
public int readTimeoutMillis() {
return this.readTimeoutMillis;
}
@Override // okhttp3.Interceptor.Chain
public Interceptor.Chain withReadTimeout(int timeout, TimeUnit unit) {
Intrinsics.checkNotNullParameter(unit, "unit");
if (this.exchange == null) {
return copy$okhttp$default(this, 0, null, null, 0, Util.checkDuration("readTimeout", timeout, unit), 0, 47, null);
}
throw new IllegalStateException("Timeouts can't be adjusted in a network interceptor".toString());
}
@Override // okhttp3.Interceptor.Chain
public int writeTimeoutMillis() {
return this.writeTimeoutMillis;
}
@Override // okhttp3.Interceptor.Chain
public Interceptor.Chain withWriteTimeout(int timeout, TimeUnit unit) {
Intrinsics.checkNotNullParameter(unit, "unit");
if (this.exchange == null) {
return copy$okhttp$default(this, 0, null, null, 0, 0, Util.checkDuration("writeTimeout", timeout, unit), 31, null);
}
throw new IllegalStateException("Timeouts can't be adjusted in a network interceptor".toString());
}
@Override // okhttp3.Interceptor.Chain
public Call call() {
return this.call;
}
@Override // okhttp3.Interceptor.Chain
public Request request() {
return this.request;
}
@Override // okhttp3.Interceptor.Chain
public Response proceed(Request request) throws IOException {
Intrinsics.checkNotNullParameter(request, "request");
if (!(this.index < this.interceptors.size())) {
throw new IllegalStateException("Check failed.".toString());
}
this.calls++;
Exchange exchange = this.exchange;
if (exchange != null) {
if (!exchange.getFinder().sameHostAndPort(request.url())) {
throw new IllegalStateException(("network interceptor " + this.interceptors.get(this.index - 1) + " must retain the same host and port").toString());
}
if (!(this.calls == 1)) {
throw new IllegalStateException(("network interceptor " + this.interceptors.get(this.index - 1) + " must call proceed() exactly once").toString());
}
}
RealInterceptorChain next = copy$okhttp$default(this, this.index + 1, null, request, 0, 0, 0, 58, null);
Interceptor interceptor = this.interceptors.get(this.index);
Response response = interceptor.intercept(next);
if (response == null) {
throw new NullPointerException("interceptor " + interceptor + " returned null");
}
if (this.exchange != null) {
if (!(this.index + 1 >= this.interceptors.size() || next.calls == 1)) {
throw new IllegalStateException(("network interceptor " + interceptor + " must call proceed() exactly once").toString());
}
}
if (!(response.body() != null)) {
throw new IllegalStateException(("interceptor " + interceptor + " returned a response with no body").toString());
}
return response;
}
}
@@ -0,0 +1,45 @@
package okhttp3.internal.http;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.MediaType;
import okhttp3.ResponseBody;
import okio.BufferedSource;
/* compiled from: RealResponseBody.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\u001f\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007¢\u0006\u0002\u0010\bJ\b\u0010\u0004\u001a\u00020\u0005H\u0016J\n\u0010\t\u001a\u0004\u0018\u00010\nH\u0016J\b\u0010\u0006\u001a\u00020\u0007H\u0016R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0002\u001a\u0004\u0018\u00010\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u000b"}, m238d2 = {"Lokhttp3/internal/http/RealResponseBody;", "Lokhttp3/ResponseBody;", "contentTypeString", "", "contentLength", "", "source", "Lokio/BufferedSource;", "(Ljava/lang/String;JLokio/BufferedSource;)V", "contentType", "Lokhttp3/MediaType;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class RealResponseBody extends ResponseBody {
private final long contentLength;
private final String contentTypeString;
private final BufferedSource source;
public RealResponseBody(String contentTypeString, long contentLength, BufferedSource source) {
Intrinsics.checkNotNullParameter(source, "source");
this.contentTypeString = contentTypeString;
this.contentLength = contentLength;
this.source = source;
}
@Override // okhttp3.ResponseBody
/* renamed from: contentLength, reason: from getter */
public long getContentLength() {
return this.contentLength;
}
@Override // okhttp3.ResponseBody
/* renamed from: contentType */
public MediaType get$contentType() {
String str = this.contentTypeString;
if (str != null) {
return MediaType.INSTANCE.parse(str);
}
return null;
}
@Override // okhttp3.ResponseBody
/* renamed from: source, reason: from getter */
public BufferedSource getSource() {
return this.source;
}
}
@@ -0,0 +1,50 @@
package okhttp3.internal.http;
import com.google.android.gms.common.internal.ImagesContract;
import java.net.Proxy;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.HttpUrl;
import okhttp3.Request;
/* compiled from: RequestLine.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bJ\u0018\u0010\t\u001a\u00020\n2\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0002J\u000e\u0010\u000b\u001a\u00020\u00042\u0006\u0010\f\u001a\u00020\\u0006\u000e"}, m238d2 = {"Lokhttp3/internal/http/RequestLine;", "", "()V", "get", "", "request", "Lokhttp3/Request;", "proxyType", "Ljava/net/Proxy$Type;", "includeAuthorityInRequestLine", "", "requestPath", ImagesContract.URL, "Lokhttp3/HttpUrl;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class RequestLine {
public static final RequestLine INSTANCE = new RequestLine();
private RequestLine() {
}
public final String get(Request request, Proxy.Type proxyType) {
Intrinsics.checkNotNullParameter(request, "request");
Intrinsics.checkNotNullParameter(proxyType, "proxyType");
StringBuilder $this$buildString = new StringBuilder();
$this$buildString.append(request.method());
$this$buildString.append(' ');
RequestLine requestLine = INSTANCE;
if (requestLine.includeAuthorityInRequestLine(request, proxyType)) {
$this$buildString.append(request.url());
} else {
$this$buildString.append(requestLine.requestPath(request.url()));
}
$this$buildString.append(" HTTP/1.1");
String sb = $this$buildString.toString();
Intrinsics.checkNotNullExpressionValue(sb, "StringBuilder().apply(builderAction).toString()");
return sb;
}
private final boolean includeAuthorityInRequestLine(Request request, Proxy.Type proxyType) {
return !request.isHttps() && proxyType == Proxy.Type.HTTP;
}
public final String requestPath(HttpUrl url) {
Intrinsics.checkNotNullParameter(url, "url");
String path = url.encodedPath();
String query = url.encodedQuery();
if (query == null) {
return path;
}
return path + '?' + query;
}
}
@@ -0,0 +1,230 @@
package okhttp3.internal.http;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.core.app.NotificationCompat;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.ProtocolException;
import java.net.Proxy;
import java.net.SocketTimeoutException;
import java.security.cert.CertificateException;
import java.util.Collection;
import java.util.List;
import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLPeerUnverifiedException;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Regex;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.Route;
import okhttp3.internal.Util;
import okhttp3.internal.connection.Exchange;
import okhttp3.internal.connection.RealCall;
import okhttp3.internal.connection.RealConnection;
import okhttp3.internal.connection.RouteException;
import okhttp3.internal.http2.ConnectionShutdownException;
/* compiled from: RetryAndFollowUpInterceptor.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000R\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0003\u0018\u0000 \u001e2\u00020\u0001:\u0001\u001eB\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\u001a\u0010\u0005\u001a\u0004\u0018\u00010\u00062\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\nH\u0002J\u001c\u0010\u000b\u001a\u0004\u0018\u00010\u00062\u0006\u0010\u0007\u001a\u00020\b2\b\u0010\f\u001a\u0004\u0018\u00010\rH\u0002J\u0010\u0010\u000e\u001a\u00020\b2\u0006\u0010\u000f\u001a\u00020\u0010H\u0016J\u0018\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u0012H\u0002J(\u0010\u0016\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0019\u001a\u00020\u00062\u0006\u0010\u0015\u001a\u00020\u0012H\u0002J\u0018\u0010\u001a\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0019\u001a\u00020\u0006H\u0002J\u0018\u0010\u001b\u001a\u00020\u001c2\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\u001d\u001a\u00020\u001cH\u0002R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u001f"}, m238d2 = {"Lokhttp3/internal/http/RetryAndFollowUpInterceptor;", "Lokhttp3/Interceptor;", "client", "Lokhttp3/OkHttpClient;", "(Lokhttp3/OkHttpClient;)V", "buildRedirectRequest", "Lokhttp3/Request;", "userResponse", "Lokhttp3/Response;", "method", "", "followUpRequest", "exchange", "Lokhttp3/internal/connection/Exchange;", "intercept", "chain", "Lokhttp3/Interceptor$Chain;", "isRecoverable", "", "e", "Ljava/io/IOException;", "requestSendStarted", "recover", NotificationCompat.CATEGORY_CALL, "Lokhttp3/internal/connection/RealCall;", "userRequest", "requestIsOneShot", "retryAfter", "", "defaultDelay", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class RetryAndFollowUpInterceptor implements Interceptor {
private static final int MAX_FOLLOW_UPS = 20;
private final OkHttpClient client;
public RetryAndFollowUpInterceptor(OkHttpClient client) {
Intrinsics.checkNotNullParameter(client, "client");
this.client = client;
}
@Override // okhttp3.Interceptor
public Response intercept(Interceptor.Chain chain) throws IOException {
Intrinsics.checkNotNullParameter(chain, "chain");
RealInterceptorChain realChain = (RealInterceptorChain) chain;
Request request = ((RealInterceptorChain) chain).getRequest();
RealCall call = realChain.getCall();
Response priorResponse = (Response) null;
List recoveredFailures = CollectionsKt.emptyList();
boolean newExchangeFinder = true;
Response priorResponse2 = priorResponse;
int followUpCount = 0;
Request request2 = request;
while (true) {
call.enterNetworkInterceptorExchange(request2, newExchangeFinder);
boolean closeActiveExchange = true;
try {
} catch (IOException e) {
if (!recover(e, call, request2, e instanceof ConnectionShutdownException ? false : true)) {
throw Util.withSuppressed(e, recoveredFailures);
}
recoveredFailures = CollectionsKt.plus((Collection<? extends IOException>) recoveredFailures, e);
newExchangeFinder = false;
} catch (RouteException e2) {
if (!recover(e2.getLastConnectException(), call, request2, false)) {
throw Util.withSuppressed(e2.getFirstConnectException(), recoveredFailures);
}
recoveredFailures = CollectionsKt.plus((Collection<? extends IOException>) recoveredFailures, e2.getFirstConnectException());
newExchangeFinder = false;
} finally {
call.exitNetworkInterceptorExchange$okhttp(closeActiveExchange);
}
if (call.getCanceled()) {
throw new IOException("Canceled");
}
Response response = realChain.proceed(request2);
newExchangeFinder = true;
if (priorResponse2 != null) {
response = response.newBuilder().priorResponse(priorResponse2.newBuilder().body(null).build()).build();
}
Exchange exchange = call.getInterceptorScopedExchange();
Request followUp = followUpRequest(response, exchange);
if (followUp == null) {
if (exchange != null && exchange.getIsDuplex()) {
call.timeoutEarlyExit();
}
closeActiveExchange = false;
return response;
}
RequestBody followUpBody = followUp.body();
if (followUpBody != null && followUpBody.isOneShot()) {
closeActiveExchange = false;
return response;
}
ResponseBody body = response.body();
if (body != null) {
Util.closeQuietly(body);
}
followUpCount++;
if (followUpCount > 20) {
throw new ProtocolException("Too many follow-up requests: " + followUpCount);
}
request2 = followUp;
priorResponse2 = response;
call.exitNetworkInterceptorExchange$okhttp(closeActiveExchange);
}
}
private final boolean recover(IOException e, RealCall call, Request userRequest, boolean requestSendStarted) {
if (this.client.retryOnConnectionFailure()) {
return !(requestSendStarted && requestIsOneShot(e, userRequest)) && isRecoverable(e, requestSendStarted) && call.retryAfterFailure();
}
return false;
}
private final boolean requestIsOneShot(IOException e, Request userRequest) {
RequestBody requestBody = userRequest.body();
return (requestBody != null && requestBody.isOneShot()) || (e instanceof FileNotFoundException);
}
private final boolean isRecoverable(IOException e, boolean requestSendStarted) {
if (e instanceof ProtocolException) {
return false;
}
return e instanceof InterruptedIOException ? (e instanceof SocketTimeoutException) && !requestSendStarted : (((e instanceof SSLHandshakeException) && (e.getCause() instanceof CertificateException)) || (e instanceof SSLPeerUnverifiedException)) ? false : true;
}
private final Request followUpRequest(Response userResponse, Exchange exchange) throws IOException {
RealConnection connection;
Route route = (exchange == null || (connection = exchange.getConnection()) == null) ? null : connection.getRoute();
int responseCode = userResponse.code();
String method = userResponse.request().method();
switch (responseCode) {
case 300:
case 301:
case 302:
case 303:
case 307:
case 308:
return buildRedirectRequest(userResponse, method);
case TypedValues.Cycle.TYPE_CURVE_FIT /* 401 */:
return this.client.authenticator().authenticate(route, userResponse);
case 407:
Intrinsics.checkNotNull(route);
Proxy selectedProxy = route.proxy();
if (selectedProxy.type() != Proxy.Type.HTTP) {
throw new ProtocolException("Received HTTP_PROXY_AUTH (407) code while not using proxy");
}
return this.client.proxyAuthenticator().authenticate(route, userResponse);
case 408:
if (!this.client.retryOnConnectionFailure()) {
return null;
}
RequestBody requestBody = userResponse.request().body();
if (requestBody != null && requestBody.isOneShot()) {
return null;
}
Response priorResponse = userResponse.priorResponse();
if ((priorResponse != null && priorResponse.code() == 408) || retryAfter(userResponse, 0) > 0) {
return null;
}
return userResponse.request();
case 421:
RequestBody requestBody2 = userResponse.request().body();
if ((requestBody2 != null && requestBody2.isOneShot()) || exchange == null || !exchange.isCoalescedConnection$okhttp()) {
return null;
}
exchange.getConnection().noCoalescedConnections$okhttp();
return userResponse.request();
case TypedValues.Position.TYPE_PERCENT_WIDTH /* 503 */:
Response priorResponse2 = userResponse.priorResponse();
if ((priorResponse2 != null && priorResponse2.code() == 503) || retryAfter(userResponse, Integer.MAX_VALUE) != 0) {
return null;
}
return userResponse.request();
default:
return null;
}
}
private final Request buildRedirectRequest(Response userResponse, String method) {
String location;
HttpUrl url;
if (!this.client.followRedirects() || (location = Response.header$default(userResponse, com.google.common.net.HttpHeaders.LOCATION, null, 2, null)) == null || (url = userResponse.request().url().resolve(location)) == null) {
return null;
}
boolean sameScheme = Intrinsics.areEqual(url.scheme(), userResponse.request().url().scheme());
if (!sameScheme && !this.client.followSslRedirects()) {
return null;
}
Request.Builder requestBuilder = userResponse.request().newBuilder();
if (HttpMethod.permitsRequestBody(method)) {
int responseCode = userResponse.code();
boolean maintainBody = HttpMethod.INSTANCE.redirectsWithBody(method) || responseCode == 308 || responseCode == 307;
if (HttpMethod.INSTANCE.redirectsToGet(method) && responseCode != 308 && responseCode != 307) {
requestBuilder.method("GET", null);
} else {
RequestBody requestBody = maintainBody ? userResponse.request().body() : null;
requestBuilder.method(method, requestBody);
}
if (!maintainBody) {
requestBuilder.removeHeader(com.google.common.net.HttpHeaders.TRANSFER_ENCODING);
requestBuilder.removeHeader(com.google.common.net.HttpHeaders.CONTENT_LENGTH);
requestBuilder.removeHeader(com.google.common.net.HttpHeaders.CONTENT_TYPE);
}
}
if (!Util.canReuseConnectionFor(userResponse.request().url(), url)) {
requestBuilder.removeHeader(com.google.common.net.HttpHeaders.AUTHORIZATION);
}
return requestBuilder.url(url).build();
}
private final int retryAfter(Response userResponse, int defaultDelay) {
String header = Response.header$default(userResponse, com.google.common.net.HttpHeaders.RETRY_AFTER, null, 2, null);
if (header == null) {
return defaultDelay;
}
if (new Regex("\\d+").matches(header)) {
Integer valueOf = Integer.valueOf(header);
Intrinsics.checkNotNullExpressionValue(valueOf, "Integer.valueOf(header)");
return valueOf.intValue();
}
return Integer.MAX_VALUE;
}
}
@@ -0,0 +1,113 @@
package okhttp3.internal.http;
import java.io.IOException;
import java.net.ProtocolException;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import okhttp3.Protocol;
import okhttp3.Response;
/* compiled from: StatusLine.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0004\u0018\u0000 \n2\u00020\u0001:\u0001\nB\u001d\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007¢\u0006\u0002\u0010\bJ\b\u0010\t\u001a\u00020\u0007H\u0016R\u0010\u0010\u0004\u001a\u00020\u00058\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0006\u001a\u00020\u00078\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0002\u001a\u00020\u00038\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006\u000b"}, m238d2 = {"Lokhttp3/internal/http/StatusLine;", "", "protocol", "Lokhttp3/Protocol;", "code", "", "message", "", "(Lokhttp3/Protocol;ILjava/lang/String;)V", "toString", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class StatusLine {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
public static final int HTTP_CONTINUE = 100;
public static final int HTTP_MISDIRECTED_REQUEST = 421;
public static final int HTTP_PERM_REDIRECT = 308;
public static final int HTTP_TEMP_REDIRECT = 307;
public final int code;
public final String message;
public final Protocol protocol;
public StatusLine(Protocol protocol, int code, String message) {
Intrinsics.checkNotNullParameter(protocol, "protocol");
Intrinsics.checkNotNullParameter(message, "message");
this.protocol = protocol;
this.code = code;
this.message = message;
}
public String toString() {
StringBuilder $this$buildString = new StringBuilder();
if (this.protocol == Protocol.HTTP_1_0) {
$this$buildString.append("HTTP/1.0");
} else {
$this$buildString.append("HTTP/1.1");
}
$this$buildString.append(' ');
$this$buildString.append(this.code);
$this$buildString.append(' ');
$this$buildString.append(this.message);
String sb = $this$buildString.toString();
Intrinsics.checkNotNullExpressionValue(sb, "StringBuilder().apply(builderAction).toString()");
return sb;
}
/* compiled from: StatusLine.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u000e\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000bJ\u000e\u0010\f\u001a\u00020\t2\u0006\u0010\r\u001a\u00020\u000eR\u000e\u0010\u0003\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000¨\u0006\u000f"}, m238d2 = {"Lokhttp3/internal/http/StatusLine$Companion;", "", "()V", "HTTP_CONTINUE", "", "HTTP_MISDIRECTED_REQUEST", "HTTP_PERM_REDIRECT", "HTTP_TEMP_REDIRECT", "get", "Lokhttp3/internal/http/StatusLine;", "response", "Lokhttp3/Response;", "parse", "statusLine", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public final StatusLine get(Response response) {
Intrinsics.checkNotNullParameter(response, "response");
return new StatusLine(response.protocol(), response.code(), response.message());
}
public final StatusLine parse(String statusLine) throws IOException {
Protocol protocol;
int codeStart;
Protocol protocol2;
Intrinsics.checkNotNullParameter(statusLine, "statusLine");
if (StringsKt.startsWith$default(statusLine, "HTTP/1.", false, 2, (Object) null)) {
if (statusLine.length() < 9 || statusLine.charAt(8) != ' ') {
throw new ProtocolException("Unexpected status line: " + statusLine);
}
int httpMinorVersion = statusLine.charAt(7) - '0';
codeStart = 9;
if (httpMinorVersion == 0) {
protocol2 = Protocol.HTTP_1_0;
} else if (httpMinorVersion == 1) {
protocol2 = Protocol.HTTP_1_1;
} else {
throw new ProtocolException("Unexpected status line: " + statusLine);
}
protocol = protocol2;
} else if (StringsKt.startsWith$default(statusLine, "ICY ", false, 2, (Object) null)) {
protocol = Protocol.HTTP_1_0;
codeStart = 4;
} else {
throw new ProtocolException("Unexpected status line: " + statusLine);
}
if (statusLine.length() < codeStart + 3) {
throw new ProtocolException("Unexpected status line: " + statusLine);
}
try {
String substring = statusLine.substring(codeStart, codeStart + 3);
Intrinsics.checkNotNullExpressionValue(substring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
int code = Integer.parseInt(substring);
String message = "";
if (statusLine.length() > codeStart + 3) {
if (statusLine.charAt(codeStart + 3) != ' ') {
throw new ProtocolException("Unexpected status line: " + statusLine);
}
String substring2 = statusLine.substring(codeStart + 4);
Intrinsics.checkNotNullExpressionValue(substring2, "(this as java.lang.String).substring(startIndex)");
message = substring2;
}
return new StatusLine(protocol, code, message);
} catch (NumberFormatException e) {
throw new ProtocolException("Unexpected status line: " + statusLine);
}
}
}
}
@@ -0,0 +1,43 @@
package okhttp3.internal.http1;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.Headers;
import okio.BufferedSource;
/* compiled from: HeadersReader.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\u0018\u0000 \r2\u00020\u0001:\u0001\rB\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\u0006\u0010\t\u001a\u00020\nJ\u0006\u0010\u000b\u001a\u00020\fR\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\\u0006\u000e"}, m238d2 = {"Lokhttp3/internal/http1/HeadersReader;", "", "source", "Lokio/BufferedSource;", "(Lokio/BufferedSource;)V", "headerLimit", "", "getSource", "()Lokio/BufferedSource;", "readHeaders", "Lokhttp3/Headers;", "readLine", "", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class HeadersReader {
private static final int HEADER_LIMIT = 262144;
private long headerLimit;
private final BufferedSource source;
public HeadersReader(BufferedSource source) {
Intrinsics.checkNotNullParameter(source, "source");
this.source = source;
this.headerLimit = 262144;
}
public final BufferedSource getSource() {
return this.source;
}
public final String readLine() {
String line = this.source.readUtf8LineStrict(this.headerLimit);
this.headerLimit -= line.length();
return line;
}
public final Headers readHeaders() {
Headers.Builder result = new Headers.Builder();
while (true) {
String line = readLine();
if (!(line.length() == 0)) {
result.addLenient$okhttp(line);
} else {
return result.build();
}
}
}
}
@@ -0,0 +1,602 @@
package okhttp3.internal.http1;
import com.google.android.gms.common.internal.ImagesContract;
import com.google.common.net.HttpHeaders;
import java.io.EOFException;
import java.io.IOException;
import java.net.ProtocolException;
import java.net.Proxy;
import java.util.concurrent.TimeUnit;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import kotlin.text.Typography;
import okhttp3.CookieJar;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.internal.Util;
import okhttp3.internal.connection.RealConnection;
import okhttp3.internal.http.ExchangeCodec;
import okhttp3.internal.http.RequestLine;
import okhttp3.internal.http.StatusLine;
import okio.Buffer;
import okio.BufferedSink;
import okio.BufferedSource;
import okio.ForwardingTimeout;
import okio.Sink;
import okio.Source;
import okio.Timeout;
/* compiled from: Http1ExchangeCodec.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0088\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u000e\n\u0002\b\t\u0018\u0000 ?2\u00020\u0001:\u0007<=>?@ABB'\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\\u0006\u0002\u0010\nJ\b\u0010\u001b\u001a\u00020\u001cH\u0016J\u0018\u0010\u001d\u001a\u00020\u001e2\u0006\u0010\u001f\u001a\u00020\u00172\u0006\u0010 \u001a\u00020!H\u0016J\u0010\u0010\"\u001a\u00020\u001c2\u0006\u0010#\u001a\u00020$H\u0002J\b\u0010%\u001a\u00020\u001cH\u0016J\b\u0010&\u001a\u00020\u001cH\u0016J\b\u0010'\u001a\u00020\u001eH\u0002J\u0010\u0010(\u001a\u00020)2\u0006\u0010*\u001a\u00020+H\u0002J\u0010\u0010,\u001a\u00020)2\u0006\u0010-\u001a\u00020!H\u0002J\b\u0010.\u001a\u00020\u001eH\u0002J\b\u0010/\u001a\u00020)H\u0002J\u0010\u00100\u001a\u00020)2\u0006\u00101\u001a\u00020\u0019H\u0016J\u0012\u00102\u001a\u0004\u0018\u0001032\u0006\u00104\u001a\u00020\u0010H\u0016J\u0010\u00105\u001a\u00020!2\u0006\u00101\u001a\u00020\u0019H\u0016J\u000e\u00106\u001a\u00020\u001c2\u0006\u00101\u001a\u00020\u0019J\b\u0010\u0014\u001a\u00020\u0015H\u0016J\u0016\u00107\u001a\u00020\u001c2\u0006\u00108\u001a\u00020\u00152\u0006\u00109\u001a\u00020:J\u0010\u0010;\u001a\u00020\u001c2\u0006\u0010\u001f\u001a\u00020\u0017H\u0016R\u0010\u0010\u0002\u001a\u0004\u0018\u00010\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0004\u001a\u00020\u0005X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\fR\u000e\u0010\r\u001a\u00020\u000eX\u0082\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\u000f\u001a\u00020\u00108F¢\u0006\u0006\u001a\u0004\b\u000f\u0010\u0011R\u000e\u0010\b\u001a\u00020\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0012\u001a\u00020\u0013X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u0014\u001a\u0004\u0018\u00010\u0015X\u0082\u000e¢\u0006\u0002\n\u0000R\u0018\u0010\u0016\u001a\u00020\u0010*\u00020\u00178BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0016\u0010\u0018R\u0018\u0010\u0016\u001a\u00020\u0010*\u00020\u00198BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0016\u0010\u001a¨\u0006C"}, m238d2 = {"Lokhttp3/internal/http1/Http1ExchangeCodec;", "Lokhttp3/internal/http/ExchangeCodec;", "client", "Lokhttp3/OkHttpClient;", "connection", "Lokhttp3/internal/connection/RealConnection;", "source", "Lokio/BufferedSource;", "sink", "Lokio/BufferedSink;", "(Lokhttp3/OkHttpClient;Lokhttp3/internal/connection/RealConnection;Lokio/BufferedSource;Lokio/BufferedSink;)V", "getConnection", "()Lokhttp3/internal/connection/RealConnection;", "headersReader", "Lokhttp3/internal/http1/HeadersReader;", "isClosed", "", "()Z", "state", "", "trailers", "Lokhttp3/Headers;", "isChunked", "Lokhttp3/Request;", "(Lokhttp3/Request;)Z", "Lokhttp3/Response;", "(Lokhttp3/Response;)Z", "cancel", "", "createRequestBody", "Lokio/Sink;", "request", "contentLength", "", "detachTimeout", "timeout", "Lokio/ForwardingTimeout;", "finishRequest", "flushRequest", "newChunkedSink", "newChunkedSource", "Lokio/Source;", ImagesContract.URL, "Lokhttp3/HttpUrl;", "newFixedLengthSource", "length", "newKnownLengthSink", "newUnknownLengthSource", "openResponseBodySource", "response", "readResponseHeaders", "Lokhttp3/Response$Builder;", "expectContinue", "reportedContentLength", "skipConnectBody", "writeRequest", "headers", "requestLine", "", "writeRequestHeaders", "AbstractSource", "ChunkedSink", "ChunkedSource", "Companion", "FixedLengthSource", "KnownLengthSink", "UnknownLengthSource", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Http1ExchangeCodec implements ExchangeCodec {
private static final long NO_CHUNK_YET = -1;
private static final int STATE_CLOSED = 6;
private static final int STATE_IDLE = 0;
private static final int STATE_OPEN_REQUEST_BODY = 1;
private static final int STATE_OPEN_RESPONSE_BODY = 4;
private static final int STATE_READING_RESPONSE_BODY = 5;
private static final int STATE_READ_RESPONSE_HEADERS = 3;
private static final int STATE_WRITING_REQUEST_BODY = 2;
private final OkHttpClient client;
private final RealConnection connection;
private final HeadersReader headersReader;
private final BufferedSink sink;
private final BufferedSource source;
private int state;
private Headers trailers;
public Http1ExchangeCodec(OkHttpClient client, RealConnection connection, BufferedSource source, BufferedSink sink) {
Intrinsics.checkNotNullParameter(connection, "connection");
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(sink, "sink");
this.client = client;
this.connection = connection;
this.source = source;
this.sink = sink;
this.headersReader = new HeadersReader(source);
}
@Override // okhttp3.internal.http.ExchangeCodec
public RealConnection getConnection() {
return this.connection;
}
private final boolean isChunked(Response $this$isChunked) {
return StringsKt.equals("chunked", Response.header$default($this$isChunked, HttpHeaders.TRANSFER_ENCODING, null, 2, null), true);
}
private final boolean isChunked(Request $this$isChunked) {
return StringsKt.equals("chunked", $this$isChunked.header(HttpHeaders.TRANSFER_ENCODING), true);
}
public final boolean isClosed() {
return this.state == 6;
}
@Override // okhttp3.internal.http.ExchangeCodec
public Sink createRequestBody(Request request, long contentLength) {
Intrinsics.checkNotNullParameter(request, "request");
if (request.body() != null && request.body().isDuplex()) {
throw new ProtocolException("Duplex connections are not supported for HTTP/1");
}
if (isChunked(request)) {
return newChunkedSink();
}
if (contentLength != -1) {
return newKnownLengthSink();
}
throw new IllegalStateException("Cannot stream a request body without chunked encoding or a known content length!");
}
@Override // okhttp3.internal.http.ExchangeCodec
public void cancel() {
getConnection().cancel();
}
@Override // okhttp3.internal.http.ExchangeCodec
public void writeRequestHeaders(Request request) {
Intrinsics.checkNotNullParameter(request, "request");
RequestLine requestLine = RequestLine.INSTANCE;
Proxy.Type type = getConnection().getRoute().proxy().type();
Intrinsics.checkNotNullExpressionValue(type, "connection.route().proxy.type()");
String requestLine2 = requestLine.get(request, type);
writeRequest(request.headers(), requestLine2);
}
@Override // okhttp3.internal.http.ExchangeCodec
public long reportedContentLength(Response response) {
Intrinsics.checkNotNullParameter(response, "response");
if (!okhttp3.internal.http.HttpHeaders.promisesBody(response)) {
return 0L;
}
if (isChunked(response)) {
return -1L;
}
return Util.headersContentLength(response);
}
@Override // okhttp3.internal.http.ExchangeCodec
public Source openResponseBodySource(Response response) {
Intrinsics.checkNotNullParameter(response, "response");
if (!okhttp3.internal.http.HttpHeaders.promisesBody(response)) {
return newFixedLengthSource(0L);
}
if (isChunked(response)) {
return newChunkedSource(response.request().url());
}
long contentLength = Util.headersContentLength(response);
if (contentLength != -1) {
return newFixedLengthSource(contentLength);
}
return newUnknownLengthSource();
}
@Override // okhttp3.internal.http.ExchangeCodec
public Headers trailers() {
if (!(this.state == 6)) {
throw new IllegalStateException("too early; can't read the trailers yet".toString());
}
Headers headers = this.trailers;
return headers != null ? headers : Util.EMPTY_HEADERS;
}
@Override // okhttp3.internal.http.ExchangeCodec
public void flushRequest() {
this.sink.flush();
}
@Override // okhttp3.internal.http.ExchangeCodec
public void finishRequest() {
this.sink.flush();
}
public final void writeRequest(Headers headers, String requestLine) {
Intrinsics.checkNotNullParameter(headers, "headers");
Intrinsics.checkNotNullParameter(requestLine, "requestLine");
if (!(this.state == 0)) {
throw new IllegalStateException(("state: " + this.state).toString());
}
this.sink.writeUtf8(requestLine).writeUtf8("\r\n");
int size = headers.size();
for (int i = 0; i < size; i++) {
this.sink.writeUtf8(headers.name(i)).writeUtf8(": ").writeUtf8(headers.value(i)).writeUtf8("\r\n");
}
this.sink.writeUtf8("\r\n");
this.state = 1;
}
@Override // okhttp3.internal.http.ExchangeCodec
public Response.Builder readResponseHeaders(boolean expectContinue) {
int i = this.state;
boolean z = true;
if (i != 1 && i != 3) {
z = false;
}
if (!z) {
throw new IllegalStateException(("state: " + this.state).toString());
}
try {
StatusLine statusLine = StatusLine.INSTANCE.parse(this.headersReader.readLine());
Response.Builder responseBuilder = new Response.Builder().protocol(statusLine.protocol).code(statusLine.code).message(statusLine.message).headers(this.headersReader.readHeaders());
if (expectContinue && statusLine.code == 100) {
return null;
}
if (statusLine.code == 100) {
this.state = 3;
} else {
this.state = 4;
}
return responseBuilder;
} catch (EOFException e) {
String address = getConnection().getRoute().address().url().redact();
throw new IOException("unexpected end of stream on " + address, e);
}
}
private final Sink newChunkedSink() {
if (!(this.state == 1)) {
throw new IllegalStateException(("state: " + this.state).toString());
}
this.state = 2;
return new ChunkedSink();
}
private final Sink newKnownLengthSink() {
if (!(this.state == 1)) {
throw new IllegalStateException(("state: " + this.state).toString());
}
this.state = 2;
return new KnownLengthSink();
}
private final Source newFixedLengthSource(long length) {
if (!(this.state == 4)) {
throw new IllegalStateException(("state: " + this.state).toString());
}
this.state = 5;
return new FixedLengthSource(length);
}
private final Source newChunkedSource(HttpUrl url) {
if (!(this.state == 4)) {
throw new IllegalStateException(("state: " + this.state).toString());
}
this.state = 5;
return new ChunkedSource(this, url);
}
private final Source newUnknownLengthSource() {
if (!(this.state == 4)) {
throw new IllegalStateException(("state: " + this.state).toString());
}
this.state = 5;
getConnection().noNewExchanges$okhttp();
return new UnknownLengthSource();
}
/* JADX INFO: Access modifiers changed from: private */
public final void detachTimeout(ForwardingTimeout timeout) {
Timeout oldDelegate = timeout.getDelegate();
timeout.setDelegate(Timeout.NONE);
oldDelegate.clearDeadline();
oldDelegate.clearTimeout();
}
public final void skipConnectBody(Response response) {
Intrinsics.checkNotNullParameter(response, "response");
long contentLength = Util.headersContentLength(response);
if (contentLength == -1) {
return;
}
Source body = newFixedLengthSource(contentLength);
Util.skipAll(body, Integer.MAX_VALUE, TimeUnit.MILLISECONDS);
body.close();
}
/* compiled from: Http1ExchangeCodec.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\b\u0082\u0004\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0007\u001a\u00020\bH\u0016J\b\u0010\t\u001a\u00020\bH\u0016J\b\u0010\u0005\u001a\u00020\nH\u0016J\u0018\u0010\u000b\u001a\u00020\b2\u0006\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u000fH\u0016R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0010"}, m238d2 = {"Lokhttp3/internal/http1/Http1ExchangeCodec$KnownLengthSink;", "Lokio/Sink;", "(Lokhttp3/internal/http1/Http1ExchangeCodec;)V", "closed", "", "timeout", "Lokio/ForwardingTimeout;", "close", "", "flush", "Lokio/Timeout;", "write", "source", "Lokio/Buffer;", "byteCount", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private final class KnownLengthSink implements Sink {
private boolean closed;
private final ForwardingTimeout timeout;
public KnownLengthSink() {
this.timeout = new ForwardingTimeout(Http1ExchangeCodec.this.sink.getTimeout());
}
@Override // okio.Sink
/* renamed from: timeout */
public Timeout getTimeout() {
return this.timeout;
}
@Override // okio.Sink
public void write(Buffer source, long byteCount) {
Intrinsics.checkNotNullParameter(source, "source");
if (!(!this.closed)) {
throw new IllegalStateException("closed".toString());
}
Util.checkOffsetAndCount(source.size(), 0L, byteCount);
Http1ExchangeCodec.this.sink.write(source, byteCount);
}
@Override // okio.Sink, java.io.Flushable
public void flush() {
if (this.closed) {
return;
}
Http1ExchangeCodec.this.sink.flush();
}
@Override // okio.Sink, java.io.Closeable, java.lang.AutoCloseable
public void close() {
if (this.closed) {
return;
}
this.closed = true;
Http1ExchangeCodec.this.detachTimeout(this.timeout);
Http1ExchangeCodec.this.state = 3;
}
}
/* compiled from: Http1ExchangeCodec.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\b\u0082\u0004\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u0007\u001a\u00020\bH\u0016J\b\u0010\t\u001a\u00020\bH\u0016J\b\u0010\u0005\u001a\u00020\nH\u0016J\u0018\u0010\u000b\u001a\u00020\b2\u0006\u0010\f\u001a\u00020\r2\u0006\u0010\u000e\u001a\u00020\u000fH\u0016R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0010"}, m238d2 = {"Lokhttp3/internal/http1/Http1ExchangeCodec$ChunkedSink;", "Lokio/Sink;", "(Lokhttp3/internal/http1/Http1ExchangeCodec;)V", "closed", "", "timeout", "Lokio/ForwardingTimeout;", "close", "", "flush", "Lokio/Timeout;", "write", "source", "Lokio/Buffer;", "byteCount", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private final class ChunkedSink implements Sink {
private boolean closed;
private final ForwardingTimeout timeout;
public ChunkedSink() {
this.timeout = new ForwardingTimeout(Http1ExchangeCodec.this.sink.getTimeout());
}
@Override // okio.Sink
/* renamed from: timeout */
public Timeout getTimeout() {
return this.timeout;
}
@Override // okio.Sink
public void write(Buffer source, long byteCount) {
Intrinsics.checkNotNullParameter(source, "source");
if (!(!this.closed)) {
throw new IllegalStateException("closed".toString());
}
if (byteCount == 0) {
return;
}
Http1ExchangeCodec.this.sink.writeHexadecimalUnsignedLong(byteCount);
Http1ExchangeCodec.this.sink.writeUtf8("\r\n");
Http1ExchangeCodec.this.sink.write(source, byteCount);
Http1ExchangeCodec.this.sink.writeUtf8("\r\n");
}
@Override // okio.Sink, java.io.Flushable
public synchronized void flush() {
if (this.closed) {
return;
}
Http1ExchangeCodec.this.sink.flush();
}
@Override // okio.Sink, java.io.Closeable, java.lang.AutoCloseable
public synchronized void close() {
if (this.closed) {
return;
}
this.closed = true;
Http1ExchangeCodec.this.sink.writeUtf8("0\r\n\r\n");
Http1ExchangeCodec.this.detachTimeout(this.timeout);
Http1ExchangeCodec.this.state = 3;
}
}
/* compiled from: Http1ExchangeCodec.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0000\\u0004\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0018\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u000eH\u0016J\u0006\u0010\u0012\u001a\u00020\u0013J\b\u0010\t\u001a\u00020\u0014H\u0016R\u001a\u0010\u0003\u001a\u00020\u0004X\u0084\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\bR\u0014\u0010\t\u001a\u00020\nX\u0084\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\\u0006\u0015"}, m238d2 = {"Lokhttp3/internal/http1/Http1ExchangeCodec$AbstractSource;", "Lokio/Source;", "(Lokhttp3/internal/http1/Http1ExchangeCodec;)V", "closed", "", "getClosed", "()Z", "setClosed", "(Z)V", "timeout", "Lokio/ForwardingTimeout;", "getTimeout", "()Lokio/ForwardingTimeout;", "read", "", "sink", "Lokio/Buffer;", "byteCount", "responseBodyComplete", "", "Lokio/Timeout;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private abstract class AbstractSource implements Source {
private boolean closed;
private final ForwardingTimeout timeout;
public AbstractSource() {
this.timeout = new ForwardingTimeout(Http1ExchangeCodec.this.source.getTimeout());
}
protected final ForwardingTimeout getTimeout() {
return this.timeout;
}
protected final boolean getClosed() {
return this.closed;
}
protected final void setClosed(boolean z) {
this.closed = z;
}
@Override // okio.Source
/* renamed from: timeout */
public Timeout getTimeout() {
return this.timeout;
}
@Override // okio.Source
public long read(Buffer sink, long byteCount) {
Intrinsics.checkNotNullParameter(sink, "sink");
try {
return Http1ExchangeCodec.this.source.read(sink, byteCount);
} catch (IOException e) {
Http1ExchangeCodec.this.getConnection().noNewExchanges$okhttp();
responseBodyComplete();
throw e;
}
}
public final void responseBodyComplete() {
if (Http1ExchangeCodec.this.state == 6) {
return;
}
if (Http1ExchangeCodec.this.state == 5) {
Http1ExchangeCodec.this.detachTimeout(this.timeout);
Http1ExchangeCodec.this.state = 6;
} else {
throw new IllegalStateException("state: " + Http1ExchangeCodec.this.state);
}
}
}
/* compiled from: Http1ExchangeCodec.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0082\u0004\u0018\u00002\u00060\u0001R\u00020\u0002B\r\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005J\b\u0010\u0006\u001a\u00020\u0007H\u0016J\u0018\u0010\b\u001a\u00020\u00042\u0006\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\u0004H\u0016R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\f"}, m238d2 = {"Lokhttp3/internal/http1/Http1ExchangeCodec$FixedLengthSource;", "Lokhttp3/internal/http1/Http1ExchangeCodec$AbstractSource;", "Lokhttp3/internal/http1/Http1ExchangeCodec;", "bytesRemaining", "", "(Lokhttp3/internal/http1/Http1ExchangeCodec;J)V", "close", "", "read", "sink", "Lokio/Buffer;", "byteCount", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private final class FixedLengthSource extends AbstractSource {
private long bytesRemaining;
public FixedLengthSource(long bytesRemaining) {
super();
this.bytesRemaining = bytesRemaining;
if (bytesRemaining == 0) {
responseBodyComplete();
}
}
@Override // okhttp3.internal.http1.Http1ExchangeCodec.AbstractSource, okio.Source
public long read(Buffer sink, long byteCount) {
Intrinsics.checkNotNullParameter(sink, "sink");
if (!(byteCount >= 0)) {
throw new IllegalArgumentException(("byteCount < 0: " + byteCount).toString());
}
if (!(!getClosed())) {
throw new IllegalStateException("closed".toString());
}
long j = this.bytesRemaining;
if (j == 0) {
return -1L;
}
long read = super.read(sink, Math.min(j, byteCount));
if (read == -1) {
Http1ExchangeCodec.this.getConnection().noNewExchanges$okhttp();
ProtocolException e = new ProtocolException("unexpected end of stream");
responseBodyComplete();
throw e;
}
long j2 = this.bytesRemaining - read;
this.bytesRemaining = j2;
if (j2 == 0) {
responseBodyComplete();
}
return read;
}
@Override // okio.Source, java.io.Closeable, java.lang.AutoCloseable
public void close() {
if (getClosed()) {
return;
}
if (this.bytesRemaining != 0 && !Util.discard(this, 100, TimeUnit.MILLISECONDS)) {
Http1ExchangeCodec.this.getConnection().noNewExchanges$okhttp();
responseBodyComplete();
}
setClosed(true);
}
}
/* compiled from: Http1ExchangeCodec.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0082\u0004\u0018\u00002\u00060\u0001R\u00020\u0002B\r\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005J\b\u0010\n\u001a\u00020\u000bH\u0016J\u0018\u0010\f\u001a\u00020\u00072\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u0007H\u0016J\b\u0010\u0010\u001a\u00020\u000bH\u0002R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0011"}, m238d2 = {"Lokhttp3/internal/http1/Http1ExchangeCodec$ChunkedSource;", "Lokhttp3/internal/http1/Http1ExchangeCodec$AbstractSource;", "Lokhttp3/internal/http1/Http1ExchangeCodec;", ImagesContract.URL, "Lokhttp3/HttpUrl;", "(Lokhttp3/internal/http1/Http1ExchangeCodec;Lokhttp3/HttpUrl;)V", "bytesRemainingInChunk", "", "hasMoreChunks", "", "close", "", "read", "sink", "Lokio/Buffer;", "byteCount", "readChunkSize", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private final class ChunkedSource extends AbstractSource {
private long bytesRemainingInChunk;
private boolean hasMoreChunks;
final /* synthetic */ Http1ExchangeCodec this$0;
private final HttpUrl url;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public ChunkedSource(Http1ExchangeCodec this$0, HttpUrl url) {
super();
Intrinsics.checkNotNullParameter(url, "url");
this.this$0 = this$0;
this.url = url;
this.bytesRemainingInChunk = -1L;
this.hasMoreChunks = true;
}
@Override // okhttp3.internal.http1.Http1ExchangeCodec.AbstractSource, okio.Source
public long read(Buffer sink, long byteCount) {
Intrinsics.checkNotNullParameter(sink, "sink");
if (!(byteCount >= 0)) {
throw new IllegalArgumentException(("byteCount < 0: " + byteCount).toString());
}
if (!(!getClosed())) {
throw new IllegalStateException("closed".toString());
}
if (!this.hasMoreChunks) {
return -1L;
}
long j = this.bytesRemainingInChunk;
if (j == 0 || j == -1) {
readChunkSize();
if (!this.hasMoreChunks) {
return -1L;
}
}
long read = super.read(sink, Math.min(byteCount, this.bytesRemainingInChunk));
if (read == -1) {
this.this$0.getConnection().noNewExchanges$okhttp();
ProtocolException e = new ProtocolException("unexpected end of stream");
responseBodyComplete();
throw e;
}
this.bytesRemainingInChunk -= read;
return read;
}
private final void readChunkSize() {
if (this.bytesRemainingInChunk != -1) {
this.this$0.source.readUtf8LineStrict();
}
try {
this.bytesRemainingInChunk = this.this$0.source.readHexadecimalUnsignedLong();
String readUtf8LineStrict = this.this$0.source.readUtf8LineStrict();
if (readUtf8LineStrict == null) {
throw new NullPointerException("null cannot be cast to non-null type kotlin.CharSequence");
}
String extensions = StringsKt.trim((CharSequence) readUtf8LineStrict).toString();
if (this.bytesRemainingInChunk >= 0) {
if (!(extensions.length() > 0) || StringsKt.startsWith$default(extensions, ";", false, 2, (Object) null)) {
if (this.bytesRemainingInChunk == 0) {
this.hasMoreChunks = false;
Http1ExchangeCodec http1ExchangeCodec = this.this$0;
http1ExchangeCodec.trailers = http1ExchangeCodec.headersReader.readHeaders();
OkHttpClient okHttpClient = this.this$0.client;
Intrinsics.checkNotNull(okHttpClient);
CookieJar cookieJar = okHttpClient.cookieJar();
HttpUrl httpUrl = this.url;
Headers headers = this.this$0.trailers;
Intrinsics.checkNotNull(headers);
okhttp3.internal.http.HttpHeaders.receiveHeaders(cookieJar, httpUrl, headers);
responseBodyComplete();
return;
}
return;
}
}
throw new ProtocolException("expected chunk size and optional extensions but was \"" + this.bytesRemainingInChunk + extensions + Typography.quote);
} catch (NumberFormatException e) {
throw new ProtocolException(e.getMessage());
}
}
@Override // okio.Source, java.io.Closeable, java.lang.AutoCloseable
public void close() {
if (getClosed()) {
return;
}
if (this.hasMoreChunks && !Util.discard(this, 100, TimeUnit.MILLISECONDS)) {
this.this$0.getConnection().noNewExchanges$okhttp();
responseBodyComplete();
}
setClosed(true);
}
}
/* compiled from: Http1ExchangeCodec.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0082\u0004\u0018\u00002\u00060\u0001R\u00020\u0002B\u0005¢\u0006\u0002\u0010\u0003J\b\u0010\u0006\u001a\u00020\u0007H\u0016J\u0018\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\tH\u0016R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\r"}, m238d2 = {"Lokhttp3/internal/http1/Http1ExchangeCodec$UnknownLengthSource;", "Lokhttp3/internal/http1/Http1ExchangeCodec$AbstractSource;", "Lokhttp3/internal/http1/Http1ExchangeCodec;", "(Lokhttp3/internal/http1/Http1ExchangeCodec;)V", "inputExhausted", "", "close", "", "read", "", "sink", "Lokio/Buffer;", "byteCount", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private final class UnknownLengthSource extends AbstractSource {
private boolean inputExhausted;
public UnknownLengthSource() {
super();
}
@Override // okhttp3.internal.http1.Http1ExchangeCodec.AbstractSource, okio.Source
public long read(Buffer sink, long byteCount) {
Intrinsics.checkNotNullParameter(sink, "sink");
if (!(byteCount >= 0)) {
throw new IllegalArgumentException(("byteCount < 0: " + byteCount).toString());
}
if (!(!getClosed())) {
throw new IllegalStateException("closed".toString());
}
if (this.inputExhausted) {
return -1L;
}
long read = super.read(sink, byteCount);
if (read == -1) {
this.inputExhausted = true;
responseBodyComplete();
return -1L;
}
return read;
}
@Override // okio.Source, java.io.Closeable, java.lang.AutoCloseable
public void close() {
if (getClosed()) {
return;
}
if (!this.inputExhausted) {
responseBodyComplete();
}
setClosed(true);
}
}
}
@@ -0,0 +1,10 @@
package okhttp3.internal.http2;
import java.io.IOException;
import kotlin.Metadata;
/* compiled from: ConnectionShutdownException.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002¨\u0006\u0003"}, m238d2 = {"Lokhttp3/internal/http2/ConnectionShutdownException;", "Ljava/io/IOException;", "()V", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class ConnectionShutdownException extends IOException {
}
@@ -0,0 +1,57 @@
package okhttp3.internal.http2;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
/* compiled from: ErrorCode.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0000\n\u0002\u0010\b\n\u0002\b\u0013\b\u0086\u0001\u0018\u0000 \u00152\b\u0012\u0004\u0012\u00020\u00000\u0001:\u0001\u0015B\u000f\b\u0002\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006j\u0002\b\u0007j\u0002\b\bj\u0002\b\tj\u0002\b\nj\u0002\b\u000bj\u0002\b\fj\u0002\b\rj\u0002\b\u000ej\u0002\b\u000fj\u0002\b\u0010j\u0002\b\u0011j\u0002\b\u0012j\u0002\b\u0013j\u0002\b\u0014¨\u0006\u0016"}, m238d2 = {"Lokhttp3/internal/http2/ErrorCode;", "", "httpCode", "", "(Ljava/lang/String;II)V", "getHttpCode", "()I", "NO_ERROR", "PROTOCOL_ERROR", "INTERNAL_ERROR", "FLOW_CONTROL_ERROR", "SETTINGS_TIMEOUT", "STREAM_CLOSED", "FRAME_SIZE_ERROR", "REFUSED_STREAM", "CANCEL", "COMPRESSION_ERROR", "CONNECT_ERROR", "ENHANCE_YOUR_CALM", "INADEQUATE_SECURITY", "HTTP_1_1_REQUIRED", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public enum ErrorCode {
NO_ERROR(0),
PROTOCOL_ERROR(1),
INTERNAL_ERROR(2),
FLOW_CONTROL_ERROR(3),
SETTINGS_TIMEOUT(4),
STREAM_CLOSED(5),
FRAME_SIZE_ERROR(6),
REFUSED_STREAM(7),
CANCEL(8),
COMPRESSION_ERROR(9),
CONNECT_ERROR(10),
ENHANCE_YOUR_CALM(11),
INADEQUATE_SECURITY(12),
HTTP_1_1_REQUIRED(13);
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private final int httpCode;
ErrorCode(int httpCode) {
this.httpCode = httpCode;
}
public final int getHttpCode() {
return this.httpCode;
}
/* compiled from: ErrorCode.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u0004\u0018\u00010\u00042\u0006\u0010\u0005\u001a\u00020\u0006¨\u0006\u0007"}, m238d2 = {"Lokhttp3/internal/http2/ErrorCode$Companion;", "", "()V", "fromHttp2", "Lokhttp3/internal/http2/ErrorCode;", "code", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public final ErrorCode fromHttp2(int code) {
for (ErrorCode it : ErrorCode.values()) {
if (it.getHttpCode() == code) {
return it;
}
}
return null;
}
}
}
@@ -0,0 +1,95 @@
package okhttp3.internal.http2;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okio.ByteString;
/* compiled from: Header.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0005\b\u0086\b\u0018\u0000 \u00132\u00020\u0001:\u0001\u0013B\u0017\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003¢\u0006\u0002\u0010\u0005B\u0017\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0006\u0012\u0006\u0010\u0004\u001a\u00020\u0003¢\u0006\u0002\u0010\u0007B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0006\u0012\u0006\u0010\u0004\u001a\u00020\u0006¢\u0006\u0002\u0010\bJ\t\u0010\u000b\u001a\u00020\u0006HÆ\u0003J\t\u0010\f\u001a\u00020\u0006HÆ\u0003J\u001d\u0010\r\u001a\u00020\u00002\b\b\u0002\u0010\u0002\u001a\u00020\u00062\b\b\u0002\u0010\u0004\u001a\u00020\u0006HÆ\u0001J\u0013\u0010\u000e\u001a\u00020\u000f2\b\u0010\u0010\u001a\u0004\u0018\u00010\u0001HÖ\u0003J\t\u0010\u0011\u001a\u00020\nHÖ\u0001J\b\u0010\u0012\u001a\u00020\u0003H\u0016R\u0010\u0010\t\u001a\u00020\n8\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0002\u001a\u00020\u00068\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0004\u001a\u00020\u00068\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006\u0014"}, m238d2 = {"Lokhttp3/internal/http2/Header;", "", "name", "", "value", "(Ljava/lang/String;Ljava/lang/String;)V", "Lokio/ByteString;", "(Lokio/ByteString;Ljava/lang/String;)V", "(Lokio/ByteString;Lokio/ByteString;)V", "hpackSize", "", "component1", "component2", "copy", "equals", "", "other", "hashCode", "toString", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final /* data */ class Header {
public final int hpackSize;
public final ByteString name;
public final ByteString value;
public static final ByteString PSEUDO_PREFIX = ByteString.INSTANCE.encodeUtf8(":");
public static final String RESPONSE_STATUS_UTF8 = ":status";
public static final ByteString RESPONSE_STATUS = ByteString.INSTANCE.encodeUtf8(RESPONSE_STATUS_UTF8);
public static final String TARGET_METHOD_UTF8 = ":method";
public static final ByteString TARGET_METHOD = ByteString.INSTANCE.encodeUtf8(TARGET_METHOD_UTF8);
public static final String TARGET_PATH_UTF8 = ":path";
public static final ByteString TARGET_PATH = ByteString.INSTANCE.encodeUtf8(TARGET_PATH_UTF8);
public static final String TARGET_SCHEME_UTF8 = ":scheme";
public static final ByteString TARGET_SCHEME = ByteString.INSTANCE.encodeUtf8(TARGET_SCHEME_UTF8);
public static final String TARGET_AUTHORITY_UTF8 = ":authority";
public static final ByteString TARGET_AUTHORITY = ByteString.INSTANCE.encodeUtf8(TARGET_AUTHORITY_UTF8);
public static /* synthetic */ Header copy$default(Header header, ByteString byteString, ByteString byteString2, int i, Object obj) {
if ((i & 1) != 0) {
byteString = header.name;
}
if ((i & 2) != 0) {
byteString2 = header.value;
}
return header.copy(byteString, byteString2);
}
/* renamed from: component1, reason: from getter */
public final ByteString getName() {
return this.name;
}
/* renamed from: component2, reason: from getter */
public final ByteString getValue() {
return this.value;
}
public final Header copy(ByteString name, ByteString value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
return new Header(name, value);
}
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof Header)) {
return false;
}
Header header = (Header) other;
return Intrinsics.areEqual(this.name, header.name) && Intrinsics.areEqual(this.value, header.value);
}
public int hashCode() {
ByteString byteString = this.name;
int hashCode = (byteString != null ? byteString.hashCode() : 0) * 31;
ByteString byteString2 = this.value;
return hashCode + (byteString2 != null ? byteString2.hashCode() : 0);
}
public Header(ByteString name, ByteString value) {
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
this.name = name;
this.value = value;
this.hpackSize = name.size() + 32 + value.size();
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public Header(String name, String value) {
this(ByteString.INSTANCE.encodeUtf8(name), ByteString.INSTANCE.encodeUtf8(value));
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
public Header(ByteString name, String value) {
this(name, ByteString.INSTANCE.encodeUtf8(value));
Intrinsics.checkNotNullParameter(name, "name");
Intrinsics.checkNotNullParameter(value, "value");
}
public String toString() {
return this.name.utf8() + ": " + this.value.utf8();
}
}
@@ -0,0 +1,564 @@
package okhttp3.internal.http2;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.Metadata;
import kotlin.collections.ArraysKt;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.internal.Util;
import okio.Buffer;
import okio.BufferedSource;
import okio.ByteString;
import okio.Okio;
import okio.Source;
/* compiled from: Hpack.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010$\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0002\b\t\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0002\b\t\\u0002\u0018\u00002\u00020\u0001:\u0002\u0018\u0019B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u000e\u0010\u0015\u001a\u00020\u00052\u0006\u0010\u0016\u001a\u00020\u0005J\u0014\u0010\u0017\u001a\u000e\u0012\u0004\u0012\u00020\u0005\u0012\u0004\u0012\u00020\u00060\u0004H\u0002R\u001d\u0010\u0003\u001a\u000e\u0012\u0004\u0012\u00020\u0005\u0012\u0004\u0012\u00020\u00060\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\bR\u000e\u0010\t\u001a\u00020\u0006X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u0006X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\u0006X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u0006X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u0006X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u0006X\u0082T¢\u0006\u0002\n\u0000R\u0019\u0010\u000f\u001a\b\u0012\u0004\u0012\u00020\u00110\u0010¢\u0006\n\n\u0002\u0010\u0014\u001a\u0004\b\u0012\u0010\u0013¨\u0006\u001a"}, m238d2 = {"Lokhttp3/internal/http2/Hpack;", "", "()V", "NAME_TO_FIRST_INDEX", "", "Lokio/ByteString;", "", "getNAME_TO_FIRST_INDEX", "()Ljava/util/Map;", "PREFIX_4_BITS", "PREFIX_5_BITS", "PREFIX_6_BITS", "PREFIX_7_BITS", "SETTINGS_HEADER_TABLE_SIZE", "SETTINGS_HEADER_TABLE_SIZE_LIMIT", "STATIC_HEADER_TABLE", "", "Lokhttp3/internal/http2/Header;", "getSTATIC_HEADER_TABLE", "()[Lokhttp3/internal/http2/Header;", "[Lokhttp3/internal/http2/Header;", "checkLowercase", "name", "nameToFirstIndex", "Reader", "Writer", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Hpack {
public static final Hpack INSTANCE;
private static final Map<ByteString, Integer> NAME_TO_FIRST_INDEX;
private static final int PREFIX_4_BITS = 15;
private static final int PREFIX_5_BITS = 31;
private static final int PREFIX_6_BITS = 63;
private static final int PREFIX_7_BITS = 127;
private static final int SETTINGS_HEADER_TABLE_SIZE = 4096;
private static final int SETTINGS_HEADER_TABLE_SIZE_LIMIT = 16384;
private static final Header[] STATIC_HEADER_TABLE;
static {
Hpack hpack = new Hpack();
INSTANCE = hpack;
STATIC_HEADER_TABLE = new Header[]{new Header(Header.TARGET_AUTHORITY, ""), new Header(Header.TARGET_METHOD, "GET"), new Header(Header.TARGET_METHOD, "POST"), new Header(Header.TARGET_PATH, "/"), new Header(Header.TARGET_PATH, "/index.html"), new Header(Header.TARGET_SCHEME, "http"), new Header(Header.TARGET_SCHEME, "https"), new Header(Header.RESPONSE_STATUS, "200"), new Header(Header.RESPONSE_STATUS, "204"), new Header(Header.RESPONSE_STATUS, "206"), new Header(Header.RESPONSE_STATUS, "304"), new Header(Header.RESPONSE_STATUS, "400"), new Header(Header.RESPONSE_STATUS, "404"), new Header(Header.RESPONSE_STATUS, "500"), new Header("accept-charset", ""), new Header("accept-encoding", "gzip, deflate"), new Header("accept-language", ""), new Header("accept-ranges", ""), new Header("accept", ""), new Header("access-control-allow-origin", ""), new Header("age", ""), new Header("allow", ""), new Header("authorization", ""), new Header("cache-control", ""), new Header("content-disposition", ""), new Header("content-encoding", ""), new Header("content-language", ""), new Header("content-length", ""), new Header("content-location", ""), new Header("content-range", ""), new Header("content-type", ""), new Header("cookie", ""), new Header("date", ""), new Header("etag", ""), new Header("expect", ""), new Header("expires", ""), new Header(TypedValues.Transition.S_FROM, ""), new Header("host", ""), new Header("if-match", ""), new Header("if-modified-since", ""), new Header("if-none-match", ""), new Header("if-range", ""), new Header("if-unmodified-since", ""), new Header("last-modified", ""), new Header("link", ""), new Header("location", ""), new Header("max-forwards", ""), new Header("proxy-authenticate", ""), new Header("proxy-authorization", ""), new Header("range", ""), new Header("referer", ""), new Header("refresh", ""), new Header("retry-after", ""), new Header("server", ""), new Header("set-cookie", ""), new Header("strict-transport-security", ""), new Header("transfer-encoding", ""), new Header("user-agent", ""), new Header("vary", ""), new Header("via", ""), new Header("www-authenticate", "")};
NAME_TO_FIRST_INDEX = hpack.nameToFirstIndex();
}
private Hpack() {
}
public final Header[] getSTATIC_HEADER_TABLE() {
return STATIC_HEADER_TABLE;
}
public final Map<ByteString, Integer> getNAME_TO_FIRST_INDEX() {
return NAME_TO_FIRST_INDEX;
}
/* compiled from: Hpack.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000N\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010!\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0006\n\u0002\u0010 \n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\r\u0018\u00002\u00020\u0001B!\b\u0007\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\b\b\u0002\u0010\u0006\u001a\u00020\u0005¢\u0006\u0002\u0010\u0007J\b\u0010\u0012\u001a\u00020\u0013H\u0002J\b\u0010\u0014\u001a\u00020\u0013H\u0002J\u0010\u0010\u0015\u001a\u00020\u00052\u0006\u0010\u0016\u001a\u00020\u0005H\u0002J\u0010\u0010\u0017\u001a\u00020\u00052\u0006\u0010\u0018\u001a\u00020\u0005H\u0002J\f\u0010\u0019\u001a\b\u0012\u0004\u0012\u00020\n0\u001aJ\u0010\u0010\u001b\u001a\u00020\u001c2\u0006\u0010\u0016\u001a\u00020\u0005H\u0002J\u0018\u0010\u001d\u001a\u00020\u00132\u0006\u0010\u0016\u001a\u00020\u00052\u0006\u0010\u001e\u001a\u00020\nH\u0002J\u0010\u0010\u001f\u001a\u00020 2\u0006\u0010\u0016\u001a\u00020\u0005H\u0002J\u0006\u0010\u0006\u001a\u00020\u0005J\b\u0010!\u001a\u00020\u0005H\u0002J\u0006\u0010\"\u001a\u00020\u001cJ\u0006\u0010#\u001a\u00020\u0013J\u0010\u0010$\u001a\u00020\u00132\u0006\u0010\u0016\u001a\u00020\u0005H\u0002J\u0016\u0010%\u001a\u00020\u00052\u0006\u0010&\u001a\u00020\u00052\u0006\u0010'\u001a\u00020\u0005J\u0010\u0010(\u001a\u00020\u00132\u0006\u0010)\u001a\u00020\u0005H\u0002J\b\u0010*\u001a\u00020\u0013H\u0002J\u0010\u0010+\u001a\u00020\u00132\u0006\u0010\u0016\u001a\u00020\u0005H\u0002J\b\u0010,\u001a\u00020\u0013H\u0002R\u001c\u0010\b\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\n0\t8\u0006@\u0006X\u0087\u000e¢\u0006\u0004\n\u0002\u0010\u000bR\u0012\u0010\f\u001a\u00020\u00058\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\r\u001a\u00020\u00058\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u000e\u001a\b\u0012\u0004\u0012\u00020\n0\u000fX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0011X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006-"}, m238d2 = {"Lokhttp3/internal/http2/Hpack$Reader;", "", "source", "Lokio/Source;", "headerTableSizeSetting", "", "maxDynamicTableByteCount", "(Lokio/Source;II)V", "dynamicTable", "", "Lokhttp3/internal/http2/Header;", "[Lokhttp3/internal/http2/Header;", "dynamicTableByteCount", "headerCount", "headerList", "", "nextHeaderIndex", "Lokio/BufferedSource;", "adjustDynamicTableByteCount", "", "clearDynamicTable", "dynamicTableIndex", "index", "evictToRecoverBytes", "bytesToRecover", "getAndResetHeaderList", "", "getName", "Lokio/ByteString;", "insertIntoDynamicTable", "entry", "isStaticHeader", "", "readByte", "readByteString", "readHeaders", "readIndexedHeader", "readInt", "firstByte", "prefixMask", "readLiteralHeaderWithIncrementalIndexingIndexedName", "nameIndex", "readLiteralHeaderWithIncrementalIndexingNewName", "readLiteralHeaderWithoutIndexingIndexedName", "readLiteralHeaderWithoutIndexingNewName", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Reader {
public Header[] dynamicTable;
public int dynamicTableByteCount;
public int headerCount;
private final List<Header> headerList;
private final int headerTableSizeSetting;
private int maxDynamicTableByteCount;
private int nextHeaderIndex;
private final BufferedSource source;
public Reader(Source source, int i) {
this(source, i, 0, 4, null);
}
public Reader(Source source, int headerTableSizeSetting, int maxDynamicTableByteCount) {
Intrinsics.checkNotNullParameter(source, "source");
this.headerTableSizeSetting = headerTableSizeSetting;
this.maxDynamicTableByteCount = maxDynamicTableByteCount;
this.headerList = new ArrayList();
this.source = Okio.buffer(source);
this.dynamicTable = new Header[8];
this.nextHeaderIndex = r0.length - 1;
}
public /* synthetic */ Reader(Source source, int i, int i2, int i3, DefaultConstructorMarker defaultConstructorMarker) {
this(source, i, (i3 & 4) != 0 ? i : i2);
}
public final List<Header> getAndResetHeaderList() {
List result = CollectionsKt.toList(this.headerList);
this.headerList.clear();
return result;
}
/* renamed from: maxDynamicTableByteCount, reason: from getter */
public final int getMaxDynamicTableByteCount() {
return this.maxDynamicTableByteCount;
}
private final void adjustDynamicTableByteCount() {
int i = this.maxDynamicTableByteCount;
int i2 = this.dynamicTableByteCount;
if (i < i2) {
if (i == 0) {
clearDynamicTable();
} else {
evictToRecoverBytes(i2 - i);
}
}
}
private final void clearDynamicTable() {
ArraysKt.fill$default(this.dynamicTable, (Object) null, 0, 0, 6, (Object) null);
this.nextHeaderIndex = this.dynamicTable.length - 1;
this.headerCount = 0;
this.dynamicTableByteCount = 0;
}
private final int evictToRecoverBytes(int bytesToRecover) {
int i;
int bytesToRecover2 = bytesToRecover;
int entriesToEvict = 0;
if (bytesToRecover2 > 0) {
int j = this.dynamicTable.length;
while (true) {
j--;
i = this.nextHeaderIndex;
if (j < i || bytesToRecover2 <= 0) {
break;
}
Header toEvict = this.dynamicTable[j];
Intrinsics.checkNotNull(toEvict);
bytesToRecover2 -= toEvict.hpackSize;
this.dynamicTableByteCount -= toEvict.hpackSize;
this.headerCount--;
entriesToEvict++;
}
Header[] headerArr = this.dynamicTable;
System.arraycopy(headerArr, i + 1, headerArr, i + 1 + entriesToEvict, this.headerCount);
this.nextHeaderIndex += entriesToEvict;
}
return entriesToEvict;
}
public final void readHeaders() throws IOException {
while (!this.source.exhausted()) {
int b = Util.and(this.source.readByte(), 255);
if (b != 128) {
if ((b & 128) == 128) {
int index = readInt(b, 127);
readIndexedHeader(index - 1);
} else if (b != 64) {
if ((b & 64) == 64) {
int index2 = readInt(b, 63);
readLiteralHeaderWithIncrementalIndexingIndexedName(index2 - 1);
} else if ((b & 32) == 32) {
int readInt = readInt(b, 31);
this.maxDynamicTableByteCount = readInt;
if (readInt < 0 || readInt > this.headerTableSizeSetting) {
throw new IOException("Invalid dynamic table size update " + this.maxDynamicTableByteCount);
}
adjustDynamicTableByteCount();
} else if (b == 16 || b == 0) {
readLiteralHeaderWithoutIndexingNewName();
} else {
int index3 = readInt(b, 15);
readLiteralHeaderWithoutIndexingIndexedName(index3 - 1);
}
} else {
readLiteralHeaderWithIncrementalIndexingNewName();
}
} else {
throw new IOException("index == 0");
}
}
}
private final void readIndexedHeader(int index) throws IOException {
if (isStaticHeader(index)) {
Header staticEntry = Hpack.INSTANCE.getSTATIC_HEADER_TABLE()[index];
this.headerList.add(staticEntry);
return;
}
int dynamicTableIndex = dynamicTableIndex(index - Hpack.INSTANCE.getSTATIC_HEADER_TABLE().length);
if (dynamicTableIndex >= 0) {
Header[] headerArr = this.dynamicTable;
if (dynamicTableIndex < headerArr.length) {
List<Header> list = this.headerList;
Header header = headerArr[dynamicTableIndex];
Intrinsics.checkNotNull(header);
list.add(header);
return;
}
}
throw new IOException("Header index too large " + (index + 1));
}
private final int dynamicTableIndex(int index) {
return this.nextHeaderIndex + 1 + index;
}
private final void readLiteralHeaderWithoutIndexingIndexedName(int index) throws IOException {
ByteString name = getName(index);
ByteString value = readByteString();
this.headerList.add(new Header(name, value));
}
private final void readLiteralHeaderWithoutIndexingNewName() throws IOException {
ByteString name = Hpack.INSTANCE.checkLowercase(readByteString());
ByteString value = readByteString();
this.headerList.add(new Header(name, value));
}
private final void readLiteralHeaderWithIncrementalIndexingIndexedName(int nameIndex) throws IOException {
ByteString name = getName(nameIndex);
ByteString value = readByteString();
insertIntoDynamicTable(-1, new Header(name, value));
}
private final void readLiteralHeaderWithIncrementalIndexingNewName() throws IOException {
ByteString name = Hpack.INSTANCE.checkLowercase(readByteString());
ByteString value = readByteString();
insertIntoDynamicTable(-1, new Header(name, value));
}
private final ByteString getName(int index) throws IOException {
if (isStaticHeader(index)) {
return Hpack.INSTANCE.getSTATIC_HEADER_TABLE()[index].name;
}
int dynamicTableIndex = dynamicTableIndex(index - Hpack.INSTANCE.getSTATIC_HEADER_TABLE().length);
if (dynamicTableIndex >= 0) {
Header[] headerArr = this.dynamicTable;
if (dynamicTableIndex < headerArr.length) {
Header header = headerArr[dynamicTableIndex];
Intrinsics.checkNotNull(header);
return header.name;
}
}
throw new IOException("Header index too large " + (index + 1));
}
private final boolean isStaticHeader(int index) {
return index >= 0 && index <= Hpack.INSTANCE.getSTATIC_HEADER_TABLE().length - 1;
}
private final void insertIntoDynamicTable(int index, Header entry) {
this.headerList.add(entry);
int delta = entry.hpackSize;
if (index != -1) {
Header header = this.dynamicTable[dynamicTableIndex(index)];
Intrinsics.checkNotNull(header);
delta -= header.hpackSize;
}
int i = this.maxDynamicTableByteCount;
if (delta > i) {
clearDynamicTable();
return;
}
int bytesToRecover = (this.dynamicTableByteCount + delta) - i;
int entriesEvicted = evictToRecoverBytes(bytesToRecover);
if (index != -1) {
this.dynamicTable[index + dynamicTableIndex(index) + entriesEvicted] = entry;
} else {
int i2 = this.headerCount + 1;
Header[] headerArr = this.dynamicTable;
if (i2 > headerArr.length) {
Header[] doubled = new Header[headerArr.length * 2];
System.arraycopy(headerArr, 0, doubled, headerArr.length, headerArr.length);
this.nextHeaderIndex = this.dynamicTable.length - 1;
this.dynamicTable = doubled;
}
int index2 = this.nextHeaderIndex;
this.nextHeaderIndex = index2 - 1;
this.dynamicTable[index2] = entry;
this.headerCount++;
}
this.dynamicTableByteCount += delta;
}
private final int readByte() throws IOException {
return Util.and(this.source.readByte(), 255);
}
public final int readInt(int firstByte, int prefixMask) throws IOException {
int prefix = firstByte & prefixMask;
if (prefix < prefixMask) {
return prefix;
}
int result = prefixMask;
int shift = 0;
while (true) {
int b = readByte();
if ((b & 128) != 0) {
result += (b & 127) << shift;
shift += 7;
} else {
return result + (b << shift);
}
}
}
public final ByteString readByteString() throws IOException {
int firstByte = readByte();
boolean huffmanDecode = (firstByte & 128) == 128;
long length = readInt(firstByte, 127);
if (huffmanDecode) {
Buffer decodeBuffer = new Buffer();
Huffman.INSTANCE.decode(this.source, length, decodeBuffer);
return decodeBuffer.readByteString();
}
return this.source.readByteString(length);
}
}
private final Map<ByteString, Integer> nameToFirstIndex() {
Header[] headerArr = STATIC_HEADER_TABLE;
LinkedHashMap result = new LinkedHashMap(headerArr.length);
int length = headerArr.length;
for (int i = 0; i < length; i++) {
Header[] headerArr2 = STATIC_HEADER_TABLE;
if (!result.containsKey(headerArr2[i].name)) {
result.put(headerArr2[i].name, Integer.valueOf(i));
}
}
Map<ByteString, Integer> unmodifiableMap = Collections.unmodifiableMap(result);
Intrinsics.checkNotNullExpressionValue(unmodifiableMap, "Collections.unmodifiableMap(result)");
return unmodifiableMap;
}
/* compiled from: Hpack.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000B\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0010\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\b\u0005\u0018\u00002\u00020\u0001B#\b\u0007\u0012\b\b\u0002\u0010\u0002\u001a\u00020\u0003\u0012\b\b\u0002\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007¢\u0006\u0002\u0010\bJ\b\u0010\u0013\u001a\u00020\u0014H\u0002J\b\u0010\u0015\u001a\u00020\u0014H\u0002J\u0010\u0010\u0016\u001a\u00020\u00032\u0006\u0010\u0017\u001a\u00020\u0003H\u0002J\u0010\u0010\u0018\u001a\u00020\u00142\u0006\u0010\u0019\u001a\u00020\u000bH\u0002J\u000e\u0010\u001a\u001a\u00020\u00142\u0006\u0010\u0002\u001a\u00020\u0003J\u000e\u0010\u001b\u001a\u00020\u00142\u0006\u0010\u001c\u001a\u00020\u001dJ\u0014\u0010\u001e\u001a\u00020\u00142\f\u0010\u001f\u001a\b\u0012\u0004\u0012\u00020\u000b0 J\u001e\u0010!\u001a\u00020\u00142\u0006\u0010\"\u001a\u00020\u00032\u0006\u0010#\u001a\u00020\u00032\u0006\u0010$\u001a\u00020\u0003R\u001c\u0010\t\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u000b0\n8\u0006@\u0006X\u0087\u000e¢\u0006\u0004\n\u0002\u0010\fR\u0012\u0010\r\u001a\u00020\u00038\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\u000f\u001a\u00020\u00038\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\u0002\u001a\u00020\u00038\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\u0010\u001a\u00020\u00038\u0006@\u0006X\u0087\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0003X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0012\u001a\u00020\u0003X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006%"}, m238d2 = {"Lokhttp3/internal/http2/Hpack$Writer;", "", "headerTableSizeSetting", "", "useCompression", "", "out", "Lokio/Buffer;", "(IZLokio/Buffer;)V", "dynamicTable", "", "Lokhttp3/internal/http2/Header;", "[Lokhttp3/internal/http2/Header;", "dynamicTableByteCount", "emitDynamicTableSizeUpdate", "headerCount", "maxDynamicTableByteCount", "nextHeaderIndex", "smallestHeaderTableSizeSetting", "adjustDynamicTableByteCount", "", "clearDynamicTable", "evictToRecoverBytes", "bytesToRecover", "insertIntoDynamicTable", "entry", "resizeHeaderTable", "writeByteString", "data", "Lokio/ByteString;", "writeHeaders", "headerBlock", "", "writeInt", "value", "prefixMask", "bits", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Writer {
public Header[] dynamicTable;
public int dynamicTableByteCount;
private boolean emitDynamicTableSizeUpdate;
public int headerCount;
public int headerTableSizeSetting;
public int maxDynamicTableByteCount;
private int nextHeaderIndex;
private final Buffer out;
private int smallestHeaderTableSizeSetting;
private final boolean useCompression;
public Writer(int i, Buffer buffer) {
this(i, false, buffer, 2, null);
}
public Writer(Buffer buffer) {
this(0, false, buffer, 3, null);
}
public Writer(int headerTableSizeSetting, boolean useCompression, Buffer out) {
Intrinsics.checkNotNullParameter(out, "out");
this.headerTableSizeSetting = headerTableSizeSetting;
this.useCompression = useCompression;
this.out = out;
this.smallestHeaderTableSizeSetting = Integer.MAX_VALUE;
this.maxDynamicTableByteCount = headerTableSizeSetting;
this.dynamicTable = new Header[8];
this.nextHeaderIndex = r0.length - 1;
}
public /* synthetic */ Writer(int i, boolean z, Buffer buffer, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this((i2 & 1) != 0 ? 4096 : i, (i2 & 2) != 0 ? true : z, buffer);
}
private final void clearDynamicTable() {
ArraysKt.fill$default(this.dynamicTable, (Object) null, 0, 0, 6, (Object) null);
this.nextHeaderIndex = this.dynamicTable.length - 1;
this.headerCount = 0;
this.dynamicTableByteCount = 0;
}
private final int evictToRecoverBytes(int bytesToRecover) {
int i;
int bytesToRecover2 = bytesToRecover;
int entriesToEvict = 0;
if (bytesToRecover2 > 0) {
int j = this.dynamicTable.length;
while (true) {
j--;
i = this.nextHeaderIndex;
if (j < i || bytesToRecover2 <= 0) {
break;
}
Header header = this.dynamicTable[j];
Intrinsics.checkNotNull(header);
bytesToRecover2 -= header.hpackSize;
int i2 = this.dynamicTableByteCount;
Header header2 = this.dynamicTable[j];
Intrinsics.checkNotNull(header2);
this.dynamicTableByteCount = i2 - header2.hpackSize;
this.headerCount--;
entriesToEvict++;
}
Header[] headerArr = this.dynamicTable;
System.arraycopy(headerArr, i + 1, headerArr, i + 1 + entriesToEvict, this.headerCount);
Header[] headerArr2 = this.dynamicTable;
int i3 = this.nextHeaderIndex;
Arrays.fill(headerArr2, i3 + 1, i3 + 1 + entriesToEvict, (Object) null);
this.nextHeaderIndex += entriesToEvict;
}
return entriesToEvict;
}
private final void insertIntoDynamicTable(Header entry) {
int delta = entry.hpackSize;
int i = this.maxDynamicTableByteCount;
if (delta > i) {
clearDynamicTable();
return;
}
int bytesToRecover = (this.dynamicTableByteCount + delta) - i;
evictToRecoverBytes(bytesToRecover);
int i2 = this.headerCount + 1;
Header[] headerArr = this.dynamicTable;
if (i2 > headerArr.length) {
Header[] doubled = new Header[headerArr.length * 2];
System.arraycopy(headerArr, 0, doubled, headerArr.length, headerArr.length);
this.nextHeaderIndex = this.dynamicTable.length - 1;
this.dynamicTable = doubled;
}
int index = this.nextHeaderIndex;
this.nextHeaderIndex = index - 1;
this.dynamicTable[index] = entry;
this.headerCount++;
this.dynamicTableByteCount += delta;
}
public final void writeHeaders(List<Header> headerBlock) throws IOException {
Intrinsics.checkNotNullParameter(headerBlock, "headerBlock");
if (this.emitDynamicTableSizeUpdate) {
int i = this.smallestHeaderTableSizeSetting;
if (i < this.maxDynamicTableByteCount) {
writeInt(i, 31, 32);
}
this.emitDynamicTableSizeUpdate = false;
this.smallestHeaderTableSizeSetting = Integer.MAX_VALUE;
writeInt(this.maxDynamicTableByteCount, 31, 32);
}
int size = headerBlock.size();
for (int i2 = 0; i2 < size; i2++) {
Header header = headerBlock.get(i2);
ByteString name = header.name.toAsciiLowercase();
ByteString value = header.value;
int headerIndex = -1;
int headerNameIndex = -1;
Integer staticIndex = Hpack.INSTANCE.getNAME_TO_FIRST_INDEX().get(name);
if (staticIndex != null && 2 <= (headerNameIndex = staticIndex.intValue() + 1) && 7 >= headerNameIndex) {
if (Intrinsics.areEqual(Hpack.INSTANCE.getSTATIC_HEADER_TABLE()[headerNameIndex - 1].value, value)) {
headerIndex = headerNameIndex;
} else if (Intrinsics.areEqual(Hpack.INSTANCE.getSTATIC_HEADER_TABLE()[headerNameIndex].value, value)) {
headerIndex = headerNameIndex + 1;
}
}
if (headerIndex == -1) {
int j = this.nextHeaderIndex + 1;
int length = this.dynamicTable.length;
while (true) {
if (j >= length) {
break;
}
Header header2 = this.dynamicTable[j];
Intrinsics.checkNotNull(header2);
if (Intrinsics.areEqual(header2.name, name)) {
Header header3 = this.dynamicTable[j];
Intrinsics.checkNotNull(header3);
if (Intrinsics.areEqual(header3.value, value)) {
headerIndex = (j - this.nextHeaderIndex) + Hpack.INSTANCE.getSTATIC_HEADER_TABLE().length;
break;
} else if (headerNameIndex == -1) {
headerNameIndex = (j - this.nextHeaderIndex) + Hpack.INSTANCE.getSTATIC_HEADER_TABLE().length;
}
}
j++;
}
}
if (headerIndex == -1) {
if (headerNameIndex == -1) {
this.out.writeByte(64);
writeByteString(name);
writeByteString(value);
insertIntoDynamicTable(header);
} else if (!name.startsWith(Header.PSEUDO_PREFIX) || !(!Intrinsics.areEqual(Header.TARGET_AUTHORITY, name))) {
writeInt(headerNameIndex, 63, 64);
writeByteString(value);
insertIntoDynamicTable(header);
} else {
writeInt(headerNameIndex, 15, 0);
writeByteString(value);
}
} else {
writeInt(headerIndex, 127, 128);
}
}
}
public final void writeInt(int value, int prefixMask, int bits) {
if (value < prefixMask) {
this.out.writeByte(bits | value);
return;
}
this.out.writeByte(bits | prefixMask);
int value2 = value - prefixMask;
while (value2 >= 128) {
int b = value2 & 127;
this.out.writeByte(b | 128);
value2 >>>= 7;
}
this.out.writeByte(value2);
}
public final void writeByteString(ByteString data) throws IOException {
Intrinsics.checkNotNullParameter(data, "data");
if (this.useCompression && Huffman.INSTANCE.encodedLength(data) < data.size()) {
Buffer huffmanBuffer = new Buffer();
Huffman.INSTANCE.encode(data, huffmanBuffer);
ByteString huffmanBytes = huffmanBuffer.readByteString();
writeInt(huffmanBytes.size(), 127, 128);
this.out.write(huffmanBytes);
return;
}
writeInt(data.size(), 127, 0);
this.out.write(data);
}
public final void resizeHeaderTable(int headerTableSizeSetting) {
this.headerTableSizeSetting = headerTableSizeSetting;
int effectiveHeaderTableSize = Math.min(headerTableSizeSetting, 16384);
int i = this.maxDynamicTableByteCount;
if (i == effectiveHeaderTableSize) {
return;
}
if (effectiveHeaderTableSize < i) {
this.smallestHeaderTableSizeSetting = Math.min(this.smallestHeaderTableSizeSetting, effectiveHeaderTableSize);
}
this.emitDynamicTableSizeUpdate = true;
this.maxDynamicTableByteCount = effectiveHeaderTableSize;
adjustDynamicTableByteCount();
}
private final void adjustDynamicTableByteCount() {
int i = this.maxDynamicTableByteCount;
int i2 = this.dynamicTableByteCount;
if (i < i2) {
if (i == 0) {
clearDynamicTable();
} else {
evictToRecoverBytes(i2 - i);
}
}
}
}
public final ByteString checkLowercase(ByteString name) throws IOException {
Intrinsics.checkNotNullParameter(name, "name");
int size = name.size();
for (int i = 0; i < size; i++) {
byte b = (byte) 65;
byte b2 = (byte) 90;
byte b3 = name.getByte(i);
if (b <= b3 && b2 >= b3) {
throw new IOException("PROTOCOL_ERROR response malformed: mixed case name: " + name.utf8());
}
}
return name;
}
}
@@ -0,0 +1,125 @@
package okhttp3.internal.http2;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import okhttp3.internal.Util;
import okio.ByteString;
/* compiled from: Http2.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u001a\n\u0002\u0010\u000b\n\u0002\b\u0003\\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\u001f\u001a\u00020\u00052\u0006\u0010 \u001a\u00020\u000b2\u0006\u0010!\u001a\u00020\u000bJ\u0015\u0010\"\u001a\u00020\u00052\u0006\u0010 \u001a\u00020\u000bH\u0000¢\u0006\u0002\b#J.\u0010$\u001a\u00020\u00052\u0006\u0010%\u001a\u00020&2\u0006\u0010'\u001a\u00020\u000b2\u0006\u0010(\u001a\u00020\u000b2\u0006\u0010 \u001a\u00020\u000b2\u0006\u0010!\u001a\u00020\u000bR\u0016\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004X\u0082\u0004¢\u0006\u0004\n\u0002\u0010\u0006R\u0010\u0010\u0007\u001a\u00020\b8\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0018\u0010\t\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00050\u0004X\u0082\u0004¢\u0006\u0004\n\u0002\u0010\u0006R\u000e\u0010\n\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0012\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u0016\u0010\u0013\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004X\u0082\u0004¢\u0006\u0004\n\u0002\u0010\u0006R\u000e\u0010\u0014\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0015\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0016\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0017\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0018\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0019\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u001a\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u001b\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u001c\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u001d\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u001e\u001a\u00020\u000bX\u0086T¢\u0006\u0002\n\u0000¨\u0006)"}, m238d2 = {"Lokhttp3/internal/http2/Http2;", "", "()V", "BINARY", "", "", "[Ljava/lang/String;", "CONNECTION_PREFACE", "Lokio/ByteString;", "FLAGS", "FLAG_ACK", "", "FLAG_COMPRESSED", "FLAG_END_HEADERS", "FLAG_END_PUSH_PROMISE", "FLAG_END_STREAM", "FLAG_NONE", "FLAG_PADDED", "FLAG_PRIORITY", "FRAME_NAMES", "INITIAL_MAX_FRAME_SIZE", "TYPE_CONTINUATION", "TYPE_DATA", "TYPE_GOAWAY", "TYPE_HEADERS", "TYPE_PING", "TYPE_PRIORITY", "TYPE_PUSH_PROMISE", "TYPE_RST_STREAM", "TYPE_SETTINGS", "TYPE_WINDOW_UPDATE", "formatFlags", "type", "flags", "formattedType", "formattedType$okhttp", "frameLog", "inbound", "", "streamId", "length", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Http2 {
private static final String[] BINARY;
public static final int FLAG_ACK = 1;
public static final int FLAG_COMPRESSED = 32;
public static final int FLAG_END_HEADERS = 4;
public static final int FLAG_END_PUSH_PROMISE = 4;
public static final int FLAG_END_STREAM = 1;
public static final int FLAG_NONE = 0;
public static final int FLAG_PADDED = 8;
public static final int FLAG_PRIORITY = 32;
public static final int INITIAL_MAX_FRAME_SIZE = 16384;
public static final int TYPE_CONTINUATION = 9;
public static final int TYPE_DATA = 0;
public static final int TYPE_GOAWAY = 7;
public static final int TYPE_HEADERS = 1;
public static final int TYPE_PING = 6;
public static final int TYPE_PRIORITY = 2;
public static final int TYPE_PUSH_PROMISE = 5;
public static final int TYPE_RST_STREAM = 3;
public static final int TYPE_SETTINGS = 4;
public static final int TYPE_WINDOW_UPDATE = 8;
public static final Http2 INSTANCE = new Http2();
public static final ByteString CONNECTION_PREFACE = ByteString.INSTANCE.encodeUtf8("PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n");
private static final String[] FRAME_NAMES = {"DATA", "HEADERS", "PRIORITY", "RST_STREAM", "SETTINGS", "PUSH_PROMISE", "PING", "GOAWAY", "WINDOW_UPDATE", "CONTINUATION"};
private static final String[] FLAGS = new String[64];
static {
String[] strArr = new String[256];
for (int i = 0; i < 256; i++) {
int it = i;
String binaryString = Integer.toBinaryString(it);
Intrinsics.checkNotNullExpressionValue(binaryString, "Integer.toBinaryString(it)");
strArr[i] = StringsKt.replace$default(Util.format("%8s", binaryString), ' ', '0', false, 4, (Object) null);
}
BINARY = strArr;
String[] strArr2 = FLAGS;
strArr2[0] = "";
strArr2[1] = "END_STREAM";
int[] prefixFlags = {1};
strArr2[8] = "PADDED";
for (int prefixFlag : prefixFlags) {
String[] strArr3 = FLAGS;
strArr3[prefixFlag | 8] = Intrinsics.stringPlus(strArr3[prefixFlag], "|PADDED");
}
String[] strArr4 = FLAGS;
strArr4[4] = "END_HEADERS";
strArr4[32] = "PRIORITY";
strArr4[36] = "END_HEADERS|PRIORITY";
int[] frameFlags = {4, 32, 36};
for (int frameFlag : frameFlags) {
for (int prefixFlag2 : prefixFlags) {
String[] strArr5 = FLAGS;
strArr5[prefixFlag2 | frameFlag] = strArr5[prefixFlag2] + "|" + strArr5[frameFlag];
strArr5[prefixFlag2 | frameFlag | 8] = strArr5[prefixFlag2] + "|" + strArr5[frameFlag] + "|PADDED";
}
}
int length = FLAGS.length;
for (int i2 = 0; i2 < length; i2++) {
String[] strArr6 = FLAGS;
if (strArr6[i2] == null) {
strArr6[i2] = BINARY[i2];
}
}
}
private Http2() {
}
public final String frameLog(boolean inbound, int streamId, int length, int type, int flags) {
String formattedType = formattedType$okhttp(type);
String formattedFlags = formatFlags(type, flags);
String direction = inbound ? "<<" : ">>";
return Util.format("%s 0x%08x %5d %-13s %s", direction, Integer.valueOf(streamId), Integer.valueOf(length), formattedType, formattedFlags);
}
public final String formattedType$okhttp(int type) {
String[] strArr = FRAME_NAMES;
return type < strArr.length ? strArr[type] : Util.format("0x%02x", Integer.valueOf(type));
}
public final String formatFlags(int type, int flags) {
String str;
if (flags == 0) {
return "";
}
switch (type) {
case 2:
case 3:
case 7:
case 8:
return BINARY[flags];
case 4:
case 6:
return flags == 1 ? "ACK" : BINARY[flags];
case 5:
default:
String[] strArr = FLAGS;
if (flags < strArr.length) {
str = strArr[flags];
Intrinsics.checkNotNull(str);
} else {
str = BINARY[flags];
}
String result = str;
if (type == 5 && (flags & 4) != 0) {
return StringsKt.replace$default(result, "HEADERS", "PUSH_PROMISE", false, 4, (Object) null);
}
if (type == 0 && (flags & 32) != 0) {
return StringsKt.replace$default(result, "PRIORITY", "COMPRESSED", false, 4, (Object) null);
}
return result;
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,223 @@
package okhttp3.internal.http2;
import java.io.IOException;
import java.net.ProtocolException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.Headers;
import okhttp3.OkHttpClient;
import okhttp3.Protocol;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.internal.Util;
import okhttp3.internal.connection.RealConnection;
import okhttp3.internal.http.ExchangeCodec;
import okhttp3.internal.http.HttpHeaders;
import okhttp3.internal.http.RealInterceptorChain;
import okhttp3.internal.http.RequestLine;
import okhttp3.internal.http.StatusLine;
import okio.Sink;
import okio.Source;
/* compiled from: Http2ExchangeCodec.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u0000 (2\u00020\u0001:\u0001(B%\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\\u0006\u0002\u0010\nJ\b\u0010\u0013\u001a\u00020\u0014H\u0016J\u0018\u0010\u0015\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0019\u001a\u00020\u001aH\u0016J\b\u0010\u001b\u001a\u00020\u0014H\u0016J\b\u0010\u001c\u001a\u00020\u0014H\u0016J\u0010\u0010\u001d\u001a\u00020\u001e2\u0006\u0010\u001f\u001a\u00020 H\u0016J\u0012\u0010!\u001a\u0004\u0018\u00010\"2\u0006\u0010#\u001a\u00020\fH\u0016J\u0010\u0010$\u001a\u00020\u001a2\u0006\u0010\u001f\u001a\u00020 H\u0016J\b\u0010%\u001a\u00020&H\u0016J\u0010\u0010'\u001a\u00020\u00142\u0006\u0010\u0017\u001a\u00020\u0018H\u0016R\u000e\u0010\u000b\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0004\u001a\u00020\u0005X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u000eR\u000e\u0010\b\u001a\u00020\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u0010X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0011\u001a\u0004\u0018\u00010\u0012X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006)"}, m238d2 = {"Lokhttp3/internal/http2/Http2ExchangeCodec;", "Lokhttp3/internal/http/ExchangeCodec;", "client", "Lokhttp3/OkHttpClient;", Http2ExchangeCodec.CONNECTION, "Lokhttp3/internal/connection/RealConnection;", "chain", "Lokhttp3/internal/http/RealInterceptorChain;", "http2Connection", "Lokhttp3/internal/http2/Http2Connection;", "(Lokhttp3/OkHttpClient;Lokhttp3/internal/connection/RealConnection;Lokhttp3/internal/http/RealInterceptorChain;Lokhttp3/internal/http2/Http2Connection;)V", "canceled", "", "getConnection", "()Lokhttp3/internal/connection/RealConnection;", "protocol", "Lokhttp3/Protocol;", "stream", "Lokhttp3/internal/http2/Http2Stream;", "cancel", "", "createRequestBody", "Lokio/Sink;", "request", "Lokhttp3/Request;", "contentLength", "", "finishRequest", "flushRequest", "openResponseBodySource", "Lokio/Source;", "response", "Lokhttp3/Response;", "readResponseHeaders", "Lokhttp3/Response$Builder;", "expectContinue", "reportedContentLength", "trailers", "Lokhttp3/Headers;", "writeRequestHeaders", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Http2ExchangeCodec implements ExchangeCodec {
private volatile boolean canceled;
private final RealInterceptorChain chain;
private final RealConnection connection;
private final Http2Connection http2Connection;
private final Protocol protocol;
private volatile Http2Stream stream;
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private static final String CONNECTION = "connection";
private static final String HOST = "host";
private static final String KEEP_ALIVE = "keep-alive";
private static final String PROXY_CONNECTION = "proxy-connection";
/* renamed from: TE */
private static final String f275TE = "te";
private static final String TRANSFER_ENCODING = "transfer-encoding";
private static final String ENCODING = "encoding";
private static final String UPGRADE = "upgrade";
private static final List<String> HTTP_2_SKIPPED_REQUEST_HEADERS = Util.immutableListOf(CONNECTION, HOST, KEEP_ALIVE, PROXY_CONNECTION, f275TE, TRANSFER_ENCODING, ENCODING, UPGRADE, Header.TARGET_METHOD_UTF8, Header.TARGET_PATH_UTF8, Header.TARGET_SCHEME_UTF8, Header.TARGET_AUTHORITY_UTF8);
private static final List<String> HTTP_2_SKIPPED_RESPONSE_HEADERS = Util.immutableListOf(CONNECTION, HOST, KEEP_ALIVE, PROXY_CONNECTION, f275TE, TRANSFER_ENCODING, ENCODING, UPGRADE);
public Http2ExchangeCodec(OkHttpClient client, RealConnection connection, RealInterceptorChain chain, Http2Connection http2Connection) {
Protocol protocol;
Intrinsics.checkNotNullParameter(client, "client");
Intrinsics.checkNotNullParameter(connection, "connection");
Intrinsics.checkNotNullParameter(chain, "chain");
Intrinsics.checkNotNullParameter(http2Connection, "http2Connection");
this.connection = connection;
this.chain = chain;
this.http2Connection = http2Connection;
if (client.protocols().contains(Protocol.H2_PRIOR_KNOWLEDGE)) {
protocol = Protocol.H2_PRIOR_KNOWLEDGE;
} else {
protocol = Protocol.HTTP_2;
}
this.protocol = protocol;
}
@Override // okhttp3.internal.http.ExchangeCodec
public RealConnection getConnection() {
return this.connection;
}
@Override // okhttp3.internal.http.ExchangeCodec
public Sink createRequestBody(Request request, long contentLength) {
Intrinsics.checkNotNullParameter(request, "request");
Http2Stream http2Stream = this.stream;
Intrinsics.checkNotNull(http2Stream);
return http2Stream.getSink();
}
@Override // okhttp3.internal.http.ExchangeCodec
public void writeRequestHeaders(Request request) {
Intrinsics.checkNotNullParameter(request, "request");
if (this.stream != null) {
return;
}
boolean hasRequestBody = request.body() != null;
List requestHeaders = INSTANCE.http2HeadersList(request);
this.stream = this.http2Connection.newStream(requestHeaders, hasRequestBody);
if (this.canceled) {
Http2Stream http2Stream = this.stream;
Intrinsics.checkNotNull(http2Stream);
http2Stream.closeLater(ErrorCode.CANCEL);
throw new IOException("Canceled");
}
Http2Stream http2Stream2 = this.stream;
Intrinsics.checkNotNull(http2Stream2);
http2Stream2.readTimeout().timeout(this.chain.getReadTimeoutMillis(), TimeUnit.MILLISECONDS);
Http2Stream http2Stream3 = this.stream;
Intrinsics.checkNotNull(http2Stream3);
http2Stream3.writeTimeout().timeout(this.chain.getWriteTimeoutMillis(), TimeUnit.MILLISECONDS);
}
@Override // okhttp3.internal.http.ExchangeCodec
public void flushRequest() {
this.http2Connection.flush();
}
@Override // okhttp3.internal.http.ExchangeCodec
public void finishRequest() {
Http2Stream http2Stream = this.stream;
Intrinsics.checkNotNull(http2Stream);
http2Stream.getSink().close();
}
@Override // okhttp3.internal.http.ExchangeCodec
public Response.Builder readResponseHeaders(boolean expectContinue) {
Http2Stream http2Stream = this.stream;
Intrinsics.checkNotNull(http2Stream);
Headers headers = http2Stream.takeHeaders();
Response.Builder responseBuilder = INSTANCE.readHttp2HeadersList(headers, this.protocol);
if (expectContinue && responseBuilder.getCode() == 100) {
return null;
}
return responseBuilder;
}
@Override // okhttp3.internal.http.ExchangeCodec
public long reportedContentLength(Response response) {
Intrinsics.checkNotNullParameter(response, "response");
if (HttpHeaders.promisesBody(response)) {
return Util.headersContentLength(response);
}
return 0L;
}
@Override // okhttp3.internal.http.ExchangeCodec
public Source openResponseBodySource(Response response) {
Intrinsics.checkNotNullParameter(response, "response");
Http2Stream http2Stream = this.stream;
Intrinsics.checkNotNull(http2Stream);
return http2Stream.getSource();
}
@Override // okhttp3.internal.http.ExchangeCodec
public Headers trailers() {
Http2Stream http2Stream = this.stream;
Intrinsics.checkNotNull(http2Stream);
return http2Stream.trailers();
}
@Override // okhttp3.internal.http.ExchangeCodec
public void cancel() {
this.canceled = true;
Http2Stream http2Stream = this.stream;
if (http2Stream != null) {
http2Stream.closeLater(ErrorCode.CANCEL);
}
}
/* compiled from: Http2ExchangeCodec.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000:\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010 \n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0014\u0010\u000f\u001a\b\u0012\u0004\u0012\u00020\u00100\b2\u0006\u0010\u0011\u001a\u00020\u0012J\u0016\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u00162\u0006\u0010\u0017\u001a\u00020\u0018R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u0014\u0010\u0007\u001a\b\u0012\u0004\u0012\u00020\u00040\bX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\t\u001a\b\u0012\u0004\u0012\u00020\u00040\bX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000¨\u0006\u0019"}, m238d2 = {"Lokhttp3/internal/http2/Http2ExchangeCodec$Companion;", "", "()V", "CONNECTION", "", "ENCODING", "HOST", "HTTP_2_SKIPPED_REQUEST_HEADERS", "", "HTTP_2_SKIPPED_RESPONSE_HEADERS", "KEEP_ALIVE", "PROXY_CONNECTION", com.google.common.net.HttpHeaders.f243TE, "TRANSFER_ENCODING", "UPGRADE", "http2HeadersList", "Lokhttp3/internal/http2/Header;", "request", "Lokhttp3/Request;", "readHttp2HeadersList", "Lokhttp3/Response$Builder;", "headerBlock", "Lokhttp3/Headers;", "protocol", "Lokhttp3/Protocol;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public final List<Header> http2HeadersList(Request request) {
Intrinsics.checkNotNullParameter(request, "request");
Headers headers = request.headers();
ArrayList result = new ArrayList(headers.size() + 4);
result.add(new Header(Header.TARGET_METHOD, request.method()));
result.add(new Header(Header.TARGET_PATH, RequestLine.INSTANCE.requestPath(request.url())));
String host = request.header(com.google.common.net.HttpHeaders.HOST);
if (host != null) {
result.add(new Header(Header.TARGET_AUTHORITY, host));
}
result.add(new Header(Header.TARGET_SCHEME, request.url().scheme()));
int size = headers.size();
for (int i = 0; i < size; i++) {
String name = headers.name(i);
Locale locale = Locale.US;
Intrinsics.checkNotNullExpressionValue(locale, "Locale.US");
if (name != null) {
String name2 = name.toLowerCase(locale);
Intrinsics.checkNotNullExpressionValue(name2, "(this as java.lang.String).toLowerCase(locale)");
if (!Http2ExchangeCodec.HTTP_2_SKIPPED_REQUEST_HEADERS.contains(name2) || (Intrinsics.areEqual(name2, Http2ExchangeCodec.f275TE) && Intrinsics.areEqual(headers.value(i), "trailers"))) {
result.add(new Header(name2, headers.value(i)));
}
} else {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
}
return result;
}
public final Response.Builder readHttp2HeadersList(Headers headerBlock, Protocol protocol) {
Intrinsics.checkNotNullParameter(headerBlock, "headerBlock");
Intrinsics.checkNotNullParameter(protocol, "protocol");
StatusLine statusLine = (StatusLine) null;
Headers.Builder headersBuilder = new Headers.Builder();
int size = headerBlock.size();
for (int i = 0; i < size; i++) {
String name = headerBlock.name(i);
String value = headerBlock.value(i);
if (Intrinsics.areEqual(name, Header.RESPONSE_STATUS_UTF8)) {
statusLine = StatusLine.INSTANCE.parse("HTTP/1.1 " + value);
} else if (!Http2ExchangeCodec.HTTP_2_SKIPPED_RESPONSE_HEADERS.contains(name)) {
headersBuilder.addLenient$okhttp(name, value);
}
}
if (statusLine != null) {
return new Response.Builder().protocol(protocol).code(statusLine.code).message(statusLine.message).headers(headersBuilder.build());
}
throw new ProtocolException("Expected ':status' header not present");
}
}
}
@@ -0,0 +1,548 @@
package okhttp3.internal.http2;
import com.google.common.net.HttpHeaders;
import java.io.Closeable;
import java.io.EOFException;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.internal.Util;
import okhttp3.internal.http2.Hpack;
import okio.Buffer;
import okio.BufferedSource;
import okio.ByteString;
import okio.Source;
import okio.Timeout;
/* compiled from: Http2Reader.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000H\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\f\u0018\u0000 #2\u00020\u0001:\u0003#$%B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\b\u0010\u000b\u001a\u00020\fH\u0016J\u0016\u0010\r\u001a\u00020\u00052\u0006\u0010\u000e\u001a\u00020\u00052\u0006\u0010\u000f\u001a\u00020\u0010J\u000e\u0010\u0011\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u0010J(\u0010\u0012\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u0016\u001a\u00020\u0014H\u0002J(\u0010\u0017\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u0016\u001a\u00020\u0014H\u0002J.\u0010\u0018\u001a\b\u0012\u0004\u0012\u00020\u001a0\u00192\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u001b\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u0016\u001a\u00020\u0014H\u0002J(\u0010\u001c\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u0016\u001a\u00020\u0014H\u0002J(\u0010\u001d\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u0016\u001a\u00020\u0014H\u0002J\u0018\u0010\u001e\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0016\u001a\u00020\u0014H\u0002J(\u0010\u001e\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u0016\u001a\u00020\u0014H\u0002J(\u0010\u001f\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u0016\u001a\u00020\u0014H\u0002J(\u0010 \u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u0016\u001a\u00020\u0014H\u0002J(\u0010!\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u0016\u001a\u00020\u0014H\u0002J(\u0010\"\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u0016\u001a\u00020\u0014H\u0002R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\nX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006&"}, m238d2 = {"Lokhttp3/internal/http2/Http2Reader;", "Ljava/io/Closeable;", "source", "Lokio/BufferedSource;", "client", "", "(Lokio/BufferedSource;Z)V", "continuation", "Lokhttp3/internal/http2/Http2Reader$ContinuationSource;", "hpackReader", "Lokhttp3/internal/http2/Hpack$Reader;", "close", "", "nextFrame", "requireSettings", "handler", "Lokhttp3/internal/http2/Http2Reader$Handler;", "readConnectionPreface", "readData", "length", "", "flags", "streamId", "readGoAway", "readHeaderBlock", "", "Lokhttp3/internal/http2/Header;", "padding", "readHeaders", "readPing", "readPriority", "readPushPromise", "readRstStream", "readSettings", "readWindowUpdate", "Companion", "ContinuationSource", "Handler", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Http2Reader implements Closeable {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private static final Logger logger;
private final boolean client;
private final ContinuationSource continuation;
private final Hpack.Reader hpackReader;
private final BufferedSource source;
/* compiled from: Http2Reader.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000X\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u000e\n\u0002\u0018\u0002\n\u0002\b\u0003\bf\u0018\u00002\u00020\u0001J\b\u0010\u0002\u001a\u00020\u0003H&J8\u0010\u0004\u001a\u00020\u00032\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\b2\u0006\u0010\f\u001a\u00020\u00062\u0006\u0010\r\u001a\u00020\u000eH&J(\u0010\u000f\u001a\u00020\u00032\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u0006H&J \u0010\u0015\u001a\u00020\u00032\u0006\u0010\u0016\u001a\u00020\u00062\u0006\u0010\u0017\u001a\u00020\u00182\u0006\u0010\u0019\u001a\u00020\nH&J.\u0010\u001a\u001a\u00020\u00032\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u001b\u001a\u00020\u00062\f\u0010\u001c\u001a\b\u0012\u0004\u0012\u00020\u001e0\u001dH&J \u0010\u001f\u001a\u00020\u00032\u0006\u0010 \u001a\u00020\u00112\u0006\u0010!\u001a\u00020\u00062\u0006\u0010\"\u001a\u00020\u0006H&J(\u0010#\u001a\u00020\u00032\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010$\u001a\u00020\u00062\u0006\u0010%\u001a\u00020\u00062\u0006\u0010&\u001a\u00020\u0011H&J&\u0010'\u001a\u00020\u00032\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010(\u001a\u00020\u00062\f\u0010)\u001a\b\u0012\u0004\u0012\u00020\u001e0\u001dH&J\u0018\u0010*\u001a\u00020\u00032\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0017\u001a\u00020\u0018H&J\u0018\u0010+\u001a\u00020\u00032\u0006\u0010,\u001a\u00020\u00112\u0006\u0010+\u001a\u00020-H&J\u0018\u0010.\u001a\u00020\u00032\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010/\u001a\u00020\u000eH&¨\u00060"}, m238d2 = {"Lokhttp3/internal/http2/Http2Reader$Handler;", "", "ackSettings", "", "alternateService", "streamId", "", HttpHeaders.ReferrerPolicyValues.ORIGIN, "", "protocol", "Lokio/ByteString;", "host", "port", "maxAge", "", "data", "inFinished", "", "source", "Lokio/BufferedSource;", "length", "goAway", "lastGoodStreamId", "errorCode", "Lokhttp3/internal/http2/ErrorCode;", "debugData", "headers", "associatedStreamId", "headerBlock", "", "Lokhttp3/internal/http2/Header;", "ping", "ack", "payload1", "payload2", "priority", "streamDependency", "weight", "exclusive", "pushPromise", "promisedStreamId", "requestHeaders", "rstStream", "settings", "clearPrevious", "Lokhttp3/internal/http2/Settings;", "windowUpdate", "windowSizeIncrement", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public interface Handler {
void ackSettings();
void alternateService(int streamId, String origin, ByteString protocol, String host, int port, long maxAge);
void data(boolean inFinished, int streamId, BufferedSource source, int length) throws IOException;
void goAway(int lastGoodStreamId, ErrorCode errorCode, ByteString debugData);
void headers(boolean inFinished, int streamId, int associatedStreamId, List<Header> headerBlock);
void ping(boolean ack, int payload1, int payload2);
void priority(int streamId, int streamDependency, int weight, boolean exclusive);
void pushPromise(int streamId, int promisedStreamId, List<Header> requestHeaders) throws IOException;
void rstStream(int streamId, ErrorCode errorCode);
void settings(boolean clearPrevious, Settings settings);
void windowUpdate(int streamId, long windowSizeIncrement);
}
public Http2Reader(BufferedSource source, boolean client) {
Intrinsics.checkNotNullParameter(source, "source");
this.source = source;
this.client = client;
ContinuationSource continuationSource = new ContinuationSource(source);
this.continuation = continuationSource;
this.hpackReader = new Hpack.Reader(continuationSource, 4096, 0, 4, null);
}
public final void readConnectionPreface(Handler handler) throws IOException {
Intrinsics.checkNotNullParameter(handler, "handler");
if (this.client) {
if (!nextFrame(true, handler)) {
throw new IOException("Required SETTINGS preface not received");
}
return;
}
ByteString connectionPreface = this.source.readByteString(Http2.CONNECTION_PREFACE.size());
Logger logger2 = logger;
if (logger2.isLoggable(Level.FINE)) {
logger2.fine(Util.format("<< CONNECTION " + connectionPreface.hex(), new Object[0]));
}
if (true ^ Intrinsics.areEqual(Http2.CONNECTION_PREFACE, connectionPreface)) {
throw new IOException("Expected a connection header but was " + connectionPreface.utf8());
}
}
public final boolean nextFrame(boolean requireSettings, Handler handler) throws IOException {
Intrinsics.checkNotNullParameter(handler, "handler");
try {
this.source.require(9L);
int length = Util.readMedium(this.source);
if (length > 16384) {
throw new IOException("FRAME_SIZE_ERROR: " + length);
}
int type = Util.and(this.source.readByte(), 255);
int flags = Util.and(this.source.readByte(), 255);
int streamId = this.source.readInt() & Integer.MAX_VALUE;
Logger logger2 = logger;
if (logger2.isLoggable(Level.FINE)) {
logger2.fine(Http2.INSTANCE.frameLog(true, streamId, length, type, flags));
}
if (requireSettings && type != 4) {
throw new IOException("Expected a SETTINGS frame but was " + Http2.INSTANCE.formattedType$okhttp(type));
}
switch (type) {
case 0:
readData(handler, length, flags, streamId);
return true;
case 1:
readHeaders(handler, length, flags, streamId);
return true;
case 2:
readPriority(handler, length, flags, streamId);
return true;
case 3:
readRstStream(handler, length, flags, streamId);
return true;
case 4:
readSettings(handler, length, flags, streamId);
return true;
case 5:
readPushPromise(handler, length, flags, streamId);
return true;
case 6:
readPing(handler, length, flags, streamId);
return true;
case 7:
readGoAway(handler, length, flags, streamId);
return true;
case 8:
readWindowUpdate(handler, length, flags, streamId);
return true;
default:
this.source.skip(length);
return true;
}
} catch (EOFException e) {
return false;
}
}
private final void readHeaders(Handler handler, int length, int flags, int streamId) throws IOException {
if (streamId == 0) {
throw new IOException("PROTOCOL_ERROR: TYPE_HEADERS streamId == 0");
}
boolean endStream = (flags & 1) != 0;
int padding = (flags & 8) != 0 ? Util.and(this.source.readByte(), 255) : 0;
int headerBlockLength = length;
if ((flags & 32) != 0) {
readPriority(handler, streamId);
headerBlockLength -= 5;
}
List headerBlock = readHeaderBlock(INSTANCE.lengthWithoutPadding(headerBlockLength, flags, padding), padding, flags, streamId);
handler.headers(endStream, streamId, -1, headerBlock);
}
private final List<Header> readHeaderBlock(int length, int padding, int flags, int streamId) throws IOException {
this.continuation.setLeft(length);
ContinuationSource continuationSource = this.continuation;
continuationSource.setLength(continuationSource.getLeft());
this.continuation.setPadding(padding);
this.continuation.setFlags(flags);
this.continuation.setStreamId(streamId);
this.hpackReader.readHeaders();
return this.hpackReader.getAndResetHeaderList();
}
private final void readData(Handler handler, int length, int flags, int streamId) throws IOException {
if (streamId == 0) {
throw new IOException("PROTOCOL_ERROR: TYPE_DATA streamId == 0");
}
boolean inFinished = (flags & 1) != 0;
boolean gzipped = (flags & 32) != 0;
if (gzipped) {
throw new IOException("PROTOCOL_ERROR: FLAG_COMPRESSED without SETTINGS_COMPRESS_DATA");
}
int padding = (flags & 8) != 0 ? Util.and(this.source.readByte(), 255) : 0;
int dataLength = INSTANCE.lengthWithoutPadding(length, flags, padding);
handler.data(inFinished, streamId, this.source, dataLength);
this.source.skip(padding);
}
private final void readPriority(Handler handler, int length, int flags, int streamId) throws IOException {
if (length != 5) {
throw new IOException("TYPE_PRIORITY length: " + length + " != 5");
}
if (streamId == 0) {
throw new IOException("TYPE_PRIORITY streamId == 0");
}
readPriority(handler, streamId);
}
private final void readPriority(Handler handler, int streamId) throws IOException {
int w1 = this.source.readInt();
boolean exclusive = (((int) 2147483648L) & w1) != 0;
int streamDependency = Integer.MAX_VALUE & w1;
int weight = Util.and(this.source.readByte(), 255) + 1;
handler.priority(streamId, streamDependency, weight, exclusive);
}
private final void readRstStream(Handler handler, int length, int flags, int streamId) throws IOException {
if (length != 4) {
throw new IOException("TYPE_RST_STREAM length: " + length + " != 4");
}
if (streamId == 0) {
throw new IOException("TYPE_RST_STREAM streamId == 0");
}
int errorCodeInt = this.source.readInt();
ErrorCode errorCode = ErrorCode.INSTANCE.fromHttp2(errorCodeInt);
if (errorCode == null) {
throw new IOException("TYPE_RST_STREAM unexpected error code: " + errorCodeInt);
}
handler.rstStream(streamId, errorCode);
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
/* JADX WARN: Removed duplicated region for block: B:42:0x009f A[LOOP:0: B:18:0x003e->B:42:0x009f, LOOP_END] */
/* JADX WARN: Removed duplicated region for block: B:43:0x00a3 A[SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private final void readSettings(okhttp3.internal.http2.Http2Reader.Handler r9, int r10, int r11, int r12) throws java.io.IOException {
/*
r8 = this;
if (r12 != 0) goto Lc0
r0 = r11 & 1
if (r0 == 0) goto L16
if (r10 != 0) goto Lc
r9.ackSettings()
return
Lc:
java.io.IOException r0 = new java.io.IOException
java.lang.String r1 = "FRAME_SIZE_ERROR ack frame should be empty!"
r0.<init>(r1)
java.lang.Throwable r0 = (java.lang.Throwable) r0
throw r0
L16:
int r0 = r10 % 6
if (r0 != 0) goto La7
okhttp3.internal.http2.Settings r0 = new okhttp3.internal.http2.Settings
r0.<init>()
r1 = 0
kotlin.ranges.IntRange r2 = kotlin.ranges.RangesKt.until(r1, r10)
kotlin.ranges.IntProgression r2 = (kotlin.ranges.IntProgression) r2
r3 = 6
kotlin.ranges.IntProgression r2 = kotlin.ranges.RangesKt.step(r2, r3)
int r3 = r2.getFirst()
int r4 = r2.getLast()
int r2 = r2.getStep()
if (r2 < 0) goto L3c
if (r3 > r4) goto La3
goto L3e
L3c:
if (r3 < r4) goto La3
L3e:
okio.BufferedSource r5 = r8.source
short r5 = r5.readShort()
r6 = 65535(0xffff, float:9.1834E-41)
int r5 = okhttp3.internal.Util.and(r5, r6)
okio.BufferedSource r6 = r8.source
int r6 = r6.readInt()
switch(r5) {
case 1: goto L54;
case 2: goto L89;
case 3: goto L87;
case 4: goto L79;
case 5: goto L56;
case 6: goto L55;
default: goto L54;
}
L54:
goto L99
L55:
goto L99
L56:
r7 = 16384(0x4000, float:2.2959E-41)
if (r6 < r7) goto L60
r7 = 16777215(0xffffff, float:2.3509886E-38)
if (r6 > r7) goto L60
goto L99
L60:
java.io.IOException r1 = new java.io.IOException
java.lang.StringBuilder r2 = new java.lang.StringBuilder
r2.<init>()
java.lang.String r4 = "PROTOCOL_ERROR SETTINGS_MAX_FRAME_SIZE: "
r2.append(r4)
r2.append(r6)
java.lang.String r2 = r2.toString()
r1.<init>(r2)
java.lang.Throwable r1 = (java.lang.Throwable) r1
throw r1
L79:
r5 = 7
if (r6 < 0) goto L7d
goto L99
L7d:
java.io.IOException r1 = new java.io.IOException
java.lang.String r2 = "PROTOCOL_ERROR SETTINGS_INITIAL_WINDOW_SIZE > 2^31 - 1"
r1.<init>(r2)
java.lang.Throwable r1 = (java.lang.Throwable) r1
throw r1
L87:
r5 = 4
goto L99
L89:
if (r6 == 0) goto L99
r7 = 1
if (r6 != r7) goto L8f
goto L99
L8f:
java.io.IOException r1 = new java.io.IOException
java.lang.String r2 = "PROTOCOL_ERROR SETTINGS_ENABLE_PUSH != 0 or 1"
r1.<init>(r2)
java.lang.Throwable r1 = (java.lang.Throwable) r1
throw r1
L99:
r0.set(r5, r6)
if (r3 == r4) goto La3
int r5 = r3 + r2
r3 = r5
goto L3e
La3:
r9.settings(r1, r0)
return
La7:
java.io.IOException r0 = new java.io.IOException
java.lang.StringBuilder r1 = new java.lang.StringBuilder
r1.<init>()
java.lang.String r2 = "TYPE_SETTINGS length % 6 != 0: "
r1.append(r2)
r1.append(r10)
java.lang.String r1 = r1.toString()
r0.<init>(r1)
java.lang.Throwable r0 = (java.lang.Throwable) r0
throw r0
Lc0:
java.io.IOException r0 = new java.io.IOException
java.lang.String r1 = "TYPE_SETTINGS streamId != 0"
r0.<init>(r1)
java.lang.Throwable r0 = (java.lang.Throwable) r0
throw r0
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.http2.Http2Reader.readSettings(okhttp3.internal.http2.Http2Reader$Handler, int, int, int):void");
}
private final void readPushPromise(Handler handler, int length, int flags, int streamId) throws IOException {
if (streamId == 0) {
throw new IOException("PROTOCOL_ERROR: TYPE_PUSH_PROMISE streamId == 0");
}
int padding = (flags & 8) != 0 ? Util.and(this.source.readByte(), 255) : 0;
int promisedStreamId = this.source.readInt() & Integer.MAX_VALUE;
int headerBlockLength = INSTANCE.lengthWithoutPadding(length - 4, flags, padding);
List headerBlock = readHeaderBlock(headerBlockLength, padding, flags, streamId);
handler.pushPromise(streamId, promisedStreamId, headerBlock);
}
private final void readPing(Handler handler, int length, int flags, int streamId) throws IOException {
if (length != 8) {
throw new IOException("TYPE_PING length != 8: " + length);
}
if (streamId != 0) {
throw new IOException("TYPE_PING streamId != 0");
}
int payload1 = this.source.readInt();
int payload2 = this.source.readInt();
boolean ack = (flags & 1) != 0;
handler.ping(ack, payload1, payload2);
}
private final void readGoAway(Handler handler, int length, int flags, int streamId) throws IOException {
if (length < 8) {
throw new IOException("TYPE_GOAWAY length < 8: " + length);
}
if (streamId != 0) {
throw new IOException("TYPE_GOAWAY streamId != 0");
}
int lastStreamId = this.source.readInt();
int errorCodeInt = this.source.readInt();
int opaqueDataLength = length - 8;
ErrorCode errorCode = ErrorCode.INSTANCE.fromHttp2(errorCodeInt);
if (errorCode == null) {
throw new IOException("TYPE_GOAWAY unexpected error code: " + errorCodeInt);
}
ByteString debugData = ByteString.EMPTY;
if (opaqueDataLength > 0) {
debugData = this.source.readByteString(opaqueDataLength);
}
handler.goAway(lastStreamId, errorCode, debugData);
}
private final void readWindowUpdate(Handler handler, int length, int flags, int streamId) throws IOException {
if (length != 4) {
throw new IOException("TYPE_WINDOW_UPDATE length !=4: " + length);
}
long increment = Util.and(this.source.readInt(), 2147483647L);
if (increment == 0) {
throw new IOException("windowSizeIncrement was 0");
}
handler.windowUpdate(streamId, increment);
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
this.source.close();
}
/* compiled from: Http2Reader.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0011\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\b\u0000\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\b\u0010\u0017\u001a\u00020\u0018H\u0016J\u0018\u0010\u0019\u001a\u00020\u001a2\u0006\u0010\u001b\u001a\u00020\u001c2\u0006\u0010\u001d\u001a\u00020\u001aH\u0016J\b\u0010\u001e\u001a\u00020\u0018H\u0002J\b\u0010\u001f\u001a\u00020 H\u0016R\u001a\u0010\u0005\u001a\u00020\u0006X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0007\u0010\b\"\u0004\b\t\u0010\nR\u001a\u0010\u000b\u001a\u00020\u0006X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\f\u0010\b\"\u0004\b\r\u0010\nR\u001a\u0010\u000e\u001a\u00020\u0006X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000f\u0010\b\"\u0004\b\u0010\u0010\nR\u001a\u0010\u0011\u001a\u00020\u0006X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0012\u0010\b\"\u0004\b\u0013\u0010\nR\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010\u0014\u001a\u00020\u0006X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0015\u0010\b\"\u0004\b\u0016\u0010\\u0006!"}, m238d2 = {"Lokhttp3/internal/http2/Http2Reader$ContinuationSource;", "Lokio/Source;", "source", "Lokio/BufferedSource;", "(Lokio/BufferedSource;)V", "flags", "", "getFlags", "()I", "setFlags", "(I)V", "left", "getLeft", "setLeft", "length", "getLength", "setLength", "padding", "getPadding", "setPadding", "streamId", "getStreamId", "setStreamId", "close", "", "read", "", "sink", "Lokio/Buffer;", "byteCount", "readContinuationHeader", "timeout", "Lokio/Timeout;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class ContinuationSource implements Source {
private int flags;
private int left;
private int length;
private int padding;
private final BufferedSource source;
private int streamId;
public ContinuationSource(BufferedSource source) {
Intrinsics.checkNotNullParameter(source, "source");
this.source = source;
}
public final int getLength() {
return this.length;
}
public final void setLength(int i) {
this.length = i;
}
public final int getFlags() {
return this.flags;
}
public final void setFlags(int i) {
this.flags = i;
}
public final int getStreamId() {
return this.streamId;
}
public final void setStreamId(int i) {
this.streamId = i;
}
public final int getLeft() {
return this.left;
}
public final void setLeft(int i) {
this.left = i;
}
public final int getPadding() {
return this.padding;
}
public final void setPadding(int i) {
this.padding = i;
}
@Override // okio.Source
public long read(Buffer sink, long byteCount) throws IOException {
Intrinsics.checkNotNullParameter(sink, "sink");
while (true) {
int i = this.left;
if (i == 0) {
this.source.skip(this.padding);
this.padding = 0;
if ((this.flags & 4) != 0) {
return -1L;
}
readContinuationHeader();
} else {
long read = this.source.read(sink, Math.min(byteCount, i));
if (read == -1) {
return -1L;
}
this.left -= (int) read;
return read;
}
}
}
@Override // okio.Source
/* renamed from: timeout */
public Timeout getTimeout() {
return this.source.getTimeout();
}
@Override // okio.Source, java.io.Closeable, java.lang.AutoCloseable
public void close() throws IOException {
}
private final void readContinuationHeader() throws IOException {
int previousStreamId = this.streamId;
int readMedium = Util.readMedium(this.source);
this.left = readMedium;
this.length = readMedium;
int type = Util.and(this.source.readByte(), 255);
this.flags = Util.and(this.source.readByte(), 255);
if (Http2Reader.INSTANCE.getLogger().isLoggable(Level.FINE)) {
Http2Reader.INSTANCE.getLogger().fine(Http2.INSTANCE.frameLog(true, this.streamId, this.length, type, this.flags));
}
int readInt = this.source.readInt() & Integer.MAX_VALUE;
this.streamId = readInt;
if (type != 9) {
throw new IOException(type + " != TYPE_CONTINUATION");
}
if (readInt != previousStreamId) {
throw new IOException("TYPE_CONTINUATION streamId changed");
}
}
}
/* compiled from: Http2Reader.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0004\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u001e\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\n\u001a\u00020\b2\u0006\u0010\u000b\u001a\u00020\bR\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006¨\u0006\f"}, m238d2 = {"Lokhttp3/internal/http2/Http2Reader$Companion;", "", "()V", "logger", "Ljava/util/logging/Logger;", "getLogger", "()Ljava/util/logging/Logger;", "lengthWithoutPadding", "", "length", "flags", "padding", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public final Logger getLogger() {
return Http2Reader.logger;
}
public final int lengthWithoutPadding(int length, int flags, int padding) throws IOException {
int result = length;
if ((flags & 8) != 0) {
result--;
}
if (padding > result) {
throw new IOException("PROTOCOL_ERROR padding " + padding + " > remaining length " + result);
}
return result - padding;
}
}
static {
Logger logger2 = Logger.getLogger(Http2.class.getName());
Intrinsics.checkNotNullExpressionValue(logger2, "Logger.getLogger(Http2::class.java.name)");
logger = logger2;
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,244 @@
package okhttp3.internal.http2;
import java.io.Closeable;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.internal.Util;
import okhttp3.internal.http2.Hpack;
import okio.Buffer;
import okio.BufferedSink;
/* compiled from: Http2Writer.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\\\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0011\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0012\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\f\n\u0002\u0010\t\n\u0002\b\u0003\u0018\u0000 :2\u00020\u0001:\u0001:B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\u000e\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0013J\b\u0010\u0014\u001a\u00020\u0011H\u0016J\u0006\u0010\u0015\u001a\u00020\u0011J(\u0010\u0016\u001a\u00020\u00112\u0006\u0010\u0017\u001a\u00020\u00052\u0006\u0010\u0018\u001a\u00020\u000f2\b\u0010\u0019\u001a\u0004\u0018\u00010\t2\u0006\u0010\u001a\u001a\u00020\u000fJ(\u0010\u001b\u001a\u00020\u00112\u0006\u0010\u0018\u001a\u00020\u000f2\u0006\u0010\u001c\u001a\u00020\u000f2\b\u0010\u001d\u001a\u0004\u0018\u00010\t2\u0006\u0010\u001a\u001a\u00020\u000fJ\u0006\u0010\u001e\u001a\u00020\u0011J&\u0010\u001f\u001a\u00020\u00112\u0006\u0010\u0018\u001a\u00020\u000f2\u0006\u0010 \u001a\u00020\u000f2\u0006\u0010!\u001a\u00020\u000f2\u0006\u0010\u001c\u001a\u00020\u000fJ\u001e\u0010\"\u001a\u00020\u00112\u0006\u0010#\u001a\u00020\u000f2\u0006\u0010$\u001a\u00020%2\u0006\u0010&\u001a\u00020'J$\u0010(\u001a\u00020\u00112\u0006\u0010\u0017\u001a\u00020\u00052\u0006\u0010\u0018\u001a\u00020\u000f2\f\u0010)\u001a\b\u0012\u0004\u0012\u00020+0*J\u0006\u0010,\u001a\u00020\u000fJ\u001e\u0010-\u001a\u00020\u00112\u0006\u0010.\u001a\u00020\u00052\u0006\u0010/\u001a\u00020\u000f2\u0006\u00100\u001a\u00020\u000fJ$\u00101\u001a\u00020\u00112\u0006\u0010\u0018\u001a\u00020\u000f2\u0006\u00102\u001a\u00020\u000f2\f\u00103\u001a\b\u0012\u0004\u0012\u00020+0*J\u0016\u00104\u001a\u00020\u00112\u0006\u0010\u0018\u001a\u00020\u000f2\u0006\u0010$\u001a\u00020%J\u000e\u00105\u001a\u00020\u00112\u0006\u00105\u001a\u00020\u0013J\u0016\u00106\u001a\u00020\u00112\u0006\u0010\u0018\u001a\u00020\u000f2\u0006\u00107\u001a\u000208J\u0018\u00109\u001a\u00020\u00112\u0006\u0010\u0018\u001a\u00020\u000f2\u0006\u0010\u001a\u001a\u000208H\u0002R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u0011\u0010\n\u001a\u00020\u000b¢\u0006\b\n\u0000\u001a\u0004\b\f\u0010\rR\u000e\u0010\u000e\u001a\u00020\u000fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006;"}, m238d2 = {"Lokhttp3/internal/http2/Http2Writer;", "Ljava/io/Closeable;", "sink", "Lokio/BufferedSink;", "client", "", "(Lokio/BufferedSink;Z)V", "closed", "hpackBuffer", "Lokio/Buffer;", "hpackWriter", "Lokhttp3/internal/http2/Hpack$Writer;", "getHpackWriter", "()Lokhttp3/internal/http2/Hpack$Writer;", "maxFrameSize", "", "applyAndAckSettings", "", "peerSettings", "Lokhttp3/internal/http2/Settings;", "close", "connectionPreface", "data", "outFinished", "streamId", "source", "byteCount", "dataFrame", "flags", "buffer", "flush", "frameHeader", "length", "type", "goAway", "lastGoodStreamId", "errorCode", "Lokhttp3/internal/http2/ErrorCode;", "debugData", "", "headers", "headerBlock", "", "Lokhttp3/internal/http2/Header;", "maxDataLength", "ping", "ack", "payload1", "payload2", "pushPromise", "promisedStreamId", "requestHeaders", "rstStream", "settings", "windowUpdate", "windowSizeIncrement", "", "writeContinuationFrames", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Http2Writer implements Closeable {
private static final Logger logger = Logger.getLogger(Http2.class.getName());
private final boolean client;
private boolean closed;
private final Buffer hpackBuffer;
private final Hpack.Writer hpackWriter;
private int maxFrameSize;
private final BufferedSink sink;
public Http2Writer(BufferedSink sink, boolean client) {
Intrinsics.checkNotNullParameter(sink, "sink");
this.sink = sink;
this.client = client;
Buffer buffer = new Buffer();
this.hpackBuffer = buffer;
this.maxFrameSize = 16384;
this.hpackWriter = new Hpack.Writer(0, false, buffer, 3, null);
}
public final Hpack.Writer getHpackWriter() {
return this.hpackWriter;
}
public final synchronized void connectionPreface() throws IOException {
if (this.closed) {
throw new IOException("closed");
}
if (this.client) {
Logger logger2 = logger;
if (logger2.isLoggable(Level.FINE)) {
logger2.fine(Util.format(">> CONNECTION " + Http2.CONNECTION_PREFACE.hex(), new Object[0]));
}
this.sink.write(Http2.CONNECTION_PREFACE);
this.sink.flush();
}
}
public final synchronized void applyAndAckSettings(Settings peerSettings) throws IOException {
Intrinsics.checkNotNullParameter(peerSettings, "peerSettings");
if (this.closed) {
throw new IOException("closed");
}
this.maxFrameSize = peerSettings.getMaxFrameSize(this.maxFrameSize);
if (peerSettings.getHeaderTableSize() != -1) {
this.hpackWriter.resizeHeaderTable(peerSettings.getHeaderTableSize());
}
frameHeader(0, 0, 4, 1);
this.sink.flush();
}
public final synchronized void pushPromise(int streamId, int promisedStreamId, List<Header> requestHeaders) throws IOException {
Intrinsics.checkNotNullParameter(requestHeaders, "requestHeaders");
if (this.closed) {
throw new IOException("closed");
}
this.hpackWriter.writeHeaders(requestHeaders);
long byteCount = this.hpackBuffer.size();
int length = (int) Math.min(this.maxFrameSize - 4, byteCount);
frameHeader(streamId, length + 4, 5, byteCount == ((long) length) ? 4 : 0);
this.sink.writeInt(Integer.MAX_VALUE & promisedStreamId);
this.sink.write(this.hpackBuffer, length);
if (byteCount > length) {
writeContinuationFrames(streamId, byteCount - length);
}
}
public final synchronized void flush() throws IOException {
if (this.closed) {
throw new IOException("closed");
}
this.sink.flush();
}
public final synchronized void rstStream(int streamId, ErrorCode errorCode) throws IOException {
Intrinsics.checkNotNullParameter(errorCode, "errorCode");
if (this.closed) {
throw new IOException("closed");
}
if (!(errorCode.getHttpCode() != -1)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
frameHeader(streamId, 4, 3, 0);
this.sink.writeInt(errorCode.getHttpCode());
this.sink.flush();
}
/* renamed from: maxDataLength, reason: from getter */
public final int getMaxFrameSize() {
return this.maxFrameSize;
}
public final synchronized void data(boolean outFinished, int streamId, Buffer source, int byteCount) throws IOException {
if (this.closed) {
throw new IOException("closed");
}
int flags = outFinished ? 0 | 1 : 0;
dataFrame(streamId, flags, source, byteCount);
}
public final void dataFrame(int streamId, int flags, Buffer buffer, int byteCount) throws IOException {
frameHeader(streamId, byteCount, 0, flags);
if (byteCount > 0) {
BufferedSink bufferedSink = this.sink;
Intrinsics.checkNotNull(buffer);
bufferedSink.write(buffer, byteCount);
}
}
public final synchronized void settings(Settings settings) throws IOException {
int id;
Intrinsics.checkNotNullParameter(settings, "settings");
if (this.closed) {
throw new IOException("closed");
}
frameHeader(0, settings.size() * 6, 4, 0);
for (int i = 0; i < 10; i++) {
if (settings.isSet(i)) {
switch (i) {
case 4:
id = 3;
break;
case 7:
id = 4;
break;
default:
id = i;
break;
}
this.sink.writeShort(id);
this.sink.writeInt(settings.get(i));
}
}
this.sink.flush();
}
public final synchronized void ping(boolean ack, int payload1, int payload2) throws IOException {
if (this.closed) {
throw new IOException("closed");
}
frameHeader(0, 8, 6, ack ? 1 : 0);
this.sink.writeInt(payload1);
this.sink.writeInt(payload2);
this.sink.flush();
}
public final synchronized void goAway(int lastGoodStreamId, ErrorCode errorCode, byte[] debugData) throws IOException {
Intrinsics.checkNotNullParameter(errorCode, "errorCode");
Intrinsics.checkNotNullParameter(debugData, "debugData");
if (this.closed) {
throw new IOException("closed");
}
if (!(errorCode.getHttpCode() != -1)) {
throw new IllegalArgumentException("errorCode.httpCode == -1".toString());
}
frameHeader(0, debugData.length + 8, 7, 0);
this.sink.writeInt(lastGoodStreamId);
this.sink.writeInt(errorCode.getHttpCode());
if (!(debugData.length == 0)) {
this.sink.write(debugData);
}
this.sink.flush();
}
public final synchronized void windowUpdate(int streamId, long windowSizeIncrement) throws IOException {
if (this.closed) {
throw new IOException("closed");
}
if (!(windowSizeIncrement != 0 && windowSizeIncrement <= 2147483647L)) {
throw new IllegalArgumentException(("windowSizeIncrement == 0 || windowSizeIncrement > 0x7fffffffL: " + windowSizeIncrement).toString());
}
frameHeader(streamId, 4, 8, 0);
this.sink.writeInt((int) windowSizeIncrement);
this.sink.flush();
}
public final void frameHeader(int streamId, int length, int type, int flags) throws IOException {
Logger logger2 = logger;
if (logger2.isLoggable(Level.FINE)) {
logger2.fine(Http2.INSTANCE.frameLog(false, streamId, length, type, flags));
}
if (!(length <= this.maxFrameSize)) {
throw new IllegalArgumentException(("FRAME_SIZE_ERROR length > " + this.maxFrameSize + ": " + length).toString());
}
if (!((((int) 2147483648L) & streamId) == 0)) {
throw new IllegalArgumentException(("reserved bit set: " + streamId).toString());
}
Util.writeMedium(this.sink, length);
this.sink.writeByte(type & 255);
this.sink.writeByte(flags & 255);
this.sink.writeInt(Integer.MAX_VALUE & streamId);
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public synchronized void close() throws IOException {
this.closed = true;
this.sink.close();
}
private final void writeContinuationFrames(int streamId, long byteCount) throws IOException {
long byteCount2 = byteCount;
while (byteCount2 > 0) {
long length = Math.min(this.maxFrameSize, byteCount2);
byteCount2 -= length;
frameHeader(streamId, (int) length, 9, byteCount2 == 0 ? 4 : 0);
this.sink.write(this.hpackBuffer, length);
}
}
public final synchronized void headers(boolean outFinished, int streamId, List<Header> headerBlock) throws IOException {
Intrinsics.checkNotNullParameter(headerBlock, "headerBlock");
if (this.closed) {
throw new IOException("closed");
}
this.hpackWriter.writeHeaders(headerBlock);
long byteCount = this.hpackBuffer.size();
long length = Math.min(this.maxFrameSize, byteCount);
int flags = byteCount == length ? 4 : 0;
if (outFinished) {
flags |= 1;
}
frameHeader(streamId, (int) length, 1, flags);
this.sink.write(this.hpackBuffer, length);
if (byteCount > length) {
writeContinuationFrames(streamId, byteCount - length);
}
}
}
@@ -0,0 +1,171 @@
package okhttp3.internal.http2;
import androidx.core.view.PointerIconCompat;
import androidx.recyclerview.widget.ItemTouchHelper;
import com.google.common.base.Ascii;
import java.io.IOException;
import kotlin.Metadata;
import kotlin.collections.ArraysKt;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.internal.Util;
import okio.BufferedSink;
import okio.BufferedSource;
import okio.ByteString;
/* compiled from: Huffman.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000F\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u0015\n\u0000\n\u0002\u0010\u0012\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\\u0002\u0018\u00002\u00020\u0001:\u0001\u001aB\u0007\b\u0002¢\u0006\u0002\u0010\u0002J \u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\f2\u0006\u0010\u000e\u001a\u00020\fH\u0002J\u001e\u0010\u000f\u001a\u00020\n2\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0014\u001a\u00020\u0015J\u0016\u0010\u0016\u001a\u00020\n2\u0006\u0010\u0010\u001a\u00020\u00172\u0006\u0010\u0014\u001a\u00020\u0015J\u000e\u0010\u0018\u001a\u00020\f2\u0006\u0010\u0019\u001a\u00020\u0017R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u001b"}, m238d2 = {"Lokhttp3/internal/http2/Huffman;", "", "()V", "CODES", "", "CODE_BIT_COUNTS", "", "root", "Lokhttp3/internal/http2/Huffman$Node;", "addCode", "", "symbol", "", "code", "codeBitCount", "decode", "source", "Lokio/BufferedSource;", "byteCount", "", "sink", "Lokio/BufferedSink;", "encode", "Lokio/ByteString;", "encodedLength", "bytes", "Node", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Huffman {
private static final int[] CODES;
private static final byte[] CODE_BIT_COUNTS;
public static final Huffman INSTANCE;
private static final Node root;
static {
Huffman huffman = new Huffman();
INSTANCE = huffman;
CODES = new int[]{8184, 8388568, 268435426, 268435427, 268435428, 268435429, 268435430, 268435431, 268435432, 16777194, 1073741820, 268435433, 268435434, 1073741821, 268435435, 268435436, 268435437, 268435438, 268435439, 268435440, 268435441, 268435442, 1073741822, 268435443, 268435444, 268435445, 268435446, 268435447, 268435448, 268435449, 268435450, 268435451, 20, PointerIconCompat.TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW, PointerIconCompat.TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW, 4090, 8185, 21, 248, 2042, PointerIconCompat.TYPE_ZOOM_IN, PointerIconCompat.TYPE_ZOOM_OUT, 249, 2043, ItemTouchHelper.Callback.DEFAULT_SWIPE_ANIMATION_DURATION, 22, 23, 24, 0, 1, 2, 25, 26, 27, 28, 29, 30, 31, 92, 251, 32764, 32, 4091, PointerIconCompat.TYPE_GRAB, 8186, 33, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 252, 115, 253, 8187, 524272, 8188, 16380, 34, 32765, 3, 35, 4, 36, 5, 37, 38, 39, 6, 116, 117, 40, 41, 42, 7, 43, 118, 44, 8, 9, 45, 119, 120, 121, 122, 123, 32766, 2044, 16381, 8189, 268435452, 1048550, 4194258, 1048551, 1048552, 4194259, 4194260, 4194261, 8388569, 4194262, 8388570, 8388571, 8388572, 8388573, 8388574, 16777195, 8388575, 16777196, 16777197, 4194263, 8388576, 16777198, 8388577, 8388578, 8388579, 8388580, 2097116, 4194264, 8388581, 4194265, 8388582, 8388583, 16777199, 4194266, 2097117, 1048553, 4194267, 4194268, 8388584, 8388585, 2097118, 8388586, 4194269, 4194270, 16777200, 2097119, 4194271, 8388587, 8388588, 2097120, 2097121, 4194272, 2097122, 8388589, 4194273, 8388590, 8388591, 1048554, 4194274, 4194275, 4194276, 8388592, 4194277, 4194278, 8388593, 67108832, 67108833, 1048555, 524273, 4194279, 8388594, 4194280, 33554412, 67108834, 67108835, 67108836, 134217694, 134217695, 67108837, 16777201, 33554413, 524274, 2097123, 67108838, 134217696, 134217697, 67108839, 134217698, 16777202, 2097124, 2097125, 67108840, 67108841, 268435453, 134217699, 134217700, 134217701, 1048556, 16777203, 1048557, 2097126, 4194281, 2097127, 2097128, 8388595, 4194282, 4194283, 33554414, 33554415, 16777204, 16777205, 67108842, 8388596, 67108843, 134217702, 67108844, 67108845, 134217703, 134217704, 134217705, 134217706, 134217707, 268435454, 134217708, 134217709, 134217710, 134217711, 134217712, 67108846};
byte[] bArr = {Ascii.f157CR, Ascii.ETB, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.CAN, Ascii.f165RS, Ascii.f160FS, Ascii.f160FS, Ascii.f165RS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f165RS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, Ascii.f160FS, 6, 10, 10, Ascii.f159FF, Ascii.f157CR, 6, 8, Ascii.f170VT, 10, 10, 8, Ascii.f170VT, 8, 6, 6, 6, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 8, Ascii.f166SI, 6, Ascii.f159FF, 10, Ascii.f157CR, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 8, Ascii.f157CR, 19, Ascii.f157CR, Ascii.f167SO, 6, Ascii.f166SI, 5, 6, 5, 6, 5, 6, 6, 6, 5, 7, 7, 6, 6, 6, 5, 6, 7, 6, 5, 5, 6, 7, 7, 7, 7, 7, Ascii.f166SI, Ascii.f170VT, Ascii.f167SO, Ascii.f157CR, Ascii.f160FS, Ascii.DC4, Ascii.SYN, Ascii.DC4, Ascii.DC4, Ascii.SYN, Ascii.SYN, Ascii.SYN, Ascii.ETB, Ascii.SYN, Ascii.ETB, Ascii.ETB, Ascii.ETB, Ascii.ETB, Ascii.ETB, Ascii.CAN, Ascii.ETB, Ascii.CAN, Ascii.CAN, Ascii.SYN, Ascii.ETB, Ascii.CAN, Ascii.ETB, Ascii.ETB, Ascii.ETB, Ascii.ETB, Ascii.NAK, Ascii.SYN, Ascii.ETB, Ascii.SYN, Ascii.ETB, Ascii.ETB, Ascii.CAN, Ascii.SYN, Ascii.NAK, Ascii.DC4, Ascii.SYN, Ascii.SYN, Ascii.ETB, Ascii.ETB, Ascii.NAK, Ascii.ETB, Ascii.SYN, Ascii.SYN, Ascii.CAN, Ascii.NAK, Ascii.SYN, Ascii.ETB, Ascii.ETB, Ascii.NAK, Ascii.NAK, Ascii.SYN, Ascii.NAK, Ascii.ETB, Ascii.SYN, Ascii.ETB, Ascii.ETB, Ascii.DC4, Ascii.SYN, Ascii.SYN, Ascii.SYN, Ascii.ETB, Ascii.SYN, Ascii.SYN, Ascii.ETB, Ascii.SUB, Ascii.SUB, Ascii.DC4, 19, Ascii.SYN, Ascii.ETB, Ascii.SYN, Ascii.f158EM, Ascii.SUB, Ascii.SUB, Ascii.SUB, Ascii.ESC, Ascii.ESC, Ascii.SUB, Ascii.CAN, Ascii.f158EM, 19, Ascii.NAK, Ascii.SUB, Ascii.ESC, Ascii.ESC, Ascii.SUB, Ascii.ESC, Ascii.CAN, Ascii.NAK, Ascii.NAK, Ascii.SUB, Ascii.SUB, Ascii.f160FS, Ascii.ESC, Ascii.ESC, Ascii.ESC, Ascii.DC4, Ascii.CAN, Ascii.DC4, Ascii.NAK, Ascii.SYN, Ascii.NAK, Ascii.NAK, Ascii.ETB, Ascii.SYN, Ascii.SYN, Ascii.f158EM, Ascii.f158EM, Ascii.CAN, Ascii.CAN, Ascii.SUB, Ascii.ETB, Ascii.SUB, Ascii.ESC, Ascii.SUB, Ascii.SUB, Ascii.ESC, Ascii.ESC, Ascii.ESC, Ascii.ESC, Ascii.ESC, Ascii.f160FS, Ascii.ESC, Ascii.ESC, Ascii.ESC, Ascii.ESC, Ascii.ESC, Ascii.SUB};
CODE_BIT_COUNTS = bArr;
root = new Node();
int length = bArr.length;
for (int i = 0; i < length; i++) {
huffman.addCode(i, CODES[i], CODE_BIT_COUNTS[i]);
}
}
private Huffman() {
}
public final void encode(ByteString source, BufferedSink sink) throws IOException {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(sink, "sink");
long accumulator = 0;
int accumulatorBitCount = 0;
int size = source.size();
for (int i = 0; i < size; i++) {
int symbol = Util.and(source.getByte(i), 255);
int code = CODES[symbol];
int codeBitCount = CODE_BIT_COUNTS[symbol];
accumulator = (accumulator << codeBitCount) | code;
accumulatorBitCount += codeBitCount;
while (accumulatorBitCount >= 8) {
accumulatorBitCount -= 8;
sink.writeByte((int) (accumulator >> accumulatorBitCount));
}
}
if (accumulatorBitCount > 0) {
sink.writeByte((int) ((accumulator << (8 - accumulatorBitCount)) | (255 >>> accumulatorBitCount)));
}
}
public final int encodedLength(ByteString bytes) {
Intrinsics.checkNotNullParameter(bytes, "bytes");
long bitCount = 0;
int size = bytes.size();
for (int i = 0; i < size; i++) {
int byteIn = Util.and(bytes.getByte(i), 255);
bitCount += CODE_BIT_COUNTS[byteIn];
}
return (int) ((7 + bitCount) >> 3);
}
public final void decode(BufferedSource source, long byteCount, BufferedSink sink) {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(sink, "sink");
Node node = root;
int accumulator = 0;
int accumulatorBitCount = 0;
for (long i = 0; i < byteCount; i = 1 + i) {
int byteIn = Util.and(source.readByte(), 255);
accumulator = (accumulator << 8) | byteIn;
accumulatorBitCount += 8;
while (accumulatorBitCount >= 8) {
int childIndex = (accumulator >>> (accumulatorBitCount - 8)) & 255;
Node[] children = node.getChildren();
Intrinsics.checkNotNull(children);
Node node2 = children[childIndex];
Intrinsics.checkNotNull(node2);
node = node2;
if (node.getChildren() == null) {
sink.writeByte(node.getSymbol());
accumulatorBitCount -= node.getTerminalBitCount();
node = root;
} else {
accumulatorBitCount -= 8;
}
}
}
while (accumulatorBitCount > 0) {
int childIndex2 = (accumulator << (8 - accumulatorBitCount)) & 255;
Node[] children2 = node.getChildren();
Intrinsics.checkNotNull(children2);
Node node3 = children2[childIndex2];
Intrinsics.checkNotNull(node3);
if (node3.getChildren() == null && node3.getTerminalBitCount() <= accumulatorBitCount) {
sink.writeByte(node3.getSymbol());
accumulatorBitCount -= node3.getTerminalBitCount();
node = root;
} else {
return;
}
}
}
private final void addCode(int symbol, int code, int codeBitCount) {
Node terminal = new Node(symbol, codeBitCount);
int accumulatorBitCount = codeBitCount;
Node node = root;
while (accumulatorBitCount > 8) {
accumulatorBitCount -= 8;
int childIndex = (code >>> accumulatorBitCount) & 255;
Node[] children = node.getChildren();
Intrinsics.checkNotNull(children);
Node child = children[childIndex];
if (child == null) {
child = new Node();
children[childIndex] = child;
}
node = child;
}
int shift = 8 - accumulatorBitCount;
int start = (code << shift) & 255;
int end = 1 << shift;
Node[] children2 = node.getChildren();
Intrinsics.checkNotNull(children2);
ArraysKt.fill(children2, terminal, start, start + end);
}
/* compiled from: Huffman.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u0011\n\u0002\b\b\b\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0016¢\u0006\u0002\u0010\u0002B\u0017\b\u0016\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u0012\u0006\u0010\u0005\u001a\u00020\u0004¢\u0006\u0002\u0010\u0006R\u001d\u0010\u0007\u001a\f\u0012\u0006\u0012\u0004\u0018\u00010\u0000\u0018\u00010\\u0006\n\n\u0002\u0010\u000b\u001a\u0004\b\t\u0010\nR\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\f\u0010\rR\u0011\u0010\u000e\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u000f\u0010\\u0006\u0010"}, m238d2 = {"Lokhttp3/internal/http2/Huffman$Node;", "", "()V", "symbol", "", "bits", "(II)V", "children", "", "getChildren", "()[Lokhttp3/internal/http2/Huffman$Node;", "[Lokhttp3/internal/http2/Huffman$Node;", "getSymbol", "()I", "terminalBitCount", "getTerminalBitCount", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private static final class Node {
private final Node[] children;
private final int symbol;
private final int terminalBitCount;
public final Node[] getChildren() {
return this.children;
}
public final int getSymbol() {
return this.symbol;
}
public final int getTerminalBitCount() {
return this.terminalBitCount;
}
public Node() {
this.children = new Node[256];
this.symbol = 0;
this.terminalBitCount = 0;
}
public Node(int symbol, int bits) {
this.children = null;
this.symbol = symbol;
int b = bits & 7;
this.terminalBitCount = b == 0 ? 8 : b;
}
}
}
@@ -0,0 +1,67 @@
package okhttp3.internal.http2;
import java.io.IOException;
import java.util.List;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okio.BufferedSource;
/* compiled from: PushObserver.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\bf\u0018\u0000 \u00142\u00020\u0001:\u0001\u0014J(\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\u00052\u0006\u0010\t\u001a\u00020\u0003H&J&\u0010\n\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\f\u0010\u000b\u001a\b\u0012\u0004\u0012\u00020\r0\f2\u0006\u0010\t\u001a\u00020\u0003H&J\u001e\u0010\u000e\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00052\f\u0010\u000f\u001a\b\u0012\u0004\u0012\u00020\r0\fH&J\u0018\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0004\u001a\u00020\u00052\u0006\u0010\u0012\u001a\u00020\u0013H&¨\u0006\u0015"}, m238d2 = {"Lokhttp3/internal/http2/PushObserver;", "", "onData", "", "streamId", "", "source", "Lokio/BufferedSource;", "byteCount", "last", "onHeaders", "responseHeaders", "", "Lokhttp3/internal/http2/Header;", "onRequest", "requestHeaders", "onReset", "", "errorCode", "Lokhttp3/internal/http2/ErrorCode;", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public interface PushObserver {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
public static final PushObserver CANCEL = new Companion.PushObserverCancel();
boolean onData(int streamId, BufferedSource source, int byteCount, boolean last) throws IOException;
boolean onHeaders(int streamId, List<Header> responseHeaders, boolean last);
boolean onRequest(int streamId, List<Header> requestHeaders);
void onReset(int streamId, ErrorCode errorCode);
/* compiled from: PushObserver.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001:\u0001\u0005B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0016\u0010\u0003\u001a\u00020\u00048\u0006X\u0087\u0004ø\u0001\u0000¢\u0006\u0002\n\u0000¨\u0006\u0001\u0082\u0002\u0007\n\u0005\b\u0091F0\u0001¨\u0006\u0006"}, m238d2 = {"Lokhttp3/internal/http2/PushObserver$Companion;", "", "()V", "CANCEL", "Lokhttp3/internal/http2/PushObserver;", "PushObserverCancel", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
static final /* synthetic */ Companion $$INSTANCE = null;
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
/* compiled from: PushObserver.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\b\u0002\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J(\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\b2\u0006\u0010\t\u001a\u00020\u00062\u0006\u0010\n\u001a\u00020\u0004H\u0016J&\u0010\u000b\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\f\u0010\f\u001a\b\u0012\u0004\u0012\u00020\u000e0\r2\u0006\u0010\n\u001a\u00020\u0004H\u0016J\u001e\u0010\u000f\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\f\u0010\u0010\u001a\b\u0012\u0004\u0012\u00020\u000e0\rH\u0016J\u0018\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0013\u001a\u00020\u0014H\u0016¨\u0006\u0015"}, m238d2 = {"Lokhttp3/internal/http2/PushObserver$Companion$PushObserverCancel;", "Lokhttp3/internal/http2/PushObserver;", "()V", "onData", "", "streamId", "", "source", "Lokio/BufferedSource;", "byteCount", "last", "onHeaders", "responseHeaders", "", "Lokhttp3/internal/http2/Header;", "onRequest", "requestHeaders", "onReset", "", "errorCode", "Lokhttp3/internal/http2/ErrorCode;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private static final class PushObserverCancel implements PushObserver {
@Override // okhttp3.internal.http2.PushObserver
public boolean onRequest(int streamId, List<Header> requestHeaders) {
Intrinsics.checkNotNullParameter(requestHeaders, "requestHeaders");
return true;
}
@Override // okhttp3.internal.http2.PushObserver
public boolean onHeaders(int streamId, List<Header> responseHeaders, boolean last) {
Intrinsics.checkNotNullParameter(responseHeaders, "responseHeaders");
return true;
}
@Override // okhttp3.internal.http2.PushObserver
public boolean onData(int streamId, BufferedSource source, int byteCount, boolean last) throws IOException {
Intrinsics.checkNotNullParameter(source, "source");
source.skip(byteCount);
return true;
}
@Override // okhttp3.internal.http2.PushObserver
public void onReset(int streamId, ErrorCode errorCode) {
Intrinsics.checkNotNullParameter(errorCode, "errorCode");
}
}
}
}
@@ -0,0 +1,94 @@
package okhttp3.internal.http2;
import kotlin.Metadata;
import kotlin.collections.ArraysKt;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: Settings.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0006\n\u0002\u0010\u0015\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u000b\u0018\u0000 \u001b2\u00020\u0001:\u0001\u001bB\u0005¢\u0006\u0002\u0010\u0002J\u0006\u0010\f\u001a\u00020\rJ\u0011\u0010\u000e\u001a\u00020\u00042\u0006\u0010\u000f\u001a\u00020\u0004H\u0086\u0002J\u000e\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0011J\u0006\u0010\u0013\u001a\u00020\u0004J\u000e\u0010\u0014\u001a\u00020\u00042\u0006\u0010\u0012\u001a\u00020\u0004J\u000e\u0010\u0015\u001a\u00020\u00042\u0006\u0010\u0012\u001a\u00020\u0004J\u000e\u0010\u0016\u001a\u00020\u00112\u0006\u0010\u000f\u001a\u00020\u0004J\u000e\u0010\u0017\u001a\u00020\r2\u0006\u0010\u0018\u001a\u00020\u0000J\u0019\u0010\t\u001a\u00020\u00002\u0006\u0010\u000f\u001a\u00020\u00042\u0006\u0010\u0019\u001a\u00020\u0004H\u0086\u0002J\u0006\u0010\u001a\u001a\u00020\u0004R\u0011\u0010\u0003\u001a\u00020\u00048F¢\u0006\u0006\u001a\u0004\b\u0005\u0010\u0006R\u0011\u0010\u0007\u001a\u00020\u00048F¢\u0006\u0006\u001a\u0004\b\b\u0010\u0006R\u000e\u0010\t\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u000bX\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u001c"}, m238d2 = {"Lokhttp3/internal/http2/Settings;", "", "()V", "headerTableSize", "", "getHeaderTableSize", "()I", "initialWindowSize", "getInitialWindowSize", "set", "values", "", "clear", "", "get", "id", "getEnablePush", "", "defaultValue", "getMaxConcurrentStreams", "getMaxFrameSize", "getMaxHeaderListSize", "isSet", "merge", "other", "value", "size", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Settings {
public static final int COUNT = 10;
public static final int DEFAULT_INITIAL_WINDOW_SIZE = 65535;
public static final int ENABLE_PUSH = 2;
public static final int HEADER_TABLE_SIZE = 1;
public static final int INITIAL_WINDOW_SIZE = 7;
public static final int MAX_CONCURRENT_STREAMS = 4;
public static final int MAX_FRAME_SIZE = 5;
public static final int MAX_HEADER_LIST_SIZE = 6;
private int set;
private final int[] values = new int[10];
public final int getHeaderTableSize() {
if ((this.set & 2) != 0) {
return this.values[1];
}
return -1;
}
public final int getInitialWindowSize() {
if ((this.set & 128) != 0) {
return this.values[7];
}
return 65535;
}
public final void clear() {
this.set = 0;
ArraysKt.fill$default(this.values, 0, 0, 0, 6, (Object) null);
}
public final Settings set(int id, int value) {
if (id >= 0) {
int[] iArr = this.values;
if (id < iArr.length) {
int bit = 1 << id;
this.set |= bit;
iArr[id] = value;
return this;
}
}
return this;
}
public final boolean isSet(int id) {
int bit = 1 << id;
return (this.set & bit) != 0;
}
public final int get(int id) {
return this.values[id];
}
public final int size() {
return Integer.bitCount(this.set);
}
public final boolean getEnablePush(boolean defaultValue) {
return (this.set & 4) != 0 ? this.values[2] == 1 : defaultValue;
}
public final int getMaxConcurrentStreams() {
if ((this.set & 16) != 0) {
return this.values[4];
}
return Integer.MAX_VALUE;
}
public final int getMaxFrameSize(int defaultValue) {
return (this.set & 32) != 0 ? this.values[5] : defaultValue;
}
public final int getMaxHeaderListSize(int defaultValue) {
return (this.set & 64) != 0 ? this.values[6] : defaultValue;
}
public final void merge(Settings other) {
Intrinsics.checkNotNullParameter(other, "other");
for (int i = 0; i < 10; i++) {
if (other.isSet(i)) {
set(i, other.get(i));
}
}
}
}
@@ -0,0 +1,19 @@
package okhttp3.internal.http2;
import java.io.IOException;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: StreamResetException.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004R\u0010\u0010\u0002\u001a\u00020\u00038\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006\u0005"}, m238d2 = {"Lokhttp3/internal/http2/StreamResetException;", "Ljava/io/IOException;", "errorCode", "Lokhttp3/internal/http2/ErrorCode;", "(Lokhttp3/internal/http2/ErrorCode;)V", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class StreamResetException extends IOException {
public final ErrorCode errorCode;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public StreamResetException(ErrorCode errorCode) {
super("stream was reset: " + errorCode);
Intrinsics.checkNotNullParameter(errorCode, "errorCode");
this.errorCode = errorCode;
}
}
@@ -0,0 +1,136 @@
package okhttp3.internal.io;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okio.Okio;
import okio.Okio__JvmOkioKt;
import okio.Sink;
import okio.Source;
/* compiled from: FileSystem.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\bf\u0018\u0000 \u00142\u00020\u0001:\u0001\u0014J\u0010\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0005H&J\u0010\u0010\u0006\u001a\u00020\u00072\u0006\u0010\u0004\u001a\u00020\u0005H&J\u0010\u0010\b\u001a\u00020\u00072\u0006\u0010\t\u001a\u00020\u0005H&J\u0010\u0010\n\u001a\u00020\u000b2\u0006\u0010\u0004\u001a\u00020\u0005H&J\u0018\u0010\f\u001a\u00020\u00072\u0006\u0010\r\u001a\u00020\u00052\u0006\u0010\u000e\u001a\u00020\u0005H&J\u0010\u0010\u000f\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0005H&J\u0010\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0004\u001a\u00020\u0005H&J\u0010\u0010\u0012\u001a\u00020\u00132\u0006\u0010\u0004\u001a\u00020\u0005H&¨\u0006\u0015"}, m238d2 = {"Lokhttp3/internal/io/FileSystem;", "", "appendingSink", "Lokio/Sink;", "file", "Ljava/io/File;", "delete", "", "deleteContents", "directory", "exists", "", "rename", TypedValues.Transition.S_FROM, TypedValues.Transition.S_TO, "sink", "size", "", "source", "Lokio/Source;", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public interface FileSystem {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
public static final FileSystem SYSTEM = new Companion.SystemFileSystem();
Sink appendingSink(File file) throws FileNotFoundException;
void delete(File file) throws IOException;
void deleteContents(File directory) throws IOException;
boolean exists(File file);
void rename(File from, File to) throws IOException;
Sink sink(File file) throws FileNotFoundException;
long size(File file);
Source source(File file) throws FileNotFoundException;
/* compiled from: FileSystem.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001:\u0001\u0005B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0016\u0010\u0003\u001a\u00020\u00048\u0006X\u0087\u0004ø\u0001\u0000¢\u0006\u0002\n\u0000¨\u0006\u0001\u0082\u0002\u0007\n\u0005\b\u0091F0\u0001¨\u0006\u0006"}, m238d2 = {"Lokhttp3/internal/io/FileSystem$Companion;", "", "()V", "SYSTEM", "Lokhttp3/internal/io/FileSystem;", "SystemFileSystem", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
static final /* synthetic */ Companion $$INSTANCE = null;
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
/* compiled from: FileSystem.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000:\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\b\u0002\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0016J\u0010\u0010\u0007\u001a\u00020\b2\u0006\u0010\u0005\u001a\u00020\u0006H\u0016J\u0010\u0010\t\u001a\u00020\b2\u0006\u0010\n\u001a\u00020\u0006H\u0016J\u0010\u0010\u000b\u001a\u00020\f2\u0006\u0010\u0005\u001a\u00020\u0006H\u0016J\u0018\u0010\r\u001a\u00020\b2\u0006\u0010\u000e\u001a\u00020\u00062\u0006\u0010\u000f\u001a\u00020\u0006H\u0016J\u0010\u0010\u0010\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006H\u0016J\u0010\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0005\u001a\u00020\u0006H\u0016J\u0010\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0005\u001a\u00020\u0006H\u0016J\b\u0010\u0015\u001a\u00020\u0016H\u0016¨\u0006\u0017"}, m238d2 = {"Lokhttp3/internal/io/FileSystem$Companion$SystemFileSystem;", "Lokhttp3/internal/io/FileSystem;", "()V", "appendingSink", "Lokio/Sink;", "file", "Ljava/io/File;", "delete", "", "deleteContents", "directory", "exists", "", "rename", TypedValues.Transition.S_FROM, TypedValues.Transition.S_TO, "sink", "size", "", "source", "Lokio/Source;", "toString", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
private static final class SystemFileSystem implements FileSystem {
@Override // okhttp3.internal.io.FileSystem
public Source source(File file) throws FileNotFoundException {
Intrinsics.checkNotNullParameter(file, "file");
return Okio.source(file);
}
@Override // okhttp3.internal.io.FileSystem
public Sink sink(File file) throws FileNotFoundException {
Intrinsics.checkNotNullParameter(file, "file");
try {
return Okio__JvmOkioKt.sink$default(file, false, 1, null);
} catch (FileNotFoundException e) {
file.getParentFile().mkdirs();
return Okio__JvmOkioKt.sink$default(file, false, 1, null);
}
}
@Override // okhttp3.internal.io.FileSystem
public Sink appendingSink(File file) throws FileNotFoundException {
Intrinsics.checkNotNullParameter(file, "file");
try {
return Okio.appendingSink(file);
} catch (FileNotFoundException e) {
file.getParentFile().mkdirs();
return Okio.appendingSink(file);
}
}
@Override // okhttp3.internal.io.FileSystem
public void delete(File file) throws IOException {
Intrinsics.checkNotNullParameter(file, "file");
if (!file.delete() && file.exists()) {
throw new IOException("failed to delete " + file);
}
}
@Override // okhttp3.internal.io.FileSystem
public boolean exists(File file) {
Intrinsics.checkNotNullParameter(file, "file");
return file.exists();
}
@Override // okhttp3.internal.io.FileSystem
public long size(File file) {
Intrinsics.checkNotNullParameter(file, "file");
return file.length();
}
@Override // okhttp3.internal.io.FileSystem
public void rename(File from, File to) throws IOException {
Intrinsics.checkNotNullParameter(from, "from");
Intrinsics.checkNotNullParameter(to, "to");
delete(to);
if (!from.renameTo(to)) {
throw new IOException("failed to rename " + from + " to " + to);
}
}
@Override // okhttp3.internal.io.FileSystem
public void deleteContents(File directory) throws IOException {
Intrinsics.checkNotNullParameter(directory, "directory");
File[] files = directory.listFiles();
if (files == null) {
throw new IOException("not a readable directory: " + directory);
}
for (File file : files) {
Intrinsics.checkNotNullExpressionValue(file, "file");
if (file.isDirectory()) {
deleteContents(file);
}
if (!file.delete()) {
throw new IOException("failed to delete " + file);
}
}
}
public String toString() {
return "FileSystem.SYSTEM";
}
}
}
}
@@ -0,0 +1,155 @@
package okhttp3.internal.platform;
import android.os.Build;
import android.security.NetworkSecurityPolicy;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.Protocol;
import okhttp3.internal.platform.android.Android10SocketAdapter;
import okhttp3.internal.platform.android.AndroidCertificateChainCleaner;
import okhttp3.internal.platform.android.AndroidSocketAdapter;
import okhttp3.internal.platform.android.BouncyCastleSocketAdapter;
import okhttp3.internal.platform.android.ConscryptSocketAdapter;
import okhttp3.internal.platform.android.DeferredSocketAdapter;
import okhttp3.internal.platform.android.SocketAdapter;
import okhttp3.internal.tls.CertificateChainCleaner;
/* compiled from: Android10Platform.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000J\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0007\u0018\u0000 \u00172\u00020\u0001:\u0001\u0017B\u0005¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\tH\u0016J(\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\r2\b\u0010\u000e\u001a\u0004\u0018\u00010\u000f2\f\u0010\u0010\u001a\b\u0012\u0004\u0012\u00020\u00110\u0004H\u0016J\u0012\u0010\u0012\u001a\u0004\u0018\u00010\u000f2\u0006\u0010\f\u001a\u00020\rH\u0016J\u0010\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u000e\u001a\u00020\u000fH\u0017J\u0012\u0010\b\u001a\u0004\u0018\u00010\t2\u0006\u0010\u0015\u001a\u00020\u0016H\u0016R\u0014\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0018"}, m238d2 = {"Lokhttp3/internal/platform/Android10Platform;", "Lokhttp3/internal/platform/Platform;", "()V", "socketAdapters", "", "Lokhttp3/internal/platform/android/SocketAdapter;", "buildCertificateChainCleaner", "Lokhttp3/internal/tls/CertificateChainCleaner;", "trustManager", "Ljavax/net/ssl/X509TrustManager;", "configureTlsExtensions", "", "sslSocket", "Ljavax/net/ssl/SSLSocket;", "hostname", "", "protocols", "Lokhttp3/Protocol;", "getSelectedProtocol", "isCleartextTrafficPermitted", "", "sslSocketFactory", "Ljavax/net/ssl/SSLSocketFactory;", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class Android10Platform extends Platform {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private static final boolean isSupported;
private final List<SocketAdapter> socketAdapters;
public Android10Platform() {
Iterable $this$filter$iv = CollectionsKt.listOfNotNull((Object[]) new SocketAdapter[]{Android10SocketAdapter.INSTANCE.buildIfSupported(), new DeferredSocketAdapter(AndroidSocketAdapter.INSTANCE.getPlayProviderFactory()), new DeferredSocketAdapter(ConscryptSocketAdapter.INSTANCE.getFactory()), new DeferredSocketAdapter(BouncyCastleSocketAdapter.INSTANCE.getFactory())});
Collection destination$iv$iv = new ArrayList();
for (Object element$iv$iv : $this$filter$iv) {
SocketAdapter it = (SocketAdapter) element$iv$iv;
if (it.isSupported()) {
destination$iv$iv.add(element$iv$iv);
}
}
this.socketAdapters = (List) destination$iv$iv;
}
@Override // okhttp3.internal.platform.Platform
public X509TrustManager trustManager(SSLSocketFactory sslSocketFactory) {
Object obj;
Intrinsics.checkNotNullParameter(sslSocketFactory, "sslSocketFactory");
Iterator<T> it = this.socketAdapters.iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
}
obj = it.next();
SocketAdapter it2 = (SocketAdapter) obj;
if (it2.matchesSocketFactory(sslSocketFactory)) {
break;
}
}
SocketAdapter socketAdapter = (SocketAdapter) obj;
if (socketAdapter != null) {
return socketAdapter.trustManager(sslSocketFactory);
}
return null;
}
@Override // okhttp3.internal.platform.Platform
public void configureTlsExtensions(SSLSocket sslSocket, String hostname, List<? extends Protocol> protocols) {
Object obj;
Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
Intrinsics.checkNotNullParameter(protocols, "protocols");
Iterator<T> it = this.socketAdapters.iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
}
obj = it.next();
SocketAdapter it2 = (SocketAdapter) obj;
if (it2.matchesSocket(sslSocket)) {
break;
}
}
SocketAdapter socketAdapter = (SocketAdapter) obj;
if (socketAdapter != null) {
socketAdapter.configureTlsExtensions(sslSocket, hostname, protocols);
}
}
@Override // okhttp3.internal.platform.Platform
public String getSelectedProtocol(SSLSocket sslSocket) {
Object obj;
Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
Iterator<T> it = this.socketAdapters.iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
}
obj = it.next();
SocketAdapter it2 = (SocketAdapter) obj;
if (it2.matchesSocket(sslSocket)) {
break;
}
}
SocketAdapter socketAdapter = (SocketAdapter) obj;
if (socketAdapter != null) {
return socketAdapter.getSelectedProtocol(sslSocket);
}
return null;
}
@Override // okhttp3.internal.platform.Platform
public boolean isCleartextTrafficPermitted(String hostname) {
Intrinsics.checkNotNullParameter(hostname, "hostname");
return NetworkSecurityPolicy.getInstance().isCleartextTrafficPermitted(hostname);
}
@Override // okhttp3.internal.platform.Platform
public CertificateChainCleaner buildCertificateChainCleaner(X509TrustManager trustManager) {
Intrinsics.checkNotNullParameter(trustManager, "trustManager");
AndroidCertificateChainCleaner buildIfSupported = AndroidCertificateChainCleaner.INSTANCE.buildIfSupported(trustManager);
return buildIfSupported != null ? buildIfSupported : super.buildCertificateChainCleaner(trustManager);
}
/* compiled from: Android10Platform.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\b\u0010\u0006\u001a\u0004\u0018\u00010\u0007R\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0003\u0010\u0005¨\u0006\b"}, m238d2 = {"Lokhttp3/internal/platform/Android10Platform$Companion;", "", "()V", "isSupported", "", "()Z", "buildIfSupported", "Lokhttp3/internal/platform/Platform;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public final boolean isSupported() {
return Android10Platform.isSupported;
}
public final Platform buildIfSupported() {
if (isSupported()) {
return new Android10Platform();
}
return null;
}
}
static {
isSupported = Platform.INSTANCE.isAndroid() && Build.VERSION.SDK_INT >= 29;
}
}
@@ -0,0 +1,305 @@
package okhttp3.internal.platform;
import android.os.Build;
import android.security.NetworkSecurityPolicy;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.security.cert.TrustAnchor;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.Protocol;
import okhttp3.internal.platform.android.AndroidCertificateChainCleaner;
import okhttp3.internal.platform.android.AndroidSocketAdapter;
import okhttp3.internal.platform.android.BouncyCastleSocketAdapter;
import okhttp3.internal.platform.android.CloseGuard;
import okhttp3.internal.platform.android.ConscryptSocketAdapter;
import okhttp3.internal.platform.android.DeferredSocketAdapter;
import okhttp3.internal.platform.android.SocketAdapter;
import okhttp3.internal.platform.android.StandardAndroidSocketAdapter;
import okhttp3.internal.tls.CertificateChainCleaner;
import okhttp3.internal.tls.TrustRootIndex;
/* compiled from: AndroidPlatform.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000x\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0007\u0018\u0000 )2\u00020\u0001:\u0002)*B\u0005¢\u0006\u0002\u0010\u0002J\u0010\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000bH\u0016J\u0010\u0010\f\u001a\u00020\r2\u0006\u0010\n\u001a\u00020\u000bH\u0016J-\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u00112\b\u0010\u0012\u001a\u0004\u0018\u00010\u00132\u0011\u0010\u0014\u001a\r\u0012\t\u0012\u00070\u0015¢\u0006\u0002\b\u00160\u0006H\u0016J \u0010\u0017\u001a\u00020\u000f2\u0006\u0010\u0018\u001a\u00020\u00192\u0006\u0010\u001a\u001a\u00020\u001b2\u0006\u0010\u001c\u001a\u00020\u001dH\u0016J\u0012\u0010\u001e\u001a\u0004\u0018\u00010\u00132\u0006\u0010\u0010\u001a\u00020\u0011H\u0016J\u0012\u0010\u001f\u001a\u0004\u0018\u00010 2\u0006\u0010!\u001a\u00020\u0013H\u0016J\u0010\u0010\"\u001a\u00020#2\u0006\u0010\u0012\u001a\u00020\u0013H\u0016J\u001a\u0010$\u001a\u00020\u000f2\u0006\u0010%\u001a\u00020\u00132\b\u0010&\u001a\u0004\u0018\u00010 H\u0016J\u0012\u0010\n\u001a\u0004\u0018\u00010\u000b2\u0006\u0010'\u001a\u00020(H\u0016R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0005\u001a\b\u0012\u0004\u0012\u00020\u00070\u0006X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006+"}, m238d2 = {"Lokhttp3/internal/platform/AndroidPlatform;", "Lokhttp3/internal/platform/Platform;", "()V", "closeGuard", "Lokhttp3/internal/platform/android/CloseGuard;", "socketAdapters", "", "Lokhttp3/internal/platform/android/SocketAdapter;", "buildCertificateChainCleaner", "Lokhttp3/internal/tls/CertificateChainCleaner;", "trustManager", "Ljavax/net/ssl/X509TrustManager;", "buildTrustRootIndex", "Lokhttp3/internal/tls/TrustRootIndex;", "configureTlsExtensions", "", "sslSocket", "Ljavax/net/ssl/SSLSocket;", "hostname", "", "protocols", "Lokhttp3/Protocol;", "Lkotlin/jvm/JvmSuppressWildcards;", "connectSocket", "socket", "Ljava/net/Socket;", "address", "Ljava/net/InetSocketAddress;", "connectTimeout", "", "getSelectedProtocol", "getStackTraceForCloseable", "", "closer", "isCleartextTrafficPermitted", "", "logCloseableLeak", "message", "stackTrace", "sslSocketFactory", "Ljavax/net/ssl/SSLSocketFactory;", "Companion", "CustomTrustRootIndex", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class AndroidPlatform extends Platform {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private static final boolean isSupported;
private final CloseGuard closeGuard;
private final List<SocketAdapter> socketAdapters;
public AndroidPlatform() {
Iterable $this$filter$iv = CollectionsKt.listOfNotNull((Object[]) new SocketAdapter[]{StandardAndroidSocketAdapter.Companion.buildIfSupported$default(StandardAndroidSocketAdapter.INSTANCE, null, 1, null), new DeferredSocketAdapter(AndroidSocketAdapter.INSTANCE.getPlayProviderFactory()), new DeferredSocketAdapter(ConscryptSocketAdapter.INSTANCE.getFactory()), new DeferredSocketAdapter(BouncyCastleSocketAdapter.INSTANCE.getFactory())});
Collection destination$iv$iv = new ArrayList();
for (Object element$iv$iv : $this$filter$iv) {
SocketAdapter it = (SocketAdapter) element$iv$iv;
if (it.isSupported()) {
destination$iv$iv.add(element$iv$iv);
}
}
this.socketAdapters = (List) destination$iv$iv;
this.closeGuard = CloseGuard.INSTANCE.get();
}
@Override // okhttp3.internal.platform.Platform
public void connectSocket(Socket socket, InetSocketAddress address, int connectTimeout) throws IOException {
Intrinsics.checkNotNullParameter(socket, "socket");
Intrinsics.checkNotNullParameter(address, "address");
try {
socket.connect(address, connectTimeout);
} catch (ClassCastException e) {
if (Build.VERSION.SDK_INT == 26) {
throw new IOException("Exception in connect", e);
}
throw e;
}
}
@Override // okhttp3.internal.platform.Platform
public X509TrustManager trustManager(SSLSocketFactory sslSocketFactory) {
Object obj;
Intrinsics.checkNotNullParameter(sslSocketFactory, "sslSocketFactory");
Iterator<T> it = this.socketAdapters.iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
}
obj = it.next();
SocketAdapter it2 = (SocketAdapter) obj;
if (it2.matchesSocketFactory(sslSocketFactory)) {
break;
}
}
SocketAdapter socketAdapter = (SocketAdapter) obj;
if (socketAdapter != null) {
return socketAdapter.trustManager(sslSocketFactory);
}
return null;
}
@Override // okhttp3.internal.platform.Platform
public void configureTlsExtensions(SSLSocket sslSocket, String hostname, List<Protocol> protocols) {
Object obj;
Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
Intrinsics.checkNotNullParameter(protocols, "protocols");
Iterator<T> it = this.socketAdapters.iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
}
obj = it.next();
SocketAdapter it2 = (SocketAdapter) obj;
if (it2.matchesSocket(sslSocket)) {
break;
}
}
SocketAdapter socketAdapter = (SocketAdapter) obj;
if (socketAdapter != null) {
socketAdapter.configureTlsExtensions(sslSocket, hostname, protocols);
}
}
@Override // okhttp3.internal.platform.Platform
public String getSelectedProtocol(SSLSocket sslSocket) {
Object obj;
Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
Iterator<T> it = this.socketAdapters.iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
}
obj = it.next();
SocketAdapter it2 = (SocketAdapter) obj;
if (it2.matchesSocket(sslSocket)) {
break;
}
}
SocketAdapter socketAdapter = (SocketAdapter) obj;
if (socketAdapter != null) {
return socketAdapter.getSelectedProtocol(sslSocket);
}
return null;
}
@Override // okhttp3.internal.platform.Platform
public Object getStackTraceForCloseable(String closer) {
Intrinsics.checkNotNullParameter(closer, "closer");
return this.closeGuard.createAndOpen(closer);
}
@Override // okhttp3.internal.platform.Platform
public void logCloseableLeak(String message, Object stackTrace) {
Intrinsics.checkNotNullParameter(message, "message");
boolean reported = this.closeGuard.warnIfOpen(stackTrace);
if (!reported) {
Platform.log$default(this, message, 5, null, 4, null);
}
}
@Override // okhttp3.internal.platform.Platform
public boolean isCleartextTrafficPermitted(String hostname) {
Intrinsics.checkNotNullParameter(hostname, "hostname");
if (Build.VERSION.SDK_INT >= 24) {
return NetworkSecurityPolicy.getInstance().isCleartextTrafficPermitted(hostname);
}
if (Build.VERSION.SDK_INT < 23) {
return true;
}
NetworkSecurityPolicy networkSecurityPolicy = NetworkSecurityPolicy.getInstance();
Intrinsics.checkNotNullExpressionValue(networkSecurityPolicy, "NetworkSecurityPolicy.getInstance()");
return networkSecurityPolicy.isCleartextTrafficPermitted();
}
@Override // okhttp3.internal.platform.Platform
public CertificateChainCleaner buildCertificateChainCleaner(X509TrustManager trustManager) {
Intrinsics.checkNotNullParameter(trustManager, "trustManager");
AndroidCertificateChainCleaner buildIfSupported = AndroidCertificateChainCleaner.INSTANCE.buildIfSupported(trustManager);
return buildIfSupported != null ? buildIfSupported : super.buildCertificateChainCleaner(trustManager);
}
@Override // okhttp3.internal.platform.Platform
public TrustRootIndex buildTrustRootIndex(X509TrustManager trustManager) {
Intrinsics.checkNotNullParameter(trustManager, "trustManager");
try {
Method method = trustManager.getClass().getDeclaredMethod("findTrustAnchorByIssuerAndSignature", X509Certificate.class);
Intrinsics.checkNotNullExpressionValue(method, "method");
method.setAccessible(true);
return new CustomTrustRootIndex(trustManager, method);
} catch (NoSuchMethodException e) {
return super.buildTrustRootIndex(trustManager);
}
}
/* compiled from: AndroidPlatform.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0000\b\u0080\b\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0002\u0010\u0006J\t\u0010\u0007\u001a\u00020\u0003HÂ\u0003J\t\u0010\b\u001a\u00020\u0005HÂ\u0003J\u001d\u0010\t\u001a\u00020\u00002\b\b\u0002\u0010\u0002\u001a\u00020\u00032\b\b\u0002\u0010\u0004\u001a\u00020\u0005HÆ\u0001J\u0013\u0010\n\u001a\u00020\u000b2\b\u0010\f\u001a\u0004\u0018\u00010\rHÖ\u0003J\u0012\u0010\u000e\u001a\u0004\u0018\u00010\u000f2\u0006\u0010\u0010\u001a\u00020\u000fH\u0016J\t\u0010\u0011\u001a\u00020\u0012HÖ\u0001J\t\u0010\u0013\u001a\u00020\u0014HÖ\u0001R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0015"}, m238d2 = {"Lokhttp3/internal/platform/AndroidPlatform$CustomTrustRootIndex;", "Lokhttp3/internal/tls/TrustRootIndex;", "trustManager", "Ljavax/net/ssl/X509TrustManager;", "findByIssuerAndSignatureMethod", "Ljava/lang/reflect/Method;", "(Ljavax/net/ssl/X509TrustManager;Ljava/lang/reflect/Method;)V", "component1", "component2", "copy", "equals", "", "other", "", "findByIssuerAndSignature", "Ljava/security/cert/X509Certificate;", "cert", "hashCode", "", "toString", "", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final /* data */ class CustomTrustRootIndex implements TrustRootIndex {
private final Method findByIssuerAndSignatureMethod;
private final X509TrustManager trustManager;
/* renamed from: component1, reason: from getter */
private final X509TrustManager getTrustManager() {
return this.trustManager;
}
/* renamed from: component2, reason: from getter */
private final Method getFindByIssuerAndSignatureMethod() {
return this.findByIssuerAndSignatureMethod;
}
public static /* synthetic */ CustomTrustRootIndex copy$default(CustomTrustRootIndex customTrustRootIndex, X509TrustManager x509TrustManager, Method method, int i, Object obj) {
if ((i & 1) != 0) {
x509TrustManager = customTrustRootIndex.trustManager;
}
if ((i & 2) != 0) {
method = customTrustRootIndex.findByIssuerAndSignatureMethod;
}
return customTrustRootIndex.copy(x509TrustManager, method);
}
public final CustomTrustRootIndex copy(X509TrustManager trustManager, Method findByIssuerAndSignatureMethod) {
Intrinsics.checkNotNullParameter(trustManager, "trustManager");
Intrinsics.checkNotNullParameter(findByIssuerAndSignatureMethod, "findByIssuerAndSignatureMethod");
return new CustomTrustRootIndex(trustManager, findByIssuerAndSignatureMethod);
}
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof CustomTrustRootIndex)) {
return false;
}
CustomTrustRootIndex customTrustRootIndex = (CustomTrustRootIndex) other;
return Intrinsics.areEqual(this.trustManager, customTrustRootIndex.trustManager) && Intrinsics.areEqual(this.findByIssuerAndSignatureMethod, customTrustRootIndex.findByIssuerAndSignatureMethod);
}
public int hashCode() {
X509TrustManager x509TrustManager = this.trustManager;
int hashCode = (x509TrustManager != null ? x509TrustManager.hashCode() : 0) * 31;
Method method = this.findByIssuerAndSignatureMethod;
return hashCode + (method != null ? method.hashCode() : 0);
}
public String toString() {
return "CustomTrustRootIndex(trustManager=" + this.trustManager + ", findByIssuerAndSignatureMethod=" + this.findByIssuerAndSignatureMethod + ")";
}
public CustomTrustRootIndex(X509TrustManager trustManager, Method findByIssuerAndSignatureMethod) {
Intrinsics.checkNotNullParameter(trustManager, "trustManager");
Intrinsics.checkNotNullParameter(findByIssuerAndSignatureMethod, "findByIssuerAndSignatureMethod");
this.trustManager = trustManager;
this.findByIssuerAndSignatureMethod = findByIssuerAndSignatureMethod;
}
@Override // okhttp3.internal.tls.TrustRootIndex
public X509Certificate findByIssuerAndSignature(X509Certificate cert) {
Intrinsics.checkNotNullParameter(cert, "cert");
try {
Object invoke = this.findByIssuerAndSignatureMethod.invoke(this.trustManager, cert);
if (invoke == null) {
throw new NullPointerException("null cannot be cast to non-null type java.security.cert.TrustAnchor");
}
TrustAnchor trustAnchor = (TrustAnchor) invoke;
return trustAnchor.getTrustedCert();
} catch (IllegalAccessException e) {
throw new AssertionError("unable to get issues and signature", e);
} catch (InvocationTargetException e2) {
return null;
}
}
}
/* compiled from: AndroidPlatform.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\b\u0010\u0006\u001a\u0004\u0018\u00010\u0007R\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0003\u0010\u0005¨\u0006\b"}, m238d2 = {"Lokhttp3/internal/platform/AndroidPlatform$Companion;", "", "()V", "isSupported", "", "()Z", "buildIfSupported", "Lokhttp3/internal/platform/Platform;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public final boolean isSupported() {
return AndroidPlatform.isSupported;
}
public final Platform buildIfSupported() {
if (isSupported()) {
return new AndroidPlatform();
}
return null;
}
}
static {
boolean z = true;
if (!Platform.INSTANCE.isAndroid()) {
z = false;
} else if (Build.VERSION.SDK_INT >= 30) {
z = false;
} else {
if (!(Build.VERSION.SDK_INT >= 21)) {
throw new IllegalStateException(("Expected Android API level 21+ but was " + Build.VERSION.SDK_INT).toString());
}
}
isSupported = z;
}
}
@@ -0,0 +1,150 @@
package okhttp3.internal.platform;
import java.security.KeyStore;
import java.security.Provider;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.Protocol;
import org.bouncycastle.jsse.BCSSLParameters;
import org.bouncycastle.jsse.BCSSLSocket;
import org.bouncycastle.jsse.provider.BouncyCastleJsseProvider;
/* compiled from: BouncyCastlePlatform.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000J\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0018\u0000 \u00172\u00020\u0001:\u0001\u0017B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J-\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\b2\b\u0010\t\u001a\u0004\u0018\u00010\n2\u0011\u0010\u000b\u001a\r\u0012\t\u0012\u00070\\u0006\u0002\b\u000e0\fH\u0016J\u0012\u0010\u000f\u001a\u0004\u0018\u00010\n2\u0006\u0010\u0007\u001a\u00020\bH\u0016J\b\u0010\u0010\u001a\u00020\u0011H\u0016J\b\u0010\u0012\u001a\u00020\u0013H\u0016J\u0012\u0010\u0014\u001a\u0004\u0018\u00010\u00132\u0006\u0010\u0015\u001a\u00020\u0016H\u0016R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0018"}, m238d2 = {"Lokhttp3/internal/platform/BouncyCastlePlatform;", "Lokhttp3/internal/platform/Platform;", "()V", "provider", "Ljava/security/Provider;", "configureTlsExtensions", "", "sslSocket", "Ljavax/net/ssl/SSLSocket;", "hostname", "", "protocols", "", "Lokhttp3/Protocol;", "Lkotlin/jvm/JvmSuppressWildcards;", "getSelectedProtocol", "newSSLContext", "Ljavax/net/ssl/SSLContext;", "platformTrustManager", "Ljavax/net/ssl/X509TrustManager;", "trustManager", "sslSocketFactory", "Ljavax/net/ssl/SSLSocketFactory;", "Companion", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
/* loaded from: classes11.dex */
public final class BouncyCastlePlatform extends Platform {
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE;
private static final boolean isSupported;
private final Provider provider;
private BouncyCastlePlatform() {
this.provider = new BouncyCastleJsseProvider();
}
public /* synthetic */ BouncyCastlePlatform(DefaultConstructorMarker $constructor_marker) {
this();
}
@Override // okhttp3.internal.platform.Platform
public SSLContext newSSLContext() {
SSLContext sSLContext = SSLContext.getInstance("TLS", this.provider);
Intrinsics.checkNotNullExpressionValue(sSLContext, "SSLContext.getInstance(\"TLS\", provider)");
return sSLContext;
}
@Override // okhttp3.internal.platform.Platform
public X509TrustManager platformTrustManager() {
TrustManagerFactory factory = TrustManagerFactory.getInstance("PKIX", "BCJSSE");
factory.init((KeyStore) null);
Intrinsics.checkNotNullExpressionValue(factory, "factory");
TrustManager[] trustManagers = factory.getTrustManagers();
Intrinsics.checkNotNull(trustManagers);
if (!(trustManagers.length == 1 && (trustManagers[0] instanceof X509TrustManager))) {
StringBuilder sb = new StringBuilder();
sb.append("Unexpected default trust managers: ");
String arrays = Arrays.toString(trustManagers);
Intrinsics.checkNotNullExpressionValue(arrays, "java.util.Arrays.toString(this)");
sb.append(arrays);
throw new IllegalStateException(sb.toString().toString());
}
TrustManager trustManager = trustManagers[0];
if (trustManager != null) {
return (X509TrustManager) trustManager;
}
throw new NullPointerException("null cannot be cast to non-null type javax.net.ssl.X509TrustManager");
}
@Override // okhttp3.internal.platform.Platform
public X509TrustManager trustManager(SSLSocketFactory sslSocketFactory) {
Intrinsics.checkNotNullParameter(sslSocketFactory, "sslSocketFactory");
throw new UnsupportedOperationException("clientBuilder.sslSocketFactory(SSLSocketFactory) not supported with BouncyCastle");
}
@Override // okhttp3.internal.platform.Platform
public void configureTlsExtensions(SSLSocket sslSocket, String hostname, List<Protocol> protocols) {
Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
Intrinsics.checkNotNullParameter(protocols, "protocols");
if (sslSocket instanceof BCSSLSocket) {
BCSSLParameters sslParameters = ((BCSSLSocket) sslSocket).getParameters();
Collection names = Platform.INSTANCE.alpnProtocolNames(protocols);
Intrinsics.checkNotNullExpressionValue(sslParameters, "sslParameters");
Collection $this$toTypedArray$iv = names;
Object[] array = $this$toTypedArray$iv.toArray(new String[0]);
if (array != null) {
sslParameters.setApplicationProtocols((String[]) array);
((BCSSLSocket) sslSocket).setParameters(sslParameters);
return;
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
}
super.configureTlsExtensions(sslSocket, hostname, protocols);
}
@Override // okhttp3.internal.platform.Platform
public String getSelectedProtocol(SSLSocket sslSocket) {
Intrinsics.checkNotNullParameter(sslSocket, "sslSocket");
if (sslSocket instanceof BCSSLSocket) {
String protocol = ((BCSSLSocket) sslSocket).getApplicationProtocol();
if (protocol != null) {
switch (protocol.hashCode()) {
case 0:
if (!protocol.equals("")) {
return protocol;
}
break;
default:
return protocol;
}
}
return null;
}
return super.getSelectedProtocol(sslSocket);
}
/* compiled from: BouncyCastlePlatform.kt */
@Metadata(m236bv = {1, 0, 3}, m237d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\b\u0010\u0006\u001a\u0004\u0018\u00010\u0007R\u0011\u0010\u0003\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0003\u0010\u0005¨\u0006\b"}, m238d2 = {"Lokhttp3/internal/platform/BouncyCastlePlatform$Companion;", "", "()V", "isSupported", "", "()Z", "buildIfSupported", "Lokhttp3/internal/platform/BouncyCastlePlatform;", "okhttp"}, m239k = 1, m240mv = {1, 4, 0})
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker $constructor_marker) {
this();
}
public final boolean isSupported() {
return BouncyCastlePlatform.isSupported;
}
public final BouncyCastlePlatform buildIfSupported() {
DefaultConstructorMarker defaultConstructorMarker = null;
if (isSupported()) {
return new BouncyCastlePlatform(defaultConstructorMarker);
}
return null;
}
}
static {
Companion companion = new Companion(null);
INSTANCE = companion;
boolean z = false;
try {
Class.forName("org.bouncycastle.jsse.provider.BouncyCastleJsseProvider", false, companion.getClass().getClassLoader());
z = true;
} catch (ClassNotFoundException e) {
}
isSupported = z;
}
}

Some files were not shown because too many files have changed in this diff Show More