what-the-bank/sources/com/facetec/sdk/lu.java

165 lines
5.0 KiB
Java

package com.facetec.sdk;
import com.facetec.sdk.jv;
import com.facetec.sdk.kb;
import com.facetec.sdk.kh;
import com.google.common.net.HttpHeaders;
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 okhttp3.internal.http2.Header;
/* loaded from: classes.dex */
public final class lu implements lh {
private static final List<String> c = km.d("connection", "host", "keep-alive", "proxy-connection", "te", "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> e = km.d("connection", "host", "keep-alive", "proxy-connection", "te", "transfer-encoding", "encoding", "upgrade");
final ky a;
private final kb.c b;
private final lw d;
private final kd f;
private ls h;
public lu(ka kaVar, kb.c cVar, ky kyVar, lw lwVar) {
kd kdVar;
this.b = cVar;
this.a = kyVar;
this.d = lwVar;
if (kaVar.m().contains(kd.H2_PRIOR_KNOWLEDGE)) {
kdVar = kd.H2_PRIOR_KNOWLEDGE;
} else {
kdVar = kd.HTTP_2;
}
this.f = kdVar;
}
@Override // com.facetec.sdk.lh
public final nj b(ke keVar, long j) {
return this.h.d();
}
@Override // com.facetec.sdk.lh
public final void b(ke keVar) throws IOException {
if (this.h != null) {
return;
}
boolean z = keVar.e() != null;
jv b = keVar.b();
ArrayList arrayList = new ArrayList(b.c() + 4);
arrayList.add(new ln(ln.a, keVar.c()));
arrayList.add(new ln(ln.c, lk.e(keVar.a())));
String c2 = keVar.c(HttpHeaders.HOST);
if (c2 != null) {
arrayList.add(new ln(ln.i, c2));
}
arrayList.add(new ln(ln.b, keVar.a().b()));
int c3 = b.c();
for (int i = 0; i < c3; i++) {
mt c4 = mt.c(b.c(i).toLowerCase(Locale.US));
if (!c.contains(c4.b())) {
arrayList.add(new ln(c4, b.a(i)));
}
}
ls c5 = this.d.c(arrayList, z);
this.h = c5;
c5.f.a(this.b.a(), TimeUnit.MILLISECONDS);
this.h.i.a(this.b.e(), TimeUnit.MILLISECONDS);
}
@Override // com.facetec.sdk.lh
public final void c() throws IOException {
this.d.e();
}
@Override // com.facetec.sdk.lh
public final void d() throws IOException {
this.h.d().close();
}
@Override // com.facetec.sdk.lh
public final kh.d c(boolean z) throws IOException {
jv c2 = this.h.c();
kd kdVar = this.f;
jv.a aVar = new jv.a();
int c3 = c2.c();
lm lmVar = null;
for (int i = 0; i < c3; i++) {
String c4 = c2.c(i);
String a2 = c2.a(i);
if (c4.equals(Header.RESPONSE_STATUS_UTF8)) {
lmVar = lm.e("HTTP/1.1 ".concat(String.valueOf(a2)));
} else if (!e.contains(c4)) {
kn.a.c(aVar, c4, a2);
}
}
if (lmVar == null) {
throw new ProtocolException("Expected ':status' header not present");
}
kh.d b = new kh.d().e(kdVar).c(lmVar.c).b(lmVar.d).b(aVar.e());
if (z && kn.a.c(b) == 100) {
return null;
}
return b;
}
@Override // com.facetec.sdk.lh
public final kf b(kh khVar) throws IOException {
jx jxVar = this.a.a;
jo joVar = this.a.d;
return new lj(khVar.b(HttpHeaders.CONTENT_TYPE), le.b(khVar), nb.c(new a(this, this.h.j)));
}
@Override // com.facetec.sdk.lh
public final void b() {
ls lsVar = this.h;
if (lsVar != null) {
lsVar.d(lo.CANCEL);
}
}
/* loaded from: classes.dex */
final class a extends my {
private lu c;
private boolean d;
private long e;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
a(lu luVar, nk nkVar) {
super(nkVar);
this.c = luVar;
this.d = false;
this.e = 0L;
}
@Override // com.facetec.sdk.my, com.facetec.sdk.nk
public final long b(ms msVar, long j) throws IOException {
try {
long b = d().b(msVar, j);
if (b > 0) {
this.e += b;
}
return b;
} catch (IOException e) {
e(e);
throw e;
}
}
@Override // com.facetec.sdk.my, com.facetec.sdk.nk, java.io.Closeable, java.lang.AutoCloseable
public final void close() throws IOException {
super.close();
e(null);
}
private void e(IOException iOException) {
if (this.d) {
return;
}
this.d = true;
this.c.a.e(false, this.c, iOException);
}
}
}