discord-jadx/app/src/main/java/f0/x.java

450 lines
16 KiB
Java
Raw Normal View History

2021-06-27 20:44:35 +00:00
package f0;
import d0.t.r;
import d0.t.u;
import d0.z.d.m;
import f0.e;
import f0.f0.c;
import f0.f0.g.l;
import f0.f0.k.h;
import f0.f0.m.d;
import f0.t;
import f0.z;
import java.net.ProtocolException;
import java.net.Proxy;
import java.net.ProxySelector;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import javax.net.SocketFactory;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;
import kotlin.TypeCastException;
import kotlin.jvm.internal.DefaultConstructorMarker;
import okhttp3.Interceptor;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
/* compiled from: OkHttpClient.kt */
public class x implements Cloneable, e.a {
public static final List<y> i = c.m(y.HTTP_2, y.HTTP_1_1);
2021-07-03 23:36:06 +00:00
public static final List<m> j = c.m(m.f2754c, m.d);
2021-06-27 20:44:35 +00:00
public static final b k = new b(null);
public final SSLSocketFactory A;
public final X509TrustManager B;
public final List<m> C;
public final List<y> D;
public final HostnameVerifier E;
public final g F;
public final f0.f0.m.c G;
public final int H;
public final int I;
public final int J;
public final int K;
public final int L;
public final long M;
public final l N;
public final q l;
public final l m;
public final List<Interceptor> n;
public final List<Interceptor> o;
public final t.b p;
public final boolean q;
public final c r;
/* renamed from: s reason: collision with root package name */
2021-07-03 23:36:06 +00:00
public final boolean f2763s;
2021-06-27 20:44:35 +00:00
public final boolean t;
public final p u;
public final s v;
public final Proxy w;
/* renamed from: x reason: collision with root package name */
2021-07-03 23:36:06 +00:00
public final ProxySelector f2764x;
2021-06-27 20:44:35 +00:00
/* renamed from: y reason: collision with root package name */
2021-07-03 23:36:06 +00:00
public final c f2765y;
2021-06-27 20:44:35 +00:00
/* renamed from: z reason: collision with root package name */
2021-07-03 23:36:06 +00:00
public final SocketFactory f2766z;
2021-06-27 20:44:35 +00:00
/* compiled from: OkHttpClient.kt */
public static final class a {
public int A;
public long B;
public l C;
public q a = new q();
public l b = new l();
/* renamed from: c reason: collision with root package name */
2021-07-03 23:36:06 +00:00
public final List<Interceptor> f2767c = new ArrayList();
2021-06-27 20:44:35 +00:00
public final List<Interceptor> d = new ArrayList();
public t.b e;
public boolean f;
public c g;
public boolean h;
public boolean i;
public p j;
public s k;
public Proxy l;
public ProxySelector m;
public c n;
public SocketFactory o;
public SSLSocketFactory p;
public X509TrustManager q;
public List<m> r;
/* renamed from: s reason: collision with root package name */
2021-07-03 23:36:06 +00:00
public List<? extends y> f2768s;
2021-06-27 20:44:35 +00:00
public HostnameVerifier t;
public g u;
public f0.f0.m.c v;
public int w;
/* renamed from: x reason: collision with root package name */
2021-07-03 23:36:06 +00:00
public int f2769x;
2021-06-27 20:44:35 +00:00
/* renamed from: y reason: collision with root package name */
2021-07-03 23:36:06 +00:00
public int f2770y;
2021-06-27 20:44:35 +00:00
/* renamed from: z reason: collision with root package name */
2021-07-03 23:36:06 +00:00
public int f2771z;
2021-06-27 20:44:35 +00:00
public a() {
t tVar = t.a;
m.checkParameterIsNotNull(tVar, "$this$asFactory");
this.e = new f0.f0.a(tVar);
this.f = true;
c cVar = c.a;
this.g = cVar;
this.h = true;
this.i = true;
this.j = p.a;
this.k = s.a;
this.n = cVar;
SocketFactory socketFactory = SocketFactory.getDefault();
m.checkExpressionValueIsNotNull(socketFactory, "SocketFactory.getDefault()");
this.o = socketFactory;
b bVar = x.k;
this.r = x.j;
2021-07-03 23:36:06 +00:00
this.f2768s = x.i;
2021-06-27 20:44:35 +00:00
this.t = d.a;
this.u = g.a;
2021-07-03 23:36:06 +00:00
this.f2769x = 10000;
this.f2770y = 10000;
this.f2771z = 10000;
2021-06-27 20:44:35 +00:00
this.B = 1024;
}
public final a a(long j, TimeUnit timeUnit) {
m.checkParameterIsNotNull(timeUnit, "unit");
2021-07-03 23:36:06 +00:00
this.f2770y = c.b("timeout", j, timeUnit);
2021-06-27 20:44:35 +00:00
return this;
}
public final a b(SSLSocketFactory sSLSocketFactory, X509TrustManager x509TrustManager) {
m.checkParameterIsNotNull(sSLSocketFactory, "sslSocketFactory");
m.checkParameterIsNotNull(x509TrustManager, "trustManager");
if ((!m.areEqual(sSLSocketFactory, this.p)) || (!m.areEqual(x509TrustManager, this.q))) {
this.C = null;
}
this.p = sSLSocketFactory;
m.checkParameterIsNotNull(x509TrustManager, "trustManager");
2021-07-03 23:36:06 +00:00
h.a aVar = h.f2736c;
2021-06-27 20:44:35 +00:00
this.v = h.a.b(x509TrustManager);
this.q = x509TrustManager;
return this;
}
}
/* compiled from: OkHttpClient.kt */
public static final class b {
public b(DefaultConstructorMarker defaultConstructorMarker) {
}
}
public x() {
this(new a());
}
/* JADX DEBUG: Type inference failed for r1v0. Raw type applied. Possible types: java.util.List<? extends f0.y>, java.util.List<f0.y> */
/* JADX WARNING: Removed duplicated region for block: B:110:0x0211 */
/* JADX WARNING: Removed duplicated region for block: B:24:0x00b3 */
/* JADX WARNING: Removed duplicated region for block: B:25:0x00be */
/* JADX WARNING: Removed duplicated region for block: B:49:0x0120 */
public x(a aVar) {
ProxySelector proxySelector;
boolean z2;
List<Interceptor> list;
boolean z3;
m.checkParameterIsNotNull(aVar, "builder");
this.l = aVar.a;
this.m = aVar.b;
2021-07-03 23:36:06 +00:00
this.n = c.z(aVar.f2767c);
2021-06-27 20:44:35 +00:00
this.o = c.z(aVar.d);
this.p = aVar.e;
this.q = aVar.f;
this.r = aVar.g;
2021-07-03 23:36:06 +00:00
this.f2763s = aVar.h;
2021-06-27 20:44:35 +00:00
this.t = aVar.i;
this.u = aVar.j;
this.v = aVar.k;
Proxy proxy = aVar.l;
this.w = proxy;
if (proxy != null) {
proxySelector = f0.f0.l.a.a;
} else {
proxySelector = aVar.m;
proxySelector = proxySelector == null ? ProxySelector.getDefault() : proxySelector;
if (proxySelector == null) {
proxySelector = f0.f0.l.a.a;
}
}
2021-07-03 23:36:06 +00:00
this.f2764x = proxySelector;
this.f2765y = aVar.n;
this.f2766z = aVar.o;
2021-06-27 20:44:35 +00:00
List<m> list2 = aVar.r;
this.C = list2;
2021-07-03 23:36:06 +00:00
this.D = aVar.f2768s;
2021-06-27 20:44:35 +00:00
this.E = aVar.t;
this.H = aVar.w;
2021-07-03 23:36:06 +00:00
this.I = aVar.f2769x;
this.J = aVar.f2770y;
this.K = aVar.f2771z;
2021-06-27 20:44:35 +00:00
this.L = aVar.A;
this.M = aVar.B;
l lVar = aVar.C;
this.N = lVar == null ? new l() : lVar;
boolean z4 = false;
if (!(list2 instanceof Collection) || !list2.isEmpty()) {
Iterator<T> it = list2.iterator();
while (true) {
if (it.hasNext()) {
if (((m) it.next()).e) {
z2 = false;
break;
}
} else {
break;
}
}
if (!z2) {
this.A = null;
this.G = null;
this.B = null;
this.F = g.a;
} else {
SSLSocketFactory sSLSocketFactory = aVar.p;
if (sSLSocketFactory != null) {
this.A = sSLSocketFactory;
f0.f0.m.c cVar = aVar.v;
if (cVar == null) {
m.throwNpe();
}
this.G = cVar;
X509TrustManager x509TrustManager = aVar.q;
if (x509TrustManager == null) {
m.throwNpe();
}
this.B = x509TrustManager;
g gVar = aVar.u;
if (cVar == null) {
m.throwNpe();
}
this.F = gVar.b(cVar);
} else {
2021-07-03 23:36:06 +00:00
h.a aVar2 = h.f2736c;
2021-06-27 20:44:35 +00:00
X509TrustManager n = h.a.n();
this.B = n;
h hVar = h.a;
if (n == null) {
m.throwNpe();
}
this.A = hVar.m(n);
if (n == null) {
m.throwNpe();
}
m.checkParameterIsNotNull(n, "trustManager");
f0.f0.m.c b2 = h.a.b(n);
this.G = b2;
g gVar2 = aVar.u;
if (b2 == null) {
m.throwNpe();
}
this.F = gVar2.b(b2);
}
}
list = this.n;
if (list != null) {
throw new TypeCastException("null cannot be cast to non-null type kotlin.collections.List<okhttp3.Interceptor?>");
} else if (!list.contains(null)) {
List<Interceptor> list3 = this.o;
if (list3 == null) {
throw new TypeCastException("null cannot be cast to non-null type kotlin.collections.List<okhttp3.Interceptor?>");
} else if (!list3.contains(null)) {
List<m> list4 = this.C;
if (!(list4 instanceof Collection) || !list4.isEmpty()) {
Iterator<T> it2 = list4.iterator();
while (true) {
if (it2.hasNext()) {
if (((m) it2.next()).e) {
z3 = false;
break;
}
} else {
break;
}
}
}
z3 = true;
if (z3) {
if (this.A == null) {
if (this.G == null) {
if (!(this.B == null ? true : z4)) {
throw new IllegalStateException("Check failed.".toString());
} else if (!m.areEqual(this.F, g.a)) {
throw new IllegalStateException("Check failed.".toString());
} else {
return;
}
} else {
throw new IllegalStateException("Check failed.".toString());
}
} else {
throw new IllegalStateException("Check failed.".toString());
}
} else if (this.A == null) {
throw new IllegalStateException("sslSocketFactory == null".toString());
} else if (this.G == null) {
throw new IllegalStateException("certificateChainCleaner == null".toString());
} else if (this.B == null) {
throw new IllegalStateException("x509TrustManager == null".toString());
} else {
return;
}
} else {
StringBuilder L = c.d.b.a.a.L("Null network interceptor: ");
L.append(this.o);
throw new IllegalStateException(L.toString().toString());
}
} else {
StringBuilder L2 = c.d.b.a.a.L("Null interceptor: ");
L2.append(this.n);
throw new IllegalStateException(L2.toString().toString());
}
}
z2 = true;
if (!z2) {
}
list = this.n;
if (list != null) {
}
}
@Override // f0.e.a
public e b(z zVar) {
m.checkParameterIsNotNull(zVar, "request");
return new f0.f0.g.e(this, zVar, false);
}
@Override // java.lang.Object
public Object clone() {
return super.clone();
}
public a f() {
m.checkParameterIsNotNull(this, "okHttpClient");
a aVar = new a();
aVar.a = this.l;
aVar.b = this.m;
2021-07-03 23:36:06 +00:00
r.addAll(aVar.f2767c, this.n);
2021-06-27 20:44:35 +00:00
r.addAll(aVar.d, this.o);
aVar.e = this.p;
aVar.f = this.q;
aVar.g = this.r;
2021-07-03 23:36:06 +00:00
aVar.h = this.f2763s;
2021-06-27 20:44:35 +00:00
aVar.i = this.t;
aVar.j = this.u;
aVar.k = this.v;
aVar.l = this.w;
2021-07-03 23:36:06 +00:00
aVar.m = this.f2764x;
aVar.n = this.f2765y;
aVar.o = this.f2766z;
2021-06-27 20:44:35 +00:00
aVar.p = this.A;
aVar.q = this.B;
aVar.r = this.C;
2021-07-03 23:36:06 +00:00
aVar.f2768s = this.D;
2021-06-27 20:44:35 +00:00
aVar.t = this.E;
aVar.u = this.F;
aVar.v = this.G;
aVar.w = this.H;
2021-07-03 23:36:06 +00:00
aVar.f2769x = this.I;
aVar.f2770y = this.J;
aVar.f2771z = this.K;
2021-06-27 20:44:35 +00:00
aVar.A = this.L;
aVar.B = this.M;
aVar.C = this.N;
return aVar;
}
public WebSocket g(z zVar, WebSocketListener webSocketListener) {
m.checkParameterIsNotNull(zVar, "request");
m.checkParameterIsNotNull(webSocketListener, "listener");
f0.f0.n.d dVar = new f0.f0.n.d(f0.f0.f.d.a, zVar, webSocketListener, new Random(), (long) this.L, null, this.M);
m.checkParameterIsNotNull(this, "client");
if (dVar.u.b("Sec-WebSocket-Extensions") != null) {
dVar.i(new ProtocolException("Request header not permitted: 'Sec-WebSocket-Extensions'"), null);
} else {
a f = f();
t tVar = t.a;
m.checkParameterIsNotNull(tVar, "eventListener");
byte[] bArr = c.a;
m.checkParameterIsNotNull(tVar, "$this$asFactory");
f.e = new f0.f0.a(tVar);
List<y> list = f0.f0.n.d.a;
m.checkParameterIsNotNull(list, "protocols");
List mutableList = u.toMutableList((Collection) list);
y yVar = y.H2_PRIOR_KNOWLEDGE;
boolean z2 = false;
if (mutableList.contains(yVar) || mutableList.contains(y.HTTP_1_1)) {
if (!mutableList.contains(yVar) || mutableList.size() <= 1) {
z2 = true;
}
if (!z2) {
throw new IllegalArgumentException(("protocols containing h2_prior_knowledge cannot use other protocols: " + mutableList).toString());
} else if (!(!mutableList.contains(y.HTTP_1_0))) {
throw new IllegalArgumentException(("protocols must not contain http/1.0: " + mutableList).toString());
} else if (!mutableList.contains(null)) {
mutableList.remove(y.SPDY_3);
2021-07-03 23:36:06 +00:00
if (!m.areEqual(mutableList, f.f2768s)) {
2021-06-27 20:44:35 +00:00
f.C = null;
}
List<? extends y> unmodifiableList = Collections.unmodifiableList(mutableList);
m.checkExpressionValueIsNotNull(unmodifiableList, "Collections.unmodifiableList(protocolsCopy)");
2021-07-03 23:36:06 +00:00
f.f2768s = unmodifiableList;
2021-06-27 20:44:35 +00:00
x xVar = new x(f);
z.a aVar = new z.a(dVar.u);
aVar.b("Upgrade", "websocket");
aVar.b("Connection", "Upgrade");
aVar.b("Sec-WebSocket-Key", dVar.b);
aVar.b("Sec-WebSocket-Version", "13");
aVar.b("Sec-WebSocket-Extensions", "permessage-deflate");
z a2 = aVar.a();
f0.f0.g.e eVar = new f0.f0.g.e(xVar, a2, true);
2021-07-03 23:36:06 +00:00
dVar.f2740c = eVar;
2021-06-27 20:44:35 +00:00
eVar.e(new f0.f0.n.e(dVar, a2));
} else {
throw new IllegalArgumentException("protocols must not contain null".toString());
}
} else {
throw new IllegalArgumentException(("protocols must contain h2_prior_knowledge or http/1.1: " + mutableList).toString());
}
}
return dVar;
}
}