Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,90 @@
package okhttp3.internal.http;
import com.ironsource.nb;
import com.mbridge.msdk.foundation.download.Command;
import java.util.List;
import okhttp3.Cookie;
import okhttp3.CookieJar;
import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.internal.Util;
import okhttp3.internal.Version;
import okio.GzipSource;
import okio.Okio;
import org.apache.http.cookie.SM;
import org.apache.http.protocol.HTTP;
/* loaded from: classes5.dex */
public final class BridgeInterceptor implements Interceptor {
public final CookieJar cookieJar;
public BridgeInterceptor(CookieJar cookieJar) {
this.cookieJar = cookieJar;
}
@Override // okhttp3.Interceptor
public Response intercept(Interceptor.Chain chain) {
Request request = chain.request();
Request.Builder newBuilder = request.newBuilder();
RequestBody body = request.body();
if (body != null) {
MediaType contentType = body.contentType();
if (contentType != null) {
newBuilder.header("Content-Type", contentType.toString());
}
long contentLength = body.contentLength();
if (contentLength != -1) {
newBuilder.header(HTTP.CONTENT_LEN, Long.toString(contentLength));
newBuilder.removeHeader(HTTP.TRANSFER_ENCODING);
} else {
newBuilder.header(HTTP.TRANSFER_ENCODING, HTTP.CHUNK_CODING);
newBuilder.removeHeader(HTTP.CONTENT_LEN);
}
}
boolean z = false;
if (request.header(HTTP.TARGET_HOST) == null) {
newBuilder.header(HTTP.TARGET_HOST, Util.hostHeader(request.url(), false));
}
if (request.header(HTTP.CONN_DIRECTIVE) == null) {
newBuilder.header(HTTP.CONN_DIRECTIVE, HTTP.CONN_KEEP_ALIVE);
}
if (request.header("Accept-Encoding") == null && request.header(Command.HTTP_HEADER_RANGE) == null) {
newBuilder.header("Accept-Encoding", "gzip");
z = true;
}
List loadForRequest = this.cookieJar.loadForRequest(request.url());
if (!loadForRequest.isEmpty()) {
newBuilder.header(SM.COOKIE, cookieHeader(loadForRequest));
}
if (request.header("User-Agent") == null) {
newBuilder.header("User-Agent", Version.userAgent());
}
Response proceed = chain.proceed(newBuilder.build());
HttpHeaders.receiveHeaders(this.cookieJar, request.url(), proceed.headers());
Response.Builder request2 = proceed.newBuilder().request(request);
if (z && "gzip".equalsIgnoreCase(proceed.header(HTTP.CONTENT_ENCODING)) && HttpHeaders.hasBody(proceed)) {
GzipSource gzipSource = new GzipSource(proceed.body().source());
request2.headers(proceed.headers().newBuilder().removeAll(HTTP.CONTENT_ENCODING).removeAll(HTTP.CONTENT_LEN).build());
request2.body(new RealResponseBody(proceed.header("Content-Type"), -1L, Okio.buffer(gzipSource)));
}
return request2.build();
}
public final String cookieHeader(List list) {
StringBuilder sb = new StringBuilder();
int size = list.size();
for (int i = 0; i < size; i++) {
if (i > 0) {
sb.append("; ");
}
Cookie cookie = (Cookie) list.get(i);
sb.append(cookie.name());
sb.append(nb.T);
sb.append(cookie.value());
}
return sb.toString();
}
}

View File

