what-the-bank/sources/okhttp3/internal/http2/Http2.java

139 lines
5.1 KiB
Java

package okhttp3.internal.http2;
import com.airbnb.deeplinkdispatch.base.MatchIndex;
import o.C14957gcv;
import o.C15155gij;
import o.gdP;
import o.gdZ;
import okhttp3.internal.Util;
/* loaded from: classes.dex */
public final class Http2 {
private static final String[] BINARY;
public static final C15155gij CONNECTION_PREFACE;
private static final String[] FLAGS;
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;
private static final String[] FRAME_NAMES;
public static final int INITIAL_MAX_FRAME_SIZE = 16384;
public static final Http2 INSTANCE = new Http2();
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;
private Http2() {
}
static {
C15155gij.LWm lWm = C15155gij.c;
C14957gcv.e("PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n", "");
C14957gcv.e("PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n", "");
byte[] bytes = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n".getBytes(gdP.a);
C14957gcv.c(bytes, "");
C15155gij c15155gij = new C15155gij(bytes);
c15155gij.d = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n";
CONNECTION_PREFACE = c15155gij;
FRAME_NAMES = new String[]{"DATA", "HEADERS", "PRIORITY", "RST_STREAM", "SETTINGS", "PUSH_PROMISE", "PING", "GOAWAY", "WINDOW_UPDATE", "CONTINUATION"};
FLAGS = new String[64];
String[] strArr = new String[256];
for (int i = 0; i < 256; i++) {
String binaryString = Integer.toBinaryString(i);
C14957gcv.c((Object) binaryString, "");
String format = Util.format("%8s", binaryString);
C14957gcv.e(format, "");
String replace = format.replace(' ', '0');
C14957gcv.c((Object) replace, "");
strArr[i] = replace;
}
BINARY = strArr;
String[] strArr2 = FLAGS;
strArr2[0] = "";
strArr2[1] = "END_STREAM";
int[] iArr = {1};
strArr2[8] = "PADDED";
int i2 = iArr[0];
strArr2[i2 | 8] = C14957gcv.c(strArr2[i2], (Object) "|PADDED");
strArr2[4] = "END_HEADERS";
strArr2[32] = "PRIORITY";
strArr2[36] = "END_HEADERS|PRIORITY";
int[] iArr2 = {4, 32, 36};
int i3 = 0;
while (i3 < 3) {
int i4 = iArr2[i3];
i3++;
int i5 = iArr[0];
String[] strArr3 = FLAGS;
int i6 = i5 | i4;
StringBuilder sb = new StringBuilder();
sb.append((Object) strArr3[i5]);
sb.append(MatchIndex.ALLOWED_VALUES_SEPARATOR);
sb.append((Object) strArr3[i4]);
strArr3[i6] = sb.toString();
StringBuilder sb2 = new StringBuilder();
sb2.append((Object) strArr3[i5]);
sb2.append(MatchIndex.ALLOWED_VALUES_SEPARATOR);
sb2.append((Object) strArr3[i4]);
sb2.append("|PADDED");
strArr3[i6 | 8] = sb2.toString();
}
int length = FLAGS.length;
for (int i7 = 0; i7 < length; i7++) {
String[] strArr4 = FLAGS;
if (strArr4[i7] == null) {
strArr4[i7] = BINARY[i7];
}
}
}
public final String frameLog(boolean z, int i, int i2, int i3, int i4) {
return Util.format("%s 0x%08x %5d %-13s %s", z ? "<<" : ">>", Integer.valueOf(i), Integer.valueOf(i2), formattedType$okhttp(i3), formatFlags(i3, i4));
}
public final String formattedType$okhttp(int i) {
String[] strArr = FRAME_NAMES;
return i < strArr.length ? strArr[i] : Util.format("0x%02x", Integer.valueOf(i));
}
public final String formatFlags(int i, int i2) {
String str;
if (i2 == 0) {
return "";
}
if (i != 2 && i != 3) {
if (i == 4 || i == 6) {
if (i2 != 1) {
return BINARY[i2];
}
return "ACK";
}
if (i != 7 && i != 8) {
String[] strArr = FLAGS;
if (i2 < strArr.length) {
str = strArr[i2];
C14957gcv.e(str);
} else {
str = BINARY[i2];
}
if (i != 5 || (i2 & 4) == 0) {
return (i != 0 || (i2 & 32) == 0) ? str : gdZ.a(str, "PRIORITY", "COMPRESSED");
}
return gdZ.a(str, "HEADERS", "PUSH_PROMISE");
}
}
return BINARY[i2];
}
}