what-the-bank/sources/okhttp3/logging/HttpLoggingInterceptor.java

139 lines
4.6 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package okhttp3.logging;
import com.google.common.net.HttpHeaders;
import java.util.Comparator;
import java.util.Set;
import java.util.TreeSet;
import o.C14881gav;
import o.C14953gcr;
import o.C14957gcv;
import o.gaH;
import o.gcH;
import o.gdZ;
import okhttp3.Headers;
import okhttp3.Interceptor;
import okhttp3.internal.platform.Platform;
/* loaded from: classes6.dex */
public final class HttpLoggingInterceptor implements Interceptor {
private volatile Set<String> headersToRedact;
private volatile Level level;
private final Logger logger;
/* loaded from: classes6.dex */
public enum Level {
NONE,
BASIC,
HEADERS,
BODY
}
public HttpLoggingInterceptor(Logger logger) {
C14957gcv.e(logger, "");
this.logger = logger;
this.headersToRedact = gaH.e;
this.level = Level.NONE;
}
public /* synthetic */ HttpLoggingInterceptor(Logger logger, int i, C14953gcr c14953gcr) {
this((i & 1) != 0 ? Logger.DEFAULT : logger);
}
/* loaded from: classes6.dex */
public interface Logger {
public static final Companion Companion = Companion.$$INSTANCE;
public static final Logger DEFAULT = new Companion.DefaultLogger();
void log(String str);
/* loaded from: classes6.dex */
public static final class Companion {
static final Companion $$INSTANCE = new Companion();
private Companion() {
}
/* loaded from: classes6.dex */
static final class DefaultLogger implements Logger {
@Override // okhttp3.logging.HttpLoggingInterceptor.Logger
public final void log(String str) {
C14957gcv.e(str, "");
Platform.log$default(Platform.Companion.get(), str, 0, null, 6, null);
}
}
}
}
public final void redactHeader(String str) {
C14957gcv.e(str, "");
C14957gcv.e(gcH.d, "");
Comparator comparator = String.CASE_INSENSITIVE_ORDER;
C14957gcv.c(comparator, "");
TreeSet treeSet = new TreeSet(comparator);
TreeSet treeSet2 = treeSet;
C14881gav.d(treeSet2, this.headersToRedact);
treeSet2.add(str);
this.headersToRedact = treeSet;
}
public final HttpLoggingInterceptor setLevel(Level level) {
C14957gcv.e(level, "");
level(level);
return this;
}
/* JADX WARN: Removed duplicated region for block: B:117:0x027d */
/* JADX WARN: Removed duplicated region for block: B:118:0x0239 */
/* JADX WARN: Removed duplicated region for block: B:119:0x0215 */
/* JADX WARN: Removed duplicated region for block: B:63:0x0203 */
/* JADX WARN: Removed duplicated region for block: B:66:0x0235 */
/* JADX WARN: Removed duplicated region for block: B:69:0x0269 */
/* JADX WARN: Removed duplicated region for block: B:72:0x028f */
@Override // okhttp3.Interceptor
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final okhttp3.Response intercept(okhttp3.Interceptor.Chain r22) throws java.io.IOException {
/*
Method dump skipped, instructions count: 949
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.logging.HttpLoggingInterceptor.intercept(okhttp3.Interceptor$Chain):okhttp3.Response");
}
private final void logHeader(Headers headers, int i) {
String value = this.headersToRedact.contains(headers.name(i)) ? "██" : headers.value(i);
Logger logger = this.logger;
StringBuilder sb = new StringBuilder();
sb.append(headers.name(i));
sb.append(": ");
sb.append(value);
logger.log(sb.toString());
}
private final boolean bodyHasUnknownEncoding(Headers headers) {
String str = headers.get(HttpHeaders.CONTENT_ENCODING);
return (str == null || gdZ.a(str, "identity", true) || gdZ.a(str, "gzip", true)) ? false : true;
}
public final void level(Level level) {
C14957gcv.e(level, "");
this.level = level;
}
public final Level getLevel() {
return this.level;
}
/* renamed from: -deprecated_level, reason: not valid java name */
public final Level m494deprecated_level() {
return this.level;
}
/* JADX WARN: Multi-variable type inference failed */
public HttpLoggingInterceptor() {
this(null, 1, 0 == true ? 1 : 0);
}
}