@@ -0,0 +1,88 @@
package okhttp3.internal.http;
import java.net.ProtocolException;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.internal.Util;
import okhttp3.internal.connection.Exchange;
import okio.BufferedSink;
import okio.Okio;
import org.apache.http.protocol.HTTP;
/* loaded from: classes5.dex */
public final class CallServerInterceptor implements Interceptor {
public final boolean forWebSocket;
public CallServerInterceptor(boolean z) {
this.forWebSocket = z;
}
@Override // okhttp3.Interceptor
public Response intercept(Interceptor.Chain chain) {
boolean z;
Response build;
RealInterceptorChain realInterceptorChain = (RealInterceptorChain) chain;
Exchange exchange = realInterceptorChain.exchange();
Request request = realInterceptorChain.request();
long currentTimeMillis = System.currentTimeMillis();
exchange.writeRequestHeaders(request);
Response.Builder builder = null;
if (HttpMethod.permitsRequestBody(request.method()) && request.body() != null) {
if (HTTP.EXPECT_CONTINUE.equalsIgnoreCase(request.header(HTTP.EXPECT_DIRECTIVE))) {
exchange.flushRequest();
exchange.responseHeadersStart();
builder = exchange.readResponseHeaders(true);
z = true;
} else {
z = false;
}
if (builder == null) {
if (request.body().isDuplex()) {
exchange.flushRequest();
request.body().writeTo(Okio.buffer(exchange.createRequestBody(request, true)));
} else {
BufferedSink buffer = Okio.buffer(exchange.createRequestBody(request, false));
request.body().writeTo(buffer);
buffer.close();
}
} else {
exchange.noRequestBody();
if (!exchange.connection().isMultiplexed()) {
exchange.noNewExchangesOnConnection();
}
}
} else {
exchange.noRequestBody();
z = false;
}
if (request.body() == null || !request.body().isDuplex()) {
exchange.finishRequest();
}
if (!z) {
exchange.responseHeadersStart();
}
if (builder == null) {
builder = exchange.readResponseHeaders(false);
}
Response build2 = builder.request(request).handshake(exchange.connection().handshake()).sentRequestAtMillis(currentTimeMillis).receivedResponseAtMillis(System.currentTimeMillis()).build();
int code = build2.code();
if (code == 100) {
build2 = exchange.readResponseHeaders(false).request(request).handshake(exchange.connection().handshake()).sentRequestAtMillis(currentTimeMillis).receivedResponseAtMillis(System.currentTimeMillis()).build();
code = build2.code();
}
exchange.responseHeadersEnd(build2);
if (this.forWebSocket && code == 101) {
build = build2.newBuilder().body(Util.EMPTY_RESPONSE).build();
} else {
build = build2.newBuilder().body(exchange.openResponseBody(build2)).build();
}
if ("close".equalsIgnoreCase(build.request().header(HTTP.CONN_DIRECTIVE)) || "close".equalsIgnoreCase(build.header(HTTP.CONN_DIRECTIVE))) {
exchange.noNewExchangesOnConnection();
}
if ((code != 204 && code != 205) || build.body().contentLength() <= 0) {
return build;
}
throw new ProtocolException("HTTP " + code + " had non-zero Content-Length: " + build.body().contentLength());
}
}

View File

@@ -0,0 +1,28 @@
package okhttp3.internal.http;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.internal.connection.RealConnection;
import okio.Sink;
import okio.Source;
/* loaded from: classes5.dex */
public interface ExchangeCodec {
void cancel();
RealConnection connection();
Sink createRequestBody(Request request, long j);
void finishRequest();
void flushRequest();
Source openResponseBodySource(Response response);
Response.Builder readResponseHeaders(boolean z);
long reportedContentLength(Response response);
void writeRequestHeaders(Request request);
}

View File

