what-the-bank/sources/okhttp3/internal/http/HttpHeaders.java

172 lines
5.7 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package okhttp3.internal.http;
import java.io.EOFException;
import java.util.ArrayList;
import java.util.List;
import o.C14957gcv;
import o.C15111ghZ;
import o.C15155gij;
import o.gdP;
import o.gdZ;
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;
/* loaded from: classes.dex */
public final class HttpHeaders {
private static final C15155gij QUOTED_STRING_DELIMITERS;
private static final C15155gij TOKEN_DELIMITERS;
static {
C15155gij.LWm lWm = C15155gij.c;
C14957gcv.e("\"\\", "");
C14957gcv.e("\"\\", "");
byte[] bytes = "\"\\".getBytes(gdP.a);
C14957gcv.c(bytes, "");
C15155gij c15155gij = new C15155gij(bytes);
c15155gij.d = "\"\\";
QUOTED_STRING_DELIMITERS = c15155gij;
C15155gij.LWm lWm2 = C15155gij.c;
C14957gcv.e("\t ,=", "");
C14957gcv.e("\t ,=", "");
byte[] bytes2 = "\t ,=".getBytes(gdP.a);
C14957gcv.c(bytes2, "");
C15155gij c15155gij2 = new C15155gij(bytes2);
c15155gij2.d = "\t ,=";
TOKEN_DELIMITERS = c15155gij2;
}
public static final List<Challenge> parseChallenges(Headers headers, String str) {
C14957gcv.e(headers, "");
C14957gcv.e(str, "");
ArrayList arrayList = new ArrayList();
int size = headers.size();
for (int i = 0; i < size; i++) {
if (gdZ.a(str, headers.name(i), true)) {
C15111ghZ c15111ghZ = new C15111ghZ();
String value = headers.value(i);
C14957gcv.e(value, "");
try {
readChallengeHeader(c15111ghZ.c(value, 0, value.length()), arrayList);
} catch (EOFException e) {
Platform.Companion.get().log("Unable to parse challenge", 5, e);
}
}
}
return arrayList;
}
/* JADX WARN: Code restructure failed: missing block: B:50:0x00f8, code lost:
continue;
*/
/* JADX WARN: Code restructure failed: missing block: B:80:0x00f8, code lost:
continue;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static final void readChallengeHeader(o.C15111ghZ r13, java.util.List<okhttp3.Challenge> r14) throws java.io.EOFException {
/*
Method dump skipped, instructions count: 314
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.http.HttpHeaders.readChallengeHeader(o.ghZ, java.util.List):void");
}
private static final String readQuotedString(C15111ghZ c15111ghZ) throws EOFException {
if (c15111ghZ.f() != 34) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
C15111ghZ c15111ghZ2 = new C15111ghZ();
while (true) {
C15155gij c15155gij = QUOTED_STRING_DELIMITERS;
C14957gcv.e(c15155gij, "");
long c = c15111ghZ.c(c15155gij, 0L);
if (c == -1) {
return null;
}
if (c15111ghZ.d(c) == 34) {
c15111ghZ2.write(c15111ghZ, c);
c15111ghZ.f();
return c15111ghZ2.b(c15111ghZ2.c, gdP.a);
}
if (c15111ghZ.c == c + 1) {
return null;
}
c15111ghZ2.write(c15111ghZ, c);
c15111ghZ.f();
c15111ghZ2.write(c15111ghZ, 1L);
}
}
private static final String readToken(C15111ghZ c15111ghZ) {
C15155gij c15155gij = TOKEN_DELIMITERS;
C14957gcv.e(c15155gij, "");
long c = c15111ghZ.c(c15155gij, 0L);
if (c == -1) {
c = c15111ghZ.c;
}
if (c != 0) {
return c15111ghZ.b(c, gdP.a);
}
return null;
}
public static final void receiveHeaders(CookieJar cookieJar, HttpUrl httpUrl, Headers headers) {
C14957gcv.e(cookieJar, "");
C14957gcv.e(httpUrl, "");
C14957gcv.e(headers, "");
if (cookieJar == CookieJar.NO_COOKIES) {
return;
}
List<Cookie> parseAll = Cookie.Companion.parseAll(httpUrl, headers);
if (parseAll.isEmpty()) {
return;
}
cookieJar.saveFromResponse(httpUrl, parseAll);
}
public static final boolean promisesBody(Response response) {
C14957gcv.e(response, "");
if (C14957gcv.b((Object) response.request().method(), (Object) "HEAD")) {
return false;
}
int code = response.code();
return (((code >= 100 && code < 200) || code == 204 || code == 304) && Util.headersContentLength(response) == -1 && !gdZ.a("chunked", Response.header$default(response, com.google.common.net.HttpHeaders.TRANSFER_ENCODING, null, 2, null), true)) ? false : true;
}
public static final boolean hasBody(Response response) {
C14957gcv.e(response, "");
return promisesBody(response);
}
private static final boolean skipCommasAndWhitespace(C15111ghZ c15111ghZ) {
boolean z = false;
while (c15111ghZ.c != 0) {
byte d = c15111ghZ.d(0L);
if (d != 44) {
if (d != 32 && d != 9) {
break;
}
c15111ghZ.f();
} else {
c15111ghZ.f();
z = true;
}
}
return z;
}
private static final boolean startsWith(C15111ghZ c15111ghZ, byte b) {
return c15111ghZ.c != 0 && c15111ghZ.d(0L) == b;
}
}