@@ -0,0 +1,68 @@
package okhttp3.internal.http;
import java.text.DateFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import okhttp3.internal.Util;
import org.apache.http.impl.cookie.DateUtils;
/* loaded from: classes5.dex */
public abstract class HttpDate {
public static final DateFormat[] BROWSER_COMPATIBLE_DATE_FORMATS;
public static final String[] BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS;
public static final ThreadLocal STANDARD_DATE_FORMAT = new ThreadLocal() { // from class: okhttp3.internal.http.HttpDate.1
@Override // java.lang.ThreadLocal
public DateFormat initialValue() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
simpleDateFormat.setLenient(false);
simpleDateFormat.setTimeZone(Util.UTC);
return simpleDateFormat;
}
};
static {
String[] strArr = {"EEE, dd MMM yyyy HH:mm:ss zzz", DateUtils.PATTERN_RFC1036, DateUtils.PATTERN_ASCTIME, "EEE, dd-MMM-yyyy HH:mm:ss z", "EEE, dd-MMM-yyyy HH-mm-ss z", "EEE, dd MMM yy HH:mm:ss z", "EEE dd-MMM-yyyy HH:mm:ss z", "EEE dd MMM yyyy HH:mm:ss z", "EEE dd-MMM-yyyy HH-mm-ss z", "EEE dd-MMM-yy HH:mm:ss z", "EEE dd MMM yy HH:mm:ss z", "EEE,dd-MMM-yy HH:mm:ss z", "EEE,dd-MMM-yyyy HH:mm:ss z", "EEE, dd-MM-yyyy HH:mm:ss z", "EEE MMM d yyyy HH:mm:ss z"};
BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS = strArr;
BROWSER_COMPATIBLE_DATE_FORMATS = new DateFormat[strArr.length];
}
public static Date parse(String str) {
if (str.length() == 0) {
return null;
}
ParsePosition parsePosition = new ParsePosition(0);
Date parse = ((DateFormat) STANDARD_DATE_FORMAT.get()).parse(str, parsePosition);
if (parsePosition.getIndex() == str.length()) {
return parse;
}
String[] strArr = BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS;
synchronized (strArr) {
try {
int length = strArr.length;
for (int i = 0; i < length; i++) {
DateFormat[] dateFormatArr = BROWSER_COMPATIBLE_DATE_FORMATS;
DateFormat dateFormat = dateFormatArr[i];
if (dateFormat == null) {
dateFormat = new SimpleDateFormat(BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS[i], Locale.US);
dateFormat.setTimeZone(Util.UTC);
dateFormatArr[i] = dateFormat;
}
parsePosition.setIndex(0);
Date parse2 = dateFormat.parse(str, parsePosition);
if (parsePosition.getIndex() != 0) {
return parse2;
}
}
return null;
} catch (Throwable th) {
throw th;
}
}
}
public static String format(Date date) {
return ((DateFormat) STANDARD_DATE_FORMAT.get()).format(date);
}
}

View File

@@ -0,0 +1,151 @@
package okhttp3.internal.http;
import androidx.webkit.ProxyConfig;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import okhttp3.Cookie;
import okhttp3.CookieJar;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.internal.Util;
import okio.ByteString;
import org.apache.http.client.methods.HttpHead;
import org.apache.http.message.BasicHeaderValueFormatter;
import org.apache.http.protocol.HTTP;
/* loaded from: classes5.dex */
public abstract class HttpHeaders {
public static final ByteString QUOTED_STRING_DELIMITERS = ByteString.encodeUtf8(BasicHeaderValueFormatter.UNSAFE_CHARS);
public static final ByteString TOKEN_DELIMITERS = ByteString.encodeUtf8("\t ,=");
public static long contentLength(Response response) {
return contentLength(response.headers());
}
public static long contentLength(Headers headers) {
return stringToLong(headers.get(HTTP.CONTENT_LEN));
}
public static long stringToLong(String str) {
if (str == null) {
return -1L;
}
try {
return Long.parseLong(str);
} catch (NumberFormatException unused) {
return -1L;
}
}
public static boolean varyMatches(Response response, Headers headers, Request request) {
for (String str : varyFields(response)) {
if (!Objects.equals(headers.values(str), request.headers(str))) {
return false;
}
}
return true;
}
public static boolean hasVaryAll(Response response) {
return hasVaryAll(response.headers());
}
public static boolean hasVaryAll(Headers headers) {
return varyFields(headers).contains(ProxyConfig.MATCH_ALL_SCHEMES);
}
public static Set varyFields(Response response) {
return varyFields(response.headers());
}
public static Set varyFields(Headers headers) {
Set emptySet = Collections.emptySet();
int size = headers.size();
for (int i = 0; i < size; i++) {
if ("Vary".equalsIgnoreCase(headers.name(i))) {
String value = headers.value(i);
if (emptySet.isEmpty()) {
emptySet = new TreeSet(String.CASE_INSENSITIVE_ORDER);
}
for (String str : value.split(",")) {
emptySet.add(str.trim());
}
}
}
return emptySet;
}
public static Headers varyHeaders(Response response) {
return varyHeaders(response.networkResponse().request().headers(), response.headers());
}
public static Headers varyHeaders(Headers headers, Headers headers2) {
Set varyFields = varyFields(headers2);
if (varyFields.isEmpty()) {
return Util.EMPTY_HEADERS;
}
Headers.Builder builder = new Headers.Builder();
int size = headers.size();
for (int i = 0; i < size; i++) {
String name = headers.name(i);
if (varyFields.contains(name)) {
builder.add(name, headers.value(i));
}
}
return builder.build();
}
public static void receiveHeaders(CookieJar cookieJar, HttpUrl httpUrl, Headers headers) {
if (cookieJar == CookieJar.NO_COOKIES) {
return;
}
List parseAll = Cookie.parseAll(httpUrl, headers);
if (parseAll.isEmpty()) {
return;
}
cookieJar.saveFromResponse(httpUrl, parseAll);
}
public static boolean hasBody(Response response) {
if (response.request().method().equals(HttpHead.METHOD_NAME)) {
return false;
}
int code = response.code();
return (((code >= 100 && code < 200) || code == 204 || code == 304) && contentLength(response) == -1 && !HTTP.CHUNK_CODING.equalsIgnoreCase(response.header(HTTP.TRANSFER_ENCODING))) ? false : true;
}
public static int skipUntil(String str, int i, String str2) {
while (i < str.length() && str2.indexOf(str.charAt(i)) == -1) {
i++;
}
return i;
}
public static int skipWhitespace(String str, int i) {
char charAt;
while (i < str.length() && ((charAt = str.charAt(i)) == ' ' || charAt == '\t')) {
i++;
}
return i;
}
public static int parseSeconds(String str, int i) {
try {
long parseLong = Long.parseLong(str);
if (parseLong > 2147483647L) {
return Integer.MAX_VALUE;
}
if (parseLong < 0) {
return 0;
}
return (int) parseLong;
} catch (NumberFormatException unused) {
return i;
}
}
}

View File

@@ -0,0 +1,28 @@
package okhttp3.internal.http;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpHead;
import org.apache.http.client.methods.HttpPut;
/* loaded from: classes5.dex */
public abstract class HttpMethod {
public static boolean invalidatesCache(String str) {
return str.equals("POST") || str.equals("PATCH") || str.equals(HttpPut.METHOD_NAME) || str.equals(HttpDelete.METHOD_NAME) || str.equals("MOVE");
}
public static boolean requiresRequestBody(String str) {
return str.equals("POST") || str.equals(HttpPut.METHOD_NAME) || str.equals("PATCH") || str.equals("PROPPATCH") || str.equals("REPORT");
}
public static boolean permitsRequestBody(String str) {
return (str.equals("GET") || str.equals(HttpHead.METHOD_NAME)) ? false : true;
}
public static boolean redirectsWithBody(String str) {
return str.equals("PROPFIND");
}
public static boolean redirectsToGet(String str) {
return !str.equals("PROPFIND");
}
}

View File

@@ -0,0 +1,99 @@
package okhttp3.internal.http;
import java.util.List;
import okhttp3.Call;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.internal.connection.Exchange;
import okhttp3.internal.connection.Transmitter;
/* loaded from: classes5.dex */
public final class RealInterceptorChain implements Interceptor.Chain {
public final Call call;
public int calls;
public final int connectTimeout;
public final Exchange exchange;
public final int index;
public final List interceptors;
public final int readTimeout;
public final Request request;
public final Transmitter transmitter;
public final int writeTimeout;
@Override // okhttp3.Interceptor.Chain
public int connectTimeoutMillis() {
return this.connectTimeout;
}
@Override // okhttp3.Interceptor.Chain
public int readTimeoutMillis() {
return this.readTimeout;
}
@Override // okhttp3.Interceptor.Chain
public Request request() {
return this.request;
}
public Transmitter transmitter() {
return this.transmitter;
}
@Override // okhttp3.Interceptor.Chain
public int writeTimeoutMillis() {
return this.writeTimeout;
}
public RealInterceptorChain(List list, Transmitter transmitter, Exchange exchange, int i, Request request, Call call, int i2, int i3, int i4) {
this.interceptors = list;
this.transmitter = transmitter;
this.exchange = exchange;
this.index = i;
this.request = request;
this.call = call;
this.connectTimeout = i2;
this.readTimeout = i3;
this.writeTimeout = i4;
}
public Exchange exchange() {
Exchange exchange = this.exchange;
if (exchange != null) {
return exchange;
}
throw new IllegalStateException();
}
@Override // okhttp3.Interceptor.Chain
public Response proceed(Request request) {
return proceed(request, this.transmitter, this.exchange);
}
public Response proceed(Request request, Transmitter transmitter, Exchange exchange) {
if (this.index >= this.interceptors.size()) {
throw new AssertionError();
}
this.calls++;
Exchange exchange2 = this.exchange;
if (exchange2 != null && !exchange2.connection().supportsUrl(request.url())) {
throw new IllegalStateException("network interceptor " + this.interceptors.get(this.index - 1) + " must retain the same host and port");
}
if (this.exchange != null && this.calls > 1) {
throw new IllegalStateException("network interceptor " + this.interceptors.get(this.index - 1) + " must call proceed() exactly once");
}
RealInterceptorChain realInterceptorChain = new RealInterceptorChain(this.interceptors, transmitter, exchange, this.index + 1, request, this.call, this.connectTimeout, this.readTimeout, this.writeTimeout);
Interceptor interceptor = (Interceptor) this.interceptors.get(this.index);
Response intercept = interceptor.intercept(realInterceptorChain);
if (exchange != null && this.index + 1 < this.interceptors.size() && realInterceptorChain.calls != 1) {
throw new IllegalStateException("network interceptor " + interceptor + " must call proceed() exactly once");
}
if (intercept == null) {
throw new NullPointerException("interceptor " + interceptor + " returned null");
}
if (intercept.body() != null) {
return intercept;
}
throw new IllegalStateException("interceptor " + interceptor + " returned a response with no body");
}
}

View File

@@ -0,0 +1,37 @@
package okhttp3.internal.http;
import okhttp3.MediaType;
import okhttp3.ResponseBody;
import okio.BufferedSource;
/* loaded from: classes5.dex */
public final class RealResponseBody extends ResponseBody {
public final long contentLength;
public final String contentTypeString;
public final BufferedSource source;
@Override // okhttp3.ResponseBody
public long contentLength() {
return this.contentLength;
}
@Override // okhttp3.ResponseBody
public BufferedSource source() {
return this.source;
}
public RealResponseBody(String str, long j, BufferedSource bufferedSource) {
this.contentTypeString = str;
this.contentLength = j;
this.source = bufferedSource;
}
@Override // okhttp3.ResponseBody
public MediaType contentType() {
String str = this.contentTypeString;
if (str != null) {
return MediaType.parse(str);
}
return null;
}
}

View File

@@ -0,0 +1,34 @@
package okhttp3.internal.http;
import java.net.Proxy;
import okhttp3.HttpUrl;
import okhttp3.Request;
/* loaded from: classes5.dex */
public abstract class RequestLine {
public static String get(Request request, Proxy.Type type) {
StringBuilder sb = new StringBuilder();
sb.append(request.method());
sb.append(' ');
if (includeAuthorityInRequestLine(request, type)) {
sb.append(request.url());
} else {
sb.append(requestPath(request.url()));
}
sb.append(" HTTP/1.1");
return sb.toString();
}
public static boolean includeAuthorityInRequestLine(Request request, Proxy.Type type) {
return !request.isHttps() && type == Proxy.Type.HTTP;
}
public static String requestPath(HttpUrl httpUrl) {
String encodedPath = httpUrl.encodedPath();
String encodedQuery = httpUrl.encodedQuery();
if (encodedQuery == null) {
return encodedPath;
}
return encodedPath + '?' + encodedQuery;
}
}

View File

@@ -0,0 +1,206 @@
package okhttp3.internal.http;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.ProtocolException;
import java.net.Proxy;
import java.net.SocketTimeoutException;
import java.security.cert.CertificateException;
import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLPeerUnverifiedException;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.Route;
import okhttp3.internal.Internal;
import okhttp3.internal.Util;
import okhttp3.internal.connection.Exchange;
import okhttp3.internal.connection.RouteException;
import okhttp3.internal.connection.Transmitter;
import okhttp3.internal.http2.ConnectionShutdownException;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.HttpHead;
import org.apache.http.protocol.HTTP;
/* loaded from: classes5.dex */
public final class RetryAndFollowUpInterceptor implements Interceptor {
public final OkHttpClient client;
public RetryAndFollowUpInterceptor(OkHttpClient okHttpClient) {
this.client = okHttpClient;
}
@Override // okhttp3.Interceptor
public Response intercept(Interceptor.Chain chain) {
Exchange exchange;
Request followUpRequest;
Request request = chain.request();
RealInterceptorChain realInterceptorChain = (RealInterceptorChain) chain;
Transmitter transmitter = realInterceptorChain.transmitter();
int i = 0;
Response response = null;
while (true) {
transmitter.prepareToConnect(request);
if (transmitter.isCanceled()) {
throw new IOException("Canceled");
}
try {
try {
Response proceed = realInterceptorChain.proceed(request, transmitter, null);
if (response != null) {
proceed = proceed.newBuilder().priorResponse(response.newBuilder().body(null).build()).build();
}
response = proceed;
exchange = Internal.instance.exchange(response);
followUpRequest = followUpRequest(response, exchange != null ? exchange.connection().route() : null);
} catch (IOException e) {
if (!recover(e, transmitter, !(e instanceof ConnectionShutdownException), request)) {
throw e;
}
} catch (RouteException e2) {
if (!recover(e2.getLastConnectException(), transmitter, false, request)) {
throw e2.getFirstConnectException();
}
}
if (followUpRequest == null) {
if (exchange != null && exchange.isDuplex()) {
transmitter.timeoutEarlyExit();
}
return response;
}
RequestBody body = followUpRequest.body();
if (body != null && body.isOneShot()) {
return response;
}
Util.closeQuietly(response.body());
if (transmitter.hasExchange()) {
exchange.detachWithViolence();
}
i++;
if (i > 20) {
throw new ProtocolException("Too many follow-up requests: " + i);
}
request = followUpRequest;
} finally {
transmitter.exchangeDoneDueToException();
}
}
}
public final boolean recover(IOException iOException, Transmitter transmitter, boolean z, Request request) {
if (this.client.retryOnConnectionFailure()) {
return !(z && requestIsOneShot(iOException, request)) && isRecoverable(iOException, z) && transmitter.canRetry();
}
return false;
}
public final boolean requestIsOneShot(IOException iOException, Request request) {
RequestBody body = request.body();
return (body != null && body.isOneShot()) || (iOException instanceof FileNotFoundException);
}
public final boolean isRecoverable(IOException iOException, boolean z) {
if (iOException instanceof ProtocolException) {
return false;
}
return iOException instanceof InterruptedIOException ? (iOException instanceof SocketTimeoutException) && !z : (((iOException instanceof SSLHandshakeException) && (iOException.getCause() instanceof CertificateException)) || (iOException instanceof SSLPeerUnverifiedException)) ? false : true;
}
public final Request followUpRequest(Response response, Route route) {
String header;
HttpUrl resolve;
Proxy proxy;
if (response == null) {
throw new IllegalStateException();
}
int code = response.code();
String method = response.request().method();
if (code == 307 || code == 308) {
if (!method.equals("GET") && !method.equals(HttpHead.METHOD_NAME)) {
return null;
}
} else {
if (code == 401) {
return this.client.authenticator().authenticate(route, response);
}
if (code == 503) {
if ((response.priorResponse() == null || response.priorResponse().code() != 503) && retryAfter(response, Integer.MAX_VALUE) == 0) {
return response.request();
}
return null;
}
if (code == 407) {
if (route != null) {
proxy = route.proxy();
} else {
proxy = this.client.proxy();
}
if (proxy.type() != Proxy.Type.HTTP) {
throw new ProtocolException("Received HTTP_PROXY_AUTH (407) code while not using proxy");
}
return this.client.proxyAuthenticator().authenticate(route, response);
}
if (code == 408) {
if (!this.client.retryOnConnectionFailure()) {
return null;
}
RequestBody body = response.request().body();
if (body != null && body.isOneShot()) {
return null;
}
if ((response.priorResponse() == null || response.priorResponse().code() != 408) && retryAfter(response, 0) <= 0) {
return response.request();
}
return null;
}
switch (code) {
case 300:
case 301:
case 302:
case HttpStatus.SC_SEE_OTHER /* 303 */:
break;
default:
return null;
}
}
if (!this.client.followRedirects() || (header = response.header("Location")) == null || (resolve = response.request().url().resolve(header)) == null) {
return null;
}
if (!resolve.scheme().equals(response.request().url().scheme()) && !this.client.followSslRedirects()) {
return null;
}
Request.Builder newBuilder = response.request().newBuilder();
if (HttpMethod.permitsRequestBody(method)) {
boolean redirectsWithBody = HttpMethod.redirectsWithBody(method);
if (HttpMethod.redirectsToGet(method)) {
newBuilder.method("GET", null);
} else {
newBuilder.method(method, redirectsWithBody ? response.request().body() : null);
}
if (!redirectsWithBody) {
newBuilder.removeHeader(HTTP.TRANSFER_ENCODING);
newBuilder.removeHeader(HTTP.CONTENT_LEN);
newBuilder.removeHeader("Content-Type");
}
}
if (!Util.sameConnection(response.request().url(), resolve)) {
newBuilder.removeHeader("Authorization");
}
return newBuilder.url(resolve).build();
}
public final int retryAfter(Response response, int i) {
String header = response.header("Retry-After");
if (header == null) {
return i;
}
if (header.matches("\\d+")) {
return Integer.valueOf(header).intValue();
}
return Integer.MAX_VALUE;
}
}

View File

@@ -0,0 +1,72 @@
package okhttp3.internal.http;
import java.net.ProtocolException;
import okhttp3.Protocol;
/* loaded from: classes5.dex */
public final class StatusLine {
public final int code;
public final String message;
public final Protocol protocol;
public StatusLine(Protocol protocol, int i, String str) {
this.protocol = protocol;
this.code = i;
this.message = str;
}
public static StatusLine parse(String str) {
Protocol protocol;
int i;
String str2;
if (str.startsWith("HTTP/1.")) {
i = 9;
if (str.length() < 9 || str.charAt(8) != ' ') {
throw new ProtocolException("Unexpected status line: " + str);
}
int charAt = str.charAt(7) - '0';
if (charAt == 0) {
protocol = Protocol.HTTP_1_0;
} else if (charAt == 1) {
protocol = Protocol.HTTP_1_1;
} else {
throw new ProtocolException("Unexpected status line: " + str);
}
} else if (str.startsWith("ICY ")) {
protocol = Protocol.HTTP_1_0;
i = 4;
} else {
throw new ProtocolException("Unexpected status line: " + str);
}
int i2 = i + 3;
if (str.length() < i2) {
throw new ProtocolException("Unexpected status line: " + str);
}
try {
int parseInt = Integer.parseInt(str.substring(i, i2));
if (str.length() <= i2) {
str2 = "";
} else {
if (str.charAt(i2) != ' ') {
throw new ProtocolException("Unexpected status line: " + str);
}
str2 = str.substring(i + 4);
}
return new StatusLine(protocol, parseInt, str2);
} catch (NumberFormatException unused) {
throw new ProtocolException("Unexpected status line: " + str);
}
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.protocol == Protocol.HTTP_1_0 ? "HTTP/1.0" : "HTTP/1.1");
sb.append(' ');
sb.append(this.code);
if (this.message != null) {
sb.append(' ');
sb.append(this.message);
}
return sb.toString();
}
}