apkfuckery/com.discord/smali/okhttp3/internal/http/HttpEngine.smali
2019-02-04 21:05:16 +01:00

2791 lines
77 KiB
Smali

.class public final Lokhttp3/internal/http/HttpEngine;
.super Ljava/lang/Object;
.source "HttpEngine.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lokhttp3/internal/http/HttpEngine$NetworkInterceptorChain;
}
.end annotation
# static fields
.field private static final EMPTY_BODY:Lokhttp3/ResponseBody;
.field public static final MAX_FOLLOW_UPS:I = 0x14
# instance fields
.field public final bufferRequestBody:Z
.field private bufferedRequestBody:Lokio/BufferedSink;
.field private cacheResponse:Lokhttp3/Response;
.field private cacheStrategy:Lokhttp3/internal/http/CacheStrategy;
.field private final callerWritesRequestBody:Z
.field final client:Lokhttp3/OkHttpClient;
.field private final forWebSocket:Z
.field private httpStream:Lokhttp3/internal/http/HttpStream;
.field private networkRequest:Lokhttp3/Request;
.field private final priorResponse:Lokhttp3/Response;
.field private requestBodyOut:Lokio/Sink;
.field sentRequestMillis:J
.field private storeRequest:Lokhttp3/internal/http/CacheRequest;
.field public final streamAllocation:Lokhttp3/internal/http/StreamAllocation;
.field private transparentGzip:Z
.field private final userRequest:Lokhttp3/Request;
.field private userResponse:Lokhttp3/Response;
# direct methods
.method static constructor <clinit>()V
.locals 1
.prologue
new-instance v0, Lokhttp3/internal/http/HttpEngine$1;
invoke-direct {v0}, Lokhttp3/internal/http/HttpEngine$1;-><init>()V
sput-object v0, Lokhttp3/internal/http/HttpEngine;->EMPTY_BODY:Lokhttp3/ResponseBody;
return-void
.end method
.method public constructor <init>(Lokhttp3/OkHttpClient;Lokhttp3/Request;ZZZLokhttp3/internal/http/StreamAllocation;Lokhttp3/internal/http/RetryableSink;Lokhttp3/Response;)V
.locals 2
.param p1, "client" # Lokhttp3/OkHttpClient;
.param p2, "request" # Lokhttp3/Request;
.param p3, "bufferRequestBody" # Z
.param p4, "callerWritesRequestBody" # Z
.param p5, "forWebSocket" # Z
.param p6, "streamAllocation" # Lokhttp3/internal/http/StreamAllocation;
.param p7, "requestBodyOut" # Lokhttp3/internal/http/RetryableSink;
.param p8, "priorResponse" # Lokhttp3/Response;
.prologue
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
const-wide/16 v0, -0x1
iput-wide v0, p0, Lokhttp3/internal/http/HttpEngine;->sentRequestMillis:J
iput-object p1, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
iput-object p2, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
iput-boolean p3, p0, Lokhttp3/internal/http/HttpEngine;->bufferRequestBody:Z
iput-boolean p4, p0, Lokhttp3/internal/http/HttpEngine;->callerWritesRequestBody:Z
iput-boolean p5, p0, Lokhttp3/internal/http/HttpEngine;->forWebSocket:Z
if-eqz p6, :cond_0
.end local p6 # "streamAllocation":Lokhttp3/internal/http/StreamAllocation;
:goto_0
iput-object p6, p0, Lokhttp3/internal/http/HttpEngine;->streamAllocation:Lokhttp3/internal/http/StreamAllocation;
iput-object p7, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
iput-object p8, p0, Lokhttp3/internal/http/HttpEngine;->priorResponse:Lokhttp3/Response;
return-void
.restart local p6 # "streamAllocation":Lokhttp3/internal/http/StreamAllocation;
:cond_0
new-instance p6, Lokhttp3/internal/http/StreamAllocation;
.end local p6 # "streamAllocation":Lokhttp3/internal/http/StreamAllocation;
invoke-virtual {p1}, Lokhttp3/OkHttpClient;->connectionPool()Lokhttp3/ConnectionPool;
move-result-object v0
invoke-static {p1, p2}, Lokhttp3/internal/http/HttpEngine;->createAddress(Lokhttp3/OkHttpClient;Lokhttp3/Request;)Lokhttp3/Address;
move-result-object v1
invoke-direct {p6, v0, v1}, Lokhttp3/internal/http/StreamAllocation;-><init>(Lokhttp3/ConnectionPool;Lokhttp3/Address;)V
goto :goto_0
.end method
.method static synthetic access$000(Lokhttp3/internal/http/HttpEngine;)Lokhttp3/internal/http/HttpStream;
.locals 1
.param p0, "x0" # Lokhttp3/internal/http/HttpEngine;
.prologue
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->httpStream:Lokhttp3/internal/http/HttpStream;
return-object v0
.end method
.method static synthetic access$102(Lokhttp3/internal/http/HttpEngine;Lokhttp3/Request;)Lokhttp3/Request;
.locals 0
.param p0, "x0" # Lokhttp3/internal/http/HttpEngine;
.param p1, "x1" # Lokhttp3/Request;
.prologue
iput-object p1, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
return-object p1
.end method
.method static synthetic access$200(Lokhttp3/internal/http/HttpEngine;)Lokhttp3/Response;
.locals 1
.param p0, "x0" # Lokhttp3/internal/http/HttpEngine;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
invoke-direct {p0}, Lokhttp3/internal/http/HttpEngine;->readNetworkResponse()Lokhttp3/Response;
move-result-object v0
return-object v0
.end method
.method private cacheWritingResponse(Lokhttp3/internal/http/CacheRequest;Lokhttp3/Response;)Lokhttp3/Response;
.locals 8
.param p1, "cacheRequest" # Lokhttp3/internal/http/CacheRequest;
.param p2, "response" # Lokhttp3/Response;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
if-nez p1, :cond_1
.end local p2 # "response":Lokhttp3/Response;
:cond_0
:goto_0
return-object p2
.restart local p2 # "response":Lokhttp3/Response;
:cond_1
invoke-interface {p1}, Lokhttp3/internal/http/CacheRequest;->body()Lokio/Sink;
move-result-object v1
.local v1, "cacheBodyUnbuffered":Lokio/Sink;
if-eqz v1, :cond_0
invoke-virtual {p2}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
move-result-object v4
invoke-virtual {v4}, Lokhttp3/ResponseBody;->source()Lokio/BufferedSource;
move-result-object v3
.local v3, "source":Lokio/BufferedSource;
invoke-static {v1}, Lokio/Okio;->buffer(Lokio/Sink;)Lokio/BufferedSink;
move-result-object v0
.local v0, "cacheBody":Lokio/BufferedSink;
new-instance v2, Lokhttp3/internal/http/HttpEngine$2;
invoke-direct {v2, p0, v3, p1, v0}, Lokhttp3/internal/http/HttpEngine$2;-><init>(Lokhttp3/internal/http/HttpEngine;Lokio/BufferedSource;Lokhttp3/internal/http/CacheRequest;Lokio/BufferedSink;)V
.local v2, "cacheWritingSource":Lokio/Source;
invoke-virtual {p2}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder;
move-result-object v4
new-instance v5, Lokhttp3/internal/http/RealResponseBody;
invoke-virtual {p2}, Lokhttp3/Response;->headers()Lokhttp3/Headers;
move-result-object v6
invoke-static {v2}, Lokio/Okio;->buffer(Lokio/Source;)Lokio/BufferedSource;
move-result-object v7
invoke-direct {v5, v6, v7}, Lokhttp3/internal/http/RealResponseBody;-><init>(Lokhttp3/Headers;Lokio/BufferedSource;)V
invoke-virtual {v4, v5}, Lokhttp3/Response$Builder;->body(Lokhttp3/ResponseBody;)Lokhttp3/Response$Builder;
move-result-object v4
invoke-virtual {v4}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
move-result-object p2
goto :goto_0
.end method
.method private static combine(Lokhttp3/Headers;Lokhttp3/Headers;)Lokhttp3/Headers;
.locals 6
.param p0, "cachedHeaders" # Lokhttp3/Headers;
.param p1, "networkHeaders" # Lokhttp3/Headers;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
new-instance v2, Lokhttp3/Headers$Builder;
invoke-direct {v2}, Lokhttp3/Headers$Builder;-><init>()V
.local v2, "result":Lokhttp3/Headers$Builder;
const/4 v1, 0x0
.local v1, "i":I
invoke-virtual {p0}, Lokhttp3/Headers;->size()I
move-result v3
.local v3, "size":I
:goto_0
if-ge v1, v3, :cond_3
invoke-virtual {p0, v1}, Lokhttp3/Headers;->name(I)Ljava/lang/String;
move-result-object v0
.local v0, "fieldName":Ljava/lang/String;
invoke-virtual {p0, v1}, Lokhttp3/Headers;->value(I)Ljava/lang/String;
move-result-object v4
.local v4, "value":Ljava/lang/String;
const-string v5, "Warning"
invoke-virtual {v5, v0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v5
if-eqz v5, :cond_1
const-string v5, "1"
invoke-virtual {v4, v5}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
move-result v5
if-eqz v5, :cond_1
:cond_0
:goto_1
add-int/lit8 v1, v1, 0x1
goto :goto_0
:cond_1
invoke-static {v0}, Lokhttp3/internal/http/OkHeaders;->isEndToEnd(Ljava/lang/String;)Z
move-result v5
if-eqz v5, :cond_2
invoke-virtual {p1, v0}, Lokhttp3/Headers;->get(Ljava/lang/String;)Ljava/lang/String;
move-result-object v5
if-nez v5, :cond_0
:cond_2
invoke-virtual {v2, v0, v4}, Lokhttp3/Headers$Builder;->add(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Headers$Builder;
goto :goto_1
.end local v0 # "fieldName":Ljava/lang/String;
.end local v4 # "value":Ljava/lang/String;
:cond_3
const/4 v1, 0x0
invoke-virtual {p1}, Lokhttp3/Headers;->size()I
move-result v3
:goto_2
if-ge v1, v3, :cond_6
invoke-virtual {p1, v1}, Lokhttp3/Headers;->name(I)Ljava/lang/String;
move-result-object v0
.restart local v0 # "fieldName":Ljava/lang/String;
const-string v5, "Content-Length"
invoke-virtual {v5, v0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v5
if-eqz v5, :cond_5
:cond_4
:goto_3
add-int/lit8 v1, v1, 0x1
goto :goto_2
:cond_5
invoke-static {v0}, Lokhttp3/internal/http/OkHeaders;->isEndToEnd(Ljava/lang/String;)Z
move-result v5
if-eqz v5, :cond_4
invoke-virtual {p1, v1}, Lokhttp3/Headers;->value(I)Ljava/lang/String;
move-result-object v5
invoke-virtual {v2, v0, v5}, Lokhttp3/Headers$Builder;->add(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Headers$Builder;
goto :goto_3
.end local v0 # "fieldName":Ljava/lang/String;
:cond_6
invoke-virtual {v2}, Lokhttp3/Headers$Builder;->build()Lokhttp3/Headers;
move-result-object v5
return-object v5
.end method
.method private connect()Lokhttp3/internal/http/HttpStream;
.locals 6
.annotation system Ldalvik/annotation/Throws;
value = {
Lokhttp3/internal/http/RouteException;,
Lokhttp3/internal/http/RequestException;,
Ljava/io/IOException;
}
.end annotation
.prologue
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
invoke-virtual {v0}, Lokhttp3/Request;->method()Ljava/lang/String;
move-result-object v0
const-string v1, "GET"
invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-nez v0, :cond_0
const/4 v5, 0x1
.local v5, "doExtensiveHealthChecks":Z
:goto_0
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->streamAllocation:Lokhttp3/internal/http/StreamAllocation;
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
invoke-virtual {v1}, Lokhttp3/OkHttpClient;->connectTimeoutMillis()I
move-result v1
iget-object v2, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
invoke-virtual {v2}, Lokhttp3/OkHttpClient;->readTimeoutMillis()I
move-result v2
iget-object v3, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
invoke-virtual {v3}, Lokhttp3/OkHttpClient;->writeTimeoutMillis()I
move-result v3
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
invoke-virtual {v4}, Lokhttp3/OkHttpClient;->retryOnConnectionFailure()Z
move-result v4
invoke-virtual/range {v0 .. v5}, Lokhttp3/internal/http/StreamAllocation;->newStream(IIIZZ)Lokhttp3/internal/http/HttpStream;
move-result-object v0
return-object v0
.end local v5 # "doExtensiveHealthChecks":Z
:cond_0
const/4 v5, 0x0
goto :goto_0
.end method
.method private cookieHeader(Ljava/util/List;)Ljava/lang/String;
.locals 6
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/List",
"<",
"Lokhttp3/Cookie;",
">;)",
"Ljava/lang/String;"
}
.end annotation
.prologue
.local p1, "cookies":Ljava/util/List;, "Ljava/util/List<Lokhttp3/Cookie;>;"
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
.local v1, "cookieHeader":Ljava/lang/StringBuilder;
const/4 v2, 0x0
.local v2, "i":I
invoke-interface {p1}, Ljava/util/List;->size()I
move-result v3
.local v3, "size":I
:goto_0
if-ge v2, v3, :cond_1
if-lez v2, :cond_0
const-string v4, "; "
invoke-virtual {v1, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
:cond_0
invoke-interface {p1, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v0
check-cast v0, Lokhttp3/Cookie;
.local v0, "cookie":Lokhttp3/Cookie;
invoke-virtual {v0}, Lokhttp3/Cookie;->name()Ljava/lang/String;
move-result-object v4
invoke-virtual {v1, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
const/16 v5, 0x3d
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v0}, Lokhttp3/Cookie;->value()Ljava/lang/String;
move-result-object v5
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
add-int/lit8 v2, v2, 0x1
goto :goto_0
.end local v0 # "cookie":Lokhttp3/Cookie;
:cond_1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v4
return-object v4
.end method
.method private static createAddress(Lokhttp3/OkHttpClient;Lokhttp3/Request;)Lokhttp3/Address;
.locals 13
.param p0, "client" # Lokhttp3/OkHttpClient;
.param p1, "request" # Lokhttp3/Request;
.prologue
const/4 v5, 0x0
.local v5, "sslSocketFactory":Ljavax/net/ssl/SSLSocketFactory;
const/4 v6, 0x0
.local v6, "hostnameVerifier":Ljavax/net/ssl/HostnameVerifier;
const/4 v7, 0x0
.local v7, "certificatePinner":Lokhttp3/CertificatePinner;
invoke-virtual {p1}, Lokhttp3/Request;->isHttps()Z
move-result v0
if-eqz v0, :cond_0
invoke-virtual {p0}, Lokhttp3/OkHttpClient;->sslSocketFactory()Ljavax/net/ssl/SSLSocketFactory;
move-result-object v5
invoke-virtual {p0}, Lokhttp3/OkHttpClient;->hostnameVerifier()Ljavax/net/ssl/HostnameVerifier;
move-result-object v6
invoke-virtual {p0}, Lokhttp3/OkHttpClient;->certificatePinner()Lokhttp3/CertificatePinner;
move-result-object v7
:cond_0
new-instance v0, Lokhttp3/Address;
invoke-virtual {p1}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
move-result-object v1
invoke-virtual {v1}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
move-result-object v1
invoke-virtual {p1}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
move-result-object v2
invoke-virtual {v2}, Lokhttp3/HttpUrl;->port()I
move-result v2
invoke-virtual {p0}, Lokhttp3/OkHttpClient;->dns()Lokhttp3/Dns;
move-result-object v3
invoke-virtual {p0}, Lokhttp3/OkHttpClient;->socketFactory()Ljavax/net/SocketFactory;
move-result-object v4
invoke-virtual {p0}, Lokhttp3/OkHttpClient;->proxyAuthenticator()Lokhttp3/Authenticator;
move-result-object v8
invoke-virtual {p0}, Lokhttp3/OkHttpClient;->proxy()Ljava/net/Proxy;
move-result-object v9
invoke-virtual {p0}, Lokhttp3/OkHttpClient;->protocols()Ljava/util/List;
move-result-object v10
invoke-virtual {p0}, Lokhttp3/OkHttpClient;->connectionSpecs()Ljava/util/List;
move-result-object v11
invoke-virtual {p0}, Lokhttp3/OkHttpClient;->proxySelector()Ljava/net/ProxySelector;
move-result-object v12
invoke-direct/range {v0 .. v12}, Lokhttp3/Address;-><init>(Ljava/lang/String;ILokhttp3/Dns;Ljavax/net/SocketFactory;Ljavax/net/ssl/SSLSocketFactory;Ljavax/net/ssl/HostnameVerifier;Lokhttp3/CertificatePinner;Lokhttp3/Authenticator;Ljava/net/Proxy;Ljava/util/List;Ljava/util/List;Ljava/net/ProxySelector;)V
return-object v0
.end method
.method public static hasBody(Lokhttp3/Response;)Z
.locals 8
.param p0, "response" # Lokhttp3/Response;
.prologue
const/4 v2, 0x1
const/4 v1, 0x0
invoke-virtual {p0}, Lokhttp3/Response;->request()Lokhttp3/Request;
move-result-object v3
invoke-virtual {v3}, Lokhttp3/Request;->method()Ljava/lang/String;
move-result-object v3
const-string v4, "HEAD"
invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_1
:cond_0
:goto_0
return v1
:cond_1
invoke-virtual {p0}, Lokhttp3/Response;->code()I
move-result v0
.local v0, "responseCode":I
const/16 v3, 0x64
if-lt v0, v3, :cond_2
const/16 v3, 0xc8
if-lt v0, v3, :cond_3
:cond_2
const/16 v3, 0xcc
if-eq v0, v3, :cond_3
const/16 v3, 0x130
if-eq v0, v3, :cond_3
move v1, v2
goto :goto_0
:cond_3
invoke-static {p0}, Lokhttp3/internal/http/OkHeaders;->contentLength(Lokhttp3/Response;)J
move-result-wide v4
const-wide/16 v6, -0x1
cmp-long v3, v4, v6
if-nez v3, :cond_4
const-string v3, "chunked"
const-string v4, "Transfer-Encoding"
invoke-virtual {p0, v4}, Lokhttp3/Response;->header(Ljava/lang/String;)Ljava/lang/String;
move-result-object v4
invoke-virtual {v3, v4}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v3
if-eqz v3, :cond_0
:cond_4
move v1, v2
goto :goto_0
.end method
.method private maybeCache()V
.locals 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
sget-object v1, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
iget-object v2, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
invoke-virtual {v1, v2}, Lokhttp3/internal/Internal;->internalCache(Lokhttp3/OkHttpClient;)Lokhttp3/internal/InternalCache;
move-result-object v0
.local v0, "responseCache":Lokhttp3/internal/InternalCache;
if-nez v0, :cond_1
:cond_0
:goto_0
return-void
:cond_1
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
iget-object v2, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
invoke-static {v1, v2}, Lokhttp3/internal/http/CacheStrategy;->isCacheable(Lokhttp3/Response;Lokhttp3/Request;)Z
move-result v1
if-nez v1, :cond_2
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
invoke-virtual {v1}, Lokhttp3/Request;->method()Ljava/lang/String;
move-result-object v1
invoke-static {v1}, Lokhttp3/internal/http/HttpMethod;->invalidatesCache(Ljava/lang/String;)Z
move-result v1
if-eqz v1, :cond_0
:try_start_0
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
invoke-interface {v0, v1}, Lokhttp3/internal/InternalCache;->remove(Lokhttp3/Request;)V
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
goto :goto_0
:catch_0
move-exception v1
goto :goto_0
:cond_2
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
invoke-static {v1}, Lokhttp3/internal/http/HttpEngine;->stripBody(Lokhttp3/Response;)Lokhttp3/Response;
move-result-object v1
invoke-interface {v0, v1}, Lokhttp3/internal/InternalCache;->put(Lokhttp3/Response;)Lokhttp3/internal/http/CacheRequest;
move-result-object v1
iput-object v1, p0, Lokhttp3/internal/http/HttpEngine;->storeRequest:Lokhttp3/internal/http/CacheRequest;
goto :goto_0
.end method
.method private networkRequest(Lokhttp3/Request;)Lokhttp3/Request;
.locals 5
.param p1, "request" # Lokhttp3/Request;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
invoke-virtual {p1}, Lokhttp3/Request;->newBuilder()Lokhttp3/Request$Builder;
move-result-object v1
.local v1, "result":Lokhttp3/Request$Builder;
const-string v2, "Host"
invoke-virtual {p1, v2}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
move-result-object v2
if-nez v2, :cond_0
const-string v2, "Host"
invoke-virtual {p1}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
move-result-object v3
const/4 v4, 0x0
invoke-static {v3, v4}, Lokhttp3/internal/Util;->hostHeader(Lokhttp3/HttpUrl;Z)Ljava/lang/String;
move-result-object v3
invoke-virtual {v1, v2, v3}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
:cond_0
const-string v2, "Connection"
invoke-virtual {p1, v2}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
move-result-object v2
if-nez v2, :cond_1
const-string v2, "Connection"
const-string v3, "Keep-Alive"
invoke-virtual {v1, v2, v3}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
:cond_1
const-string v2, "Accept-Encoding"
invoke-virtual {p1, v2}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
move-result-object v2
if-nez v2, :cond_2
const/4 v2, 0x1
iput-boolean v2, p0, Lokhttp3/internal/http/HttpEngine;->transparentGzip:Z
const-string v2, "Accept-Encoding"
const-string v3, "gzip"
invoke-virtual {v1, v2, v3}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
:cond_2
iget-object v2, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
invoke-virtual {v2}, Lokhttp3/OkHttpClient;->cookieJar()Lokhttp3/CookieJar;
move-result-object v2
invoke-virtual {p1}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
move-result-object v3
invoke-interface {v2, v3}, Lokhttp3/CookieJar;->loadForRequest(Lokhttp3/HttpUrl;)Ljava/util/List;
move-result-object v0
.local v0, "cookies":Ljava/util/List;, "Ljava/util/List<Lokhttp3/Cookie;>;"
invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
move-result v2
if-nez v2, :cond_3
const-string v2, "Cookie"
invoke-direct {p0, v0}, Lokhttp3/internal/http/HttpEngine;->cookieHeader(Ljava/util/List;)Ljava/lang/String;
move-result-object v3
invoke-virtual {v1, v2, v3}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
:cond_3
const-string v2, "User-Agent"
invoke-virtual {p1, v2}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
move-result-object v2
if-nez v2, :cond_4
const-string v2, "User-Agent"
invoke-static {}, Lokhttp3/internal/Version;->userAgent()Ljava/lang/String;
move-result-object v3
invoke-virtual {v1, v2, v3}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
:cond_4
invoke-virtual {v1}, Lokhttp3/Request$Builder;->build()Lokhttp3/Request;
move-result-object v2
return-object v2
.end method
.method private readNetworkResponse()Lokhttp3/Response;
.locals 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->httpStream:Lokhttp3/internal/http/HttpStream;
invoke-interface {v1}, Lokhttp3/internal/http/HttpStream;->finishRequest()V
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->httpStream:Lokhttp3/internal/http/HttpStream;
invoke-interface {v1}, Lokhttp3/internal/http/HttpStream;->readResponseHeaders()Lokhttp3/Response$Builder;
move-result-object v1
iget-object v2, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
invoke-virtual {v1, v2}, Lokhttp3/Response$Builder;->request(Lokhttp3/Request;)Lokhttp3/Response$Builder;
move-result-object v1
iget-object v2, p0, Lokhttp3/internal/http/HttpEngine;->streamAllocation:Lokhttp3/internal/http/StreamAllocation;
invoke-virtual {v2}, Lokhttp3/internal/http/StreamAllocation;->connection()Lokhttp3/internal/io/RealConnection;
move-result-object v2
invoke-virtual {v2}, Lokhttp3/internal/io/RealConnection;->handshake()Lokhttp3/Handshake;
move-result-object v2
invoke-virtual {v1, v2}, Lokhttp3/Response$Builder;->handshake(Lokhttp3/Handshake;)Lokhttp3/Response$Builder;
move-result-object v1
sget-object v2, Lokhttp3/internal/http/OkHeaders;->SENT_MILLIS:Ljava/lang/String;
iget-wide v4, p0, Lokhttp3/internal/http/HttpEngine;->sentRequestMillis:J
invoke-static {v4, v5}, Ljava/lang/Long;->toString(J)Ljava/lang/String;
move-result-object v3
invoke-virtual {v1, v2, v3}, Lokhttp3/Response$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Response$Builder;
move-result-object v1
sget-object v2, Lokhttp3/internal/http/OkHeaders;->RECEIVED_MILLIS:Ljava/lang/String;
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v4
invoke-static {v4, v5}, Ljava/lang/Long;->toString(J)Ljava/lang/String;
move-result-object v3
invoke-virtual {v1, v2, v3}, Lokhttp3/Response$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Response$Builder;
move-result-object v1
invoke-virtual {v1}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
move-result-object v0
.local v0, "networkResponse":Lokhttp3/Response;
iget-boolean v1, p0, Lokhttp3/internal/http/HttpEngine;->forWebSocket:Z
if-nez v1, :cond_0
invoke-virtual {v0}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder;
move-result-object v1
iget-object v2, p0, Lokhttp3/internal/http/HttpEngine;->httpStream:Lokhttp3/internal/http/HttpStream;
invoke-interface {v2, v0}, Lokhttp3/internal/http/HttpStream;->openResponseBody(Lokhttp3/Response;)Lokhttp3/ResponseBody;
move-result-object v2
invoke-virtual {v1, v2}, Lokhttp3/Response$Builder;->body(Lokhttp3/ResponseBody;)Lokhttp3/Response$Builder;
move-result-object v1
invoke-virtual {v1}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
move-result-object v0
:cond_0
const-string v1, "close"
invoke-virtual {v0}, Lokhttp3/Response;->request()Lokhttp3/Request;
move-result-object v2
const-string v3, "Connection"
invoke-virtual {v2, v3}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v1
if-nez v1, :cond_1
const-string v1, "close"
const-string v2, "Connection"
invoke-virtual {v0, v2}, Lokhttp3/Response;->header(Ljava/lang/String;)Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v1
if-eqz v1, :cond_2
:cond_1
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->streamAllocation:Lokhttp3/internal/http/StreamAllocation;
invoke-virtual {v1}, Lokhttp3/internal/http/StreamAllocation;->noNewStreams()V
:cond_2
return-object v0
.end method
.method private static stripBody(Lokhttp3/Response;)Lokhttp3/Response;
.locals 2
.param p0, "response" # Lokhttp3/Response;
.prologue
if-eqz p0, :cond_0
invoke-virtual {p0}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
move-result-object v0
if-eqz v0, :cond_0
invoke-virtual {p0}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder;
move-result-object v0
const/4 v1, 0x0
invoke-virtual {v0, v1}, Lokhttp3/Response$Builder;->body(Lokhttp3/ResponseBody;)Lokhttp3/Response$Builder;
move-result-object v0
invoke-virtual {v0}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
move-result-object p0
.end local p0 # "response":Lokhttp3/Response;
:cond_0
return-object p0
.end method
.method private unzip(Lokhttp3/Response;)Lokhttp3/Response;
.locals 5
.param p1, "response" # Lokhttp3/Response;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
iget-boolean v2, p0, Lokhttp3/internal/http/HttpEngine;->transparentGzip:Z
if-eqz v2, :cond_0
const-string v2, "gzip"
iget-object v3, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
const-string v4, "Content-Encoding"
invoke-virtual {v3, v4}, Lokhttp3/Response;->header(Ljava/lang/String;)Ljava/lang/String;
move-result-object v3
invoke-virtual {v2, v3}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v2
if-nez v2, :cond_1
.end local p1 # "response":Lokhttp3/Response;
:cond_0
:goto_0
return-object p1
.restart local p1 # "response":Lokhttp3/Response;
:cond_1
invoke-virtual {p1}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
move-result-object v2
if-eqz v2, :cond_0
new-instance v0, Lokio/GzipSource;
invoke-virtual {p1}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
move-result-object v2
invoke-virtual {v2}, Lokhttp3/ResponseBody;->source()Lokio/BufferedSource;
move-result-object v2
invoke-direct {v0, v2}, Lokio/GzipSource;-><init>(Lokio/Source;)V
.local v0, "responseBody":Lokio/GzipSource;
invoke-virtual {p1}, Lokhttp3/Response;->headers()Lokhttp3/Headers;
move-result-object v2
invoke-virtual {v2}, Lokhttp3/Headers;->newBuilder()Lokhttp3/Headers$Builder;
move-result-object v2
const-string v3, "Content-Encoding"
invoke-virtual {v2, v3}, Lokhttp3/Headers$Builder;->removeAll(Ljava/lang/String;)Lokhttp3/Headers$Builder;
move-result-object v2
const-string v3, "Content-Length"
invoke-virtual {v2, v3}, Lokhttp3/Headers$Builder;->removeAll(Ljava/lang/String;)Lokhttp3/Headers$Builder;
move-result-object v2
invoke-virtual {v2}, Lokhttp3/Headers$Builder;->build()Lokhttp3/Headers;
move-result-object v1
.local v1, "strippedHeaders":Lokhttp3/Headers;
invoke-virtual {p1}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder;
move-result-object v2
invoke-virtual {v2, v1}, Lokhttp3/Response$Builder;->headers(Lokhttp3/Headers;)Lokhttp3/Response$Builder;
move-result-object v2
new-instance v3, Lokhttp3/internal/http/RealResponseBody;
invoke-static {v0}, Lokio/Okio;->buffer(Lokio/Source;)Lokio/BufferedSource;
move-result-object v4
invoke-direct {v3, v1, v4}, Lokhttp3/internal/http/RealResponseBody;-><init>(Lokhttp3/Headers;Lokio/BufferedSource;)V
invoke-virtual {v2, v3}, Lokhttp3/Response$Builder;->body(Lokhttp3/ResponseBody;)Lokhttp3/Response$Builder;
move-result-object v2
invoke-virtual {v2}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
move-result-object p1
goto :goto_0
.end method
.method private static validate(Lokhttp3/Response;Lokhttp3/Response;)Z
.locals 8
.param p0, "cached" # Lokhttp3/Response;
.param p1, "network" # Lokhttp3/Response;
.prologue
const/4 v2, 0x1
invoke-virtual {p1}, Lokhttp3/Response;->code()I
move-result v3
const/16 v4, 0x130
if-ne v3, v4, :cond_1
:cond_0
:goto_0
return v2
:cond_1
invoke-virtual {p0}, Lokhttp3/Response;->headers()Lokhttp3/Headers;
move-result-object v3
const-string v4, "Last-Modified"
invoke-virtual {v3, v4}, Lokhttp3/Headers;->getDate(Ljava/lang/String;)Ljava/util/Date;
move-result-object v0
.local v0, "lastModified":Ljava/util/Date;
if-eqz v0, :cond_2
invoke-virtual {p1}, Lokhttp3/Response;->headers()Lokhttp3/Headers;
move-result-object v3
const-string v4, "Last-Modified"
invoke-virtual {v3, v4}, Lokhttp3/Headers;->getDate(Ljava/lang/String;)Ljava/util/Date;
move-result-object v1
.local v1, "networkLastModified":Ljava/util/Date;
if-eqz v1, :cond_2
invoke-virtual {v1}, Ljava/util/Date;->getTime()J
move-result-wide v4
invoke-virtual {v0}, Ljava/util/Date;->getTime()J
move-result-wide v6
cmp-long v3, v4, v6
if-ltz v3, :cond_0
.end local v1 # "networkLastModified":Ljava/util/Date;
:cond_2
const/4 v2, 0x0
goto :goto_0
.end method
.method private writeRequestHeadersEagerly()Z
.locals 1
.prologue
iget-boolean v0, p0, Lokhttp3/internal/http/HttpEngine;->callerWritesRequestBody:Z
if-eqz v0, :cond_0
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
invoke-virtual {p0, v0}, Lokhttp3/internal/http/HttpEngine;->permitsRequestBody(Lokhttp3/Request;)Z
move-result v0
if-eqz v0, :cond_0
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
if-nez v0, :cond_0
const/4 v0, 0x1
:goto_0
return v0
:cond_0
const/4 v0, 0x0
goto :goto_0
.end method
# virtual methods
.method public cancel()V
.locals 1
.prologue
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->streamAllocation:Lokhttp3/internal/http/StreamAllocation;
invoke-virtual {v0}, Lokhttp3/internal/http/StreamAllocation;->cancel()V
return-void
.end method
.method public close()Lokhttp3/internal/http/StreamAllocation;
.locals 2
.prologue
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->bufferedRequestBody:Lokio/BufferedSink;
if-eqz v0, :cond_1
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->bufferedRequestBody:Lokio/BufferedSink;
invoke-static {v0}, Lokhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V
:cond_0
:goto_0
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
if-eqz v0, :cond_2
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
invoke-virtual {v0}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
move-result-object v0
invoke-static {v0}, Lokhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V
:goto_1
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->streamAllocation:Lokhttp3/internal/http/StreamAllocation;
return-object v0
:cond_1
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
if-eqz v0, :cond_0
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
invoke-static {v0}, Lokhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V
goto :goto_0
:cond_2
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->streamAllocation:Lokhttp3/internal/http/StreamAllocation;
const/4 v1, 0x0
invoke-virtual {v0, v1}, Lokhttp3/internal/http/StreamAllocation;->connectionFailed(Ljava/io/IOException;)V
goto :goto_1
.end method
.method public followUpRequest()Lokhttp3/Request;
.locals 13
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
const/4 v10, 0x0
iget-object v11, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
if-nez v11, :cond_0
new-instance v10, Ljava/lang/IllegalStateException;
invoke-direct {v10}, Ljava/lang/IllegalStateException;-><init>()V
throw v10
:cond_0
iget-object v11, p0, Lokhttp3/internal/http/HttpEngine;->streamAllocation:Lokhttp3/internal/http/StreamAllocation;
invoke-virtual {v11}, Lokhttp3/internal/http/StreamAllocation;->connection()Lokhttp3/internal/io/RealConnection;
move-result-object v0
.local v0, "connection":Lokhttp3/Connection;
if-eqz v0, :cond_2
invoke-interface {v0}, Lokhttp3/Connection;->route()Lokhttp3/Route;
move-result-object v6
.local v6, "route":Lokhttp3/Route;
:goto_0
iget-object v11, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
invoke-virtual {v11}, Lokhttp3/Response;->code()I
move-result v4
.local v4, "responseCode":I
iget-object v11, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
invoke-virtual {v11}, Lokhttp3/Request;->method()Ljava/lang/String;
move-result-object v2
.local v2, "method":Ljava/lang/String;
sparse-switch v4, :sswitch_data_0
:cond_1
:goto_1
return-object v10
.end local v2 # "method":Ljava/lang/String;
.end local v4 # "responseCode":I
.end local v6 # "route":Lokhttp3/Route;
:cond_2
move-object v6, v10
goto :goto_0
.restart local v2 # "method":Ljava/lang/String;
.restart local v4 # "responseCode":I
.restart local v6 # "route":Lokhttp3/Route;
:sswitch_0
if-eqz v6, :cond_3
invoke-virtual {v6}, Lokhttp3/Route;->proxy()Ljava/net/Proxy;
move-result-object v8
.local v8, "selectedProxy":Ljava/net/Proxy;
:goto_2
invoke-virtual {v8}, Ljava/net/Proxy;->type()Ljava/net/Proxy$Type;
move-result-object v10
sget-object v11, Ljava/net/Proxy$Type;->HTTP:Ljava/net/Proxy$Type;
if-eq v10, v11, :cond_4
new-instance v10, Ljava/net/ProtocolException;
const-string v11, "Received HTTP_PROXY_AUTH (407) code while not using proxy"
invoke-direct {v10, v11}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
throw v10
.end local v8 # "selectedProxy":Ljava/net/Proxy;
:cond_3
iget-object v10, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
invoke-virtual {v10}, Lokhttp3/OkHttpClient;->proxy()Ljava/net/Proxy;
move-result-object v8
goto :goto_2
:cond_4
:sswitch_1
iget-object v10, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
invoke-virtual {v10}, Lokhttp3/OkHttpClient;->authenticator()Lokhttp3/Authenticator;
move-result-object v10
iget-object v11, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
invoke-interface {v10, v6, v11}, Lokhttp3/Authenticator;->authenticate(Lokhttp3/Route;Lokhttp3/Response;)Lokhttp3/Request;
move-result-object v10
goto :goto_1
:sswitch_2
const-string v11, "GET"
invoke-virtual {v2, v11}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v11
if-nez v11, :cond_5
const-string v11, "HEAD"
invoke-virtual {v2, v11}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v11
if-eqz v11, :cond_1
:cond_5
:sswitch_3
iget-object v11, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
invoke-virtual {v11}, Lokhttp3/OkHttpClient;->followRedirects()Z
move-result v11
if-eqz v11, :cond_1
iget-object v11, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
const-string v12, "Location"
invoke-virtual {v11, v12}, Lokhttp3/Response;->header(Ljava/lang/String;)Ljava/lang/String;
move-result-object v1
.local v1, "location":Ljava/lang/String;
if-eqz v1, :cond_1
iget-object v11, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
invoke-virtual {v11}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
move-result-object v11
invoke-virtual {v11, v1}, Lokhttp3/HttpUrl;->resolve(Ljava/lang/String;)Lokhttp3/HttpUrl;
move-result-object v9
.local v9, "url":Lokhttp3/HttpUrl;
if-eqz v9, :cond_1
invoke-virtual {v9}, Lokhttp3/HttpUrl;->scheme()Ljava/lang/String;
move-result-object v11
iget-object v12, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
invoke-virtual {v12}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
move-result-object v12
invoke-virtual {v12}, Lokhttp3/HttpUrl;->scheme()Ljava/lang/String;
move-result-object v12
invoke-virtual {v11, v12}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v7
.local v7, "sameScheme":Z
if-nez v7, :cond_6
iget-object v11, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
invoke-virtual {v11}, Lokhttp3/OkHttpClient;->followSslRedirects()Z
move-result v11
if-eqz v11, :cond_1
:cond_6
iget-object v11, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
invoke-virtual {v11}, Lokhttp3/Request;->newBuilder()Lokhttp3/Request$Builder;
move-result-object v3
.local v3, "requestBuilder":Lokhttp3/Request$Builder;
invoke-static {v2}, Lokhttp3/internal/http/HttpMethod;->permitsRequestBody(Ljava/lang/String;)Z
move-result v11
if-eqz v11, :cond_7
invoke-static {v2}, Lokhttp3/internal/http/HttpMethod;->redirectsToGet(Ljava/lang/String;)Z
move-result v11
if-eqz v11, :cond_9
const-string v11, "GET"
invoke-virtual {v3, v11, v10}, Lokhttp3/Request$Builder;->method(Ljava/lang/String;Lokhttp3/RequestBody;)Lokhttp3/Request$Builder;
:goto_3
const-string v10, "Transfer-Encoding"
invoke-virtual {v3, v10}, Lokhttp3/Request$Builder;->removeHeader(Ljava/lang/String;)Lokhttp3/Request$Builder;
const-string v10, "Content-Length"
invoke-virtual {v3, v10}, Lokhttp3/Request$Builder;->removeHeader(Ljava/lang/String;)Lokhttp3/Request$Builder;
const-string v10, "Content-Type"
invoke-virtual {v3, v10}, Lokhttp3/Request$Builder;->removeHeader(Ljava/lang/String;)Lokhttp3/Request$Builder;
:cond_7
invoke-virtual {p0, v9}, Lokhttp3/internal/http/HttpEngine;->sameConnection(Lokhttp3/HttpUrl;)Z
move-result v10
if-nez v10, :cond_8
const-string v10, "Authorization"
invoke-virtual {v3, v10}, Lokhttp3/Request$Builder;->removeHeader(Ljava/lang/String;)Lokhttp3/Request$Builder;
:cond_8
invoke-virtual {v3, v9}, Lokhttp3/Request$Builder;->url(Lokhttp3/HttpUrl;)Lokhttp3/Request$Builder;
move-result-object v10
invoke-virtual {v10}, Lokhttp3/Request$Builder;->build()Lokhttp3/Request;
move-result-object v10
goto/16 :goto_1
:cond_9
invoke-virtual {v3, v2, v10}, Lokhttp3/Request$Builder;->method(Ljava/lang/String;Lokhttp3/RequestBody;)Lokhttp3/Request$Builder;
goto :goto_3
.end local v1 # "location":Ljava/lang/String;
.end local v3 # "requestBuilder":Lokhttp3/Request$Builder;
.end local v7 # "sameScheme":Z
.end local v9 # "url":Lokhttp3/HttpUrl;
:sswitch_4
iget-object v11, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
if-eqz v11, :cond_a
iget-object v11, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
instance-of v11, v11, Lokhttp3/internal/http/RetryableSink;
if-eqz v11, :cond_c
:cond_a
const/4 v5, 0x1
.local v5, "retryableBody":Z
:goto_4
iget-boolean v11, p0, Lokhttp3/internal/http/HttpEngine;->callerWritesRequestBody:Z
if-eqz v11, :cond_b
if-eqz v5, :cond_1
:cond_b
iget-object v10, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
goto/16 :goto_1
.end local v5 # "retryableBody":Z
:cond_c
const/4 v5, 0x0
goto :goto_4
nop
:sswitch_data_0
.sparse-switch
0x12c -> :sswitch_3
0x12d -> :sswitch_3
0x12e -> :sswitch_3
0x12f -> :sswitch_3
0x133 -> :sswitch_2
0x134 -> :sswitch_2
0x191 -> :sswitch_1
0x197 -> :sswitch_0
0x198 -> :sswitch_4
.end sparse-switch
.end method
.method public getBufferedRequestBody()Lokio/BufferedSink;
.locals 3
.prologue
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->bufferedRequestBody:Lokio/BufferedSink;
.local v1, "result":Lokio/BufferedSink;
if-eqz v1, :cond_0
.end local v1 # "result":Lokio/BufferedSink;
:goto_0
return-object v1
.restart local v1 # "result":Lokio/BufferedSink;
:cond_0
invoke-virtual {p0}, Lokhttp3/internal/http/HttpEngine;->getRequestBody()Lokio/Sink;
move-result-object v0
.local v0, "requestBody":Lokio/Sink;
if-eqz v0, :cond_1
invoke-static {v0}, Lokio/Okio;->buffer(Lokio/Sink;)Lokio/BufferedSink;
move-result-object v2
iput-object v2, p0, Lokhttp3/internal/http/HttpEngine;->bufferedRequestBody:Lokio/BufferedSink;
:goto_1
move-object v1, v2
goto :goto_0
:cond_1
const/4 v2, 0x0
goto :goto_1
.end method
.method public getConnection()Lokhttp3/Connection;
.locals 1
.prologue
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->streamAllocation:Lokhttp3/internal/http/StreamAllocation;
invoke-virtual {v0}, Lokhttp3/internal/http/StreamAllocation;->connection()Lokhttp3/internal/io/RealConnection;
move-result-object v0
return-object v0
.end method
.method public getRequest()Lokhttp3/Request;
.locals 1
.prologue
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
return-object v0
.end method
.method public getRequestBody()Lokio/Sink;
.locals 1
.prologue
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->cacheStrategy:Lokhttp3/internal/http/CacheStrategy;
if-nez v0, :cond_0
new-instance v0, Ljava/lang/IllegalStateException;
invoke-direct {v0}, Ljava/lang/IllegalStateException;-><init>()V
throw v0
:cond_0
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
return-object v0
.end method
.method public getResponse()Lokhttp3/Response;
.locals 1
.prologue
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
if-nez v0, :cond_0
new-instance v0, Ljava/lang/IllegalStateException;
invoke-direct {v0}, Ljava/lang/IllegalStateException;-><init>()V
throw v0
:cond_0
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
return-object v0
.end method
.method public hasResponse()Z
.locals 1
.prologue
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
if-eqz v0, :cond_0
const/4 v0, 0x1
:goto_0
return v0
:cond_0
const/4 v0, 0x0
goto :goto_0
.end method
.method permitsRequestBody(Lokhttp3/Request;)Z
.locals 1
.param p1, "request" # Lokhttp3/Request;
.prologue
invoke-virtual {p1}, Lokhttp3/Request;->method()Ljava/lang/String;
move-result-object v0
invoke-static {v0}, Lokhttp3/internal/http/HttpMethod;->permitsRequestBody(Ljava/lang/String;)Z
move-result v0
return v0
.end method
.method public readResponse()V
.locals 10
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
const-wide/16 v8, -0x1
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
if-eqz v4, :cond_1
:cond_0
:goto_0
return-void
:cond_1
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
if-nez v4, :cond_2
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->cacheResponse:Lokhttp3/Response;
if-nez v4, :cond_2
new-instance v4, Ljava/lang/IllegalStateException;
const-string v5, "call sendRequest() first!"
invoke-direct {v4, v5}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v4
:cond_2
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
if-eqz v4, :cond_0
iget-boolean v4, p0, Lokhttp3/internal/http/HttpEngine;->forWebSocket:Z
if-eqz v4, :cond_3
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->httpStream:Lokhttp3/internal/http/HttpStream;
iget-object v5, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
invoke-interface {v4, v5}, Lokhttp3/internal/http/HttpStream;->writeRequestHeaders(Lokhttp3/Request;)V
invoke-direct {p0}, Lokhttp3/internal/http/HttpEngine;->readNetworkResponse()Lokhttp3/Response;
move-result-object v2
.local v2, "networkResponse":Lokhttp3/Response;
:goto_1
invoke-virtual {v2}, Lokhttp3/Response;->headers()Lokhttp3/Headers;
move-result-object v4
invoke-virtual {p0, v4}, Lokhttp3/internal/http/HttpEngine;->receiveHeaders(Lokhttp3/Headers;)V
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->cacheResponse:Lokhttp3/Response;
if-eqz v4, :cond_b
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->cacheResponse:Lokhttp3/Response;
invoke-static {v4, v2}, Lokhttp3/internal/http/HttpEngine;->validate(Lokhttp3/Response;Lokhttp3/Response;)Z
move-result v4
if-eqz v4, :cond_a
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->cacheResponse:Lokhttp3/Response;
invoke-virtual {v4}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder;
move-result-object v4
iget-object v5, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
invoke-virtual {v4, v5}, Lokhttp3/Response$Builder;->request(Lokhttp3/Request;)Lokhttp3/Response$Builder;
move-result-object v4
iget-object v5, p0, Lokhttp3/internal/http/HttpEngine;->priorResponse:Lokhttp3/Response;
invoke-static {v5}, Lokhttp3/internal/http/HttpEngine;->stripBody(Lokhttp3/Response;)Lokhttp3/Response;
move-result-object v5
invoke-virtual {v4, v5}, Lokhttp3/Response$Builder;->priorResponse(Lokhttp3/Response;)Lokhttp3/Response$Builder;
move-result-object v4
iget-object v5, p0, Lokhttp3/internal/http/HttpEngine;->cacheResponse:Lokhttp3/Response;
invoke-virtual {v5}, Lokhttp3/Response;->headers()Lokhttp3/Headers;
move-result-object v5
invoke-virtual {v2}, Lokhttp3/Response;->headers()Lokhttp3/Headers;
move-result-object v6
invoke-static {v5, v6}, Lokhttp3/internal/http/HttpEngine;->combine(Lokhttp3/Headers;Lokhttp3/Headers;)Lokhttp3/Headers;
move-result-object v5
invoke-virtual {v4, v5}, Lokhttp3/Response$Builder;->headers(Lokhttp3/Headers;)Lokhttp3/Response$Builder;
move-result-object v4
iget-object v5, p0, Lokhttp3/internal/http/HttpEngine;->cacheResponse:Lokhttp3/Response;
invoke-static {v5}, Lokhttp3/internal/http/HttpEngine;->stripBody(Lokhttp3/Response;)Lokhttp3/Response;
move-result-object v5
invoke-virtual {v4, v5}, Lokhttp3/Response$Builder;->cacheResponse(Lokhttp3/Response;)Lokhttp3/Response$Builder;
move-result-object v4
invoke-static {v2}, Lokhttp3/internal/http/HttpEngine;->stripBody(Lokhttp3/Response;)Lokhttp3/Response;
move-result-object v5
invoke-virtual {v4, v5}, Lokhttp3/Response$Builder;->networkResponse(Lokhttp3/Response;)Lokhttp3/Response$Builder;
move-result-object v4
invoke-virtual {v4}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
move-result-object v4
iput-object v4, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
invoke-virtual {v2}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
move-result-object v4
invoke-virtual {v4}, Lokhttp3/ResponseBody;->close()V
invoke-virtual {p0}, Lokhttp3/internal/http/HttpEngine;->releaseStreamAllocation()V
sget-object v4, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
iget-object v5, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
invoke-virtual {v4, v5}, Lokhttp3/internal/Internal;->internalCache(Lokhttp3/OkHttpClient;)Lokhttp3/internal/InternalCache;
move-result-object v3
.local v3, "responseCache":Lokhttp3/internal/InternalCache;
invoke-interface {v3}, Lokhttp3/internal/InternalCache;->trackConditionalCacheHit()V
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->cacheResponse:Lokhttp3/Response;
iget-object v5, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
invoke-static {v5}, Lokhttp3/internal/http/HttpEngine;->stripBody(Lokhttp3/Response;)Lokhttp3/Response;
move-result-object v5
invoke-interface {v3, v4, v5}, Lokhttp3/internal/InternalCache;->update(Lokhttp3/Response;Lokhttp3/Response;)V
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
invoke-direct {p0, v4}, Lokhttp3/internal/http/HttpEngine;->unzip(Lokhttp3/Response;)Lokhttp3/Response;
move-result-object v4
iput-object v4, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
goto/16 :goto_0
.end local v2 # "networkResponse":Lokhttp3/Response;
.end local v3 # "responseCache":Lokhttp3/internal/InternalCache;
:cond_3
iget-boolean v4, p0, Lokhttp3/internal/http/HttpEngine;->callerWritesRequestBody:Z
if-nez v4, :cond_4
new-instance v4, Lokhttp3/internal/http/HttpEngine$NetworkInterceptorChain;
const/4 v5, 0x0
iget-object v6, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
invoke-direct {v4, p0, v5, v6}, Lokhttp3/internal/http/HttpEngine$NetworkInterceptorChain;-><init>(Lokhttp3/internal/http/HttpEngine;ILokhttp3/Request;)V
iget-object v5, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
invoke-virtual {v4, v5}, Lokhttp3/internal/http/HttpEngine$NetworkInterceptorChain;->proceed(Lokhttp3/Request;)Lokhttp3/Response;
move-result-object v2
.restart local v2 # "networkResponse":Lokhttp3/Response;
goto/16 :goto_1
.end local v2 # "networkResponse":Lokhttp3/Response;
:cond_4
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->bufferedRequestBody:Lokio/BufferedSink;
if-eqz v4, :cond_5
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->bufferedRequestBody:Lokio/BufferedSink;
invoke-interface {v4}, Lokio/BufferedSink;->buffer()Lokio/Buffer;
move-result-object v4
invoke-virtual {v4}, Lokio/Buffer;->size()J
move-result-wide v4
const-wide/16 v6, 0x0
cmp-long v4, v4, v6
if-lez v4, :cond_5
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->bufferedRequestBody:Lokio/BufferedSink;
invoke-interface {v4}, Lokio/BufferedSink;->emit()Lokio/BufferedSink;
:cond_5
iget-wide v4, p0, Lokhttp3/internal/http/HttpEngine;->sentRequestMillis:J
cmp-long v4, v4, v8
if-nez v4, :cond_7
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
invoke-static {v4}, Lokhttp3/internal/http/OkHeaders;->contentLength(Lokhttp3/Request;)J
move-result-wide v4
cmp-long v4, v4, v8
if-nez v4, :cond_6
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
instance-of v4, v4, Lokhttp3/internal/http/RetryableSink;
if-eqz v4, :cond_6
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
check-cast v4, Lokhttp3/internal/http/RetryableSink;
invoke-virtual {v4}, Lokhttp3/internal/http/RetryableSink;->contentLength()J
move-result-wide v0
.local v0, "contentLength":J
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
invoke-virtual {v4}, Lokhttp3/Request;->newBuilder()Lokhttp3/Request$Builder;
move-result-object v4
const-string v5, "Content-Length"
invoke-static {v0, v1}, Ljava/lang/Long;->toString(J)Ljava/lang/String;
move-result-object v6
invoke-virtual {v4, v5, v6}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
move-result-object v4
invoke-virtual {v4}, Lokhttp3/Request$Builder;->build()Lokhttp3/Request;
move-result-object v4
iput-object v4, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
.end local v0 # "contentLength":J
:cond_6
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->httpStream:Lokhttp3/internal/http/HttpStream;
iget-object v5, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
invoke-interface {v4, v5}, Lokhttp3/internal/http/HttpStream;->writeRequestHeaders(Lokhttp3/Request;)V
:cond_7
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
if-eqz v4, :cond_8
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->bufferedRequestBody:Lokio/BufferedSink;
if-eqz v4, :cond_9
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->bufferedRequestBody:Lokio/BufferedSink;
invoke-interface {v4}, Lokio/BufferedSink;->close()V
:goto_2
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
instance-of v4, v4, Lokhttp3/internal/http/RetryableSink;
if-eqz v4, :cond_8
iget-object v5, p0, Lokhttp3/internal/http/HttpEngine;->httpStream:Lokhttp3/internal/http/HttpStream;
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
check-cast v4, Lokhttp3/internal/http/RetryableSink;
invoke-interface {v5, v4}, Lokhttp3/internal/http/HttpStream;->writeRequestBody(Lokhttp3/internal/http/RetryableSink;)V
:cond_8
invoke-direct {p0}, Lokhttp3/internal/http/HttpEngine;->readNetworkResponse()Lokhttp3/Response;
move-result-object v2
.restart local v2 # "networkResponse":Lokhttp3/Response;
goto/16 :goto_1
.end local v2 # "networkResponse":Lokhttp3/Response;
:cond_9
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
invoke-interface {v4}, Lokio/Sink;->close()V
goto :goto_2
.restart local v2 # "networkResponse":Lokhttp3/Response;
:cond_a
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->cacheResponse:Lokhttp3/Response;
invoke-virtual {v4}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
move-result-object v4
invoke-static {v4}, Lokhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V
:cond_b
invoke-virtual {v2}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder;
move-result-object v4
iget-object v5, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
invoke-virtual {v4, v5}, Lokhttp3/Response$Builder;->request(Lokhttp3/Request;)Lokhttp3/Response$Builder;
move-result-object v4
iget-object v5, p0, Lokhttp3/internal/http/HttpEngine;->priorResponse:Lokhttp3/Response;
invoke-static {v5}, Lokhttp3/internal/http/HttpEngine;->stripBody(Lokhttp3/Response;)Lokhttp3/Response;
move-result-object v5
invoke-virtual {v4, v5}, Lokhttp3/Response$Builder;->priorResponse(Lokhttp3/Response;)Lokhttp3/Response$Builder;
move-result-object v4
iget-object v5, p0, Lokhttp3/internal/http/HttpEngine;->cacheResponse:Lokhttp3/Response;
invoke-static {v5}, Lokhttp3/internal/http/HttpEngine;->stripBody(Lokhttp3/Response;)Lokhttp3/Response;
move-result-object v5
invoke-virtual {v4, v5}, Lokhttp3/Response$Builder;->cacheResponse(Lokhttp3/Response;)Lokhttp3/Response$Builder;
move-result-object v4
invoke-static {v2}, Lokhttp3/internal/http/HttpEngine;->stripBody(Lokhttp3/Response;)Lokhttp3/Response;
move-result-object v5
invoke-virtual {v4, v5}, Lokhttp3/Response$Builder;->networkResponse(Lokhttp3/Response;)Lokhttp3/Response$Builder;
move-result-object v4
invoke-virtual {v4}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
move-result-object v4
iput-object v4, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
invoke-static {v4}, Lokhttp3/internal/http/HttpEngine;->hasBody(Lokhttp3/Response;)Z
move-result v4
if-eqz v4, :cond_0
invoke-direct {p0}, Lokhttp3/internal/http/HttpEngine;->maybeCache()V
iget-object v4, p0, Lokhttp3/internal/http/HttpEngine;->storeRequest:Lokhttp3/internal/http/CacheRequest;
iget-object v5, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
invoke-direct {p0, v4, v5}, Lokhttp3/internal/http/HttpEngine;->cacheWritingResponse(Lokhttp3/internal/http/CacheRequest;Lokhttp3/Response;)Lokhttp3/Response;
move-result-object v4
invoke-direct {p0, v4}, Lokhttp3/internal/http/HttpEngine;->unzip(Lokhttp3/Response;)Lokhttp3/Response;
move-result-object v4
iput-object v4, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
goto/16 :goto_0
.end method
.method public receiveHeaders(Lokhttp3/Headers;)V
.locals 3
.param p1, "headers" # Lokhttp3/Headers;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
invoke-virtual {v1}, Lokhttp3/OkHttpClient;->cookieJar()Lokhttp3/CookieJar;
move-result-object v1
sget-object v2, Lokhttp3/CookieJar;->NO_COOKIES:Lokhttp3/CookieJar;
if-ne v1, v2, :cond_1
:cond_0
:goto_0
return-void
:cond_1
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
invoke-virtual {v1}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
move-result-object v1
invoke-static {v1, p1}, Lokhttp3/Cookie;->parseAll(Lokhttp3/HttpUrl;Lokhttp3/Headers;)Ljava/util/List;
move-result-object v0
.local v0, "cookies":Ljava/util/List;, "Ljava/util/List<Lokhttp3/Cookie;>;"
invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
move-result v1
if-nez v1, :cond_0
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
invoke-virtual {v1}, Lokhttp3/OkHttpClient;->cookieJar()Lokhttp3/CookieJar;
move-result-object v1
iget-object v2, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
invoke-virtual {v2}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
move-result-object v2
invoke-interface {v1, v2, v0}, Lokhttp3/CookieJar;->saveFromResponse(Lokhttp3/HttpUrl;Ljava/util/List;)V
goto :goto_0
.end method
.method public recover(Ljava/io/IOException;)Lokhttp3/internal/http/HttpEngine;
.locals 1
.param p1, "e" # Ljava/io/IOException;
.prologue
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
invoke-virtual {p0, p1, v0}, Lokhttp3/internal/http/HttpEngine;->recover(Ljava/io/IOException;Lokio/Sink;)Lokhttp3/internal/http/HttpEngine;
move-result-object v0
return-object v0
.end method
.method public recover(Ljava/io/IOException;Lokio/Sink;)Lokhttp3/internal/http/HttpEngine;
.locals 9
.param p1, "e" # Ljava/io/IOException;
.param p2, "requestBodyOut" # Lokio/Sink;
.prologue
const/4 v0, 0x0
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->streamAllocation:Lokhttp3/internal/http/StreamAllocation;
invoke-virtual {v1, p1, p2}, Lokhttp3/internal/http/StreamAllocation;->recover(Ljava/io/IOException;Lokio/Sink;)Z
move-result v1
if-nez v1, :cond_1
:cond_0
:goto_0
return-object v0
:cond_1
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
invoke-virtual {v1}, Lokhttp3/OkHttpClient;->retryOnConnectionFailure()Z
move-result v1
if-eqz v1, :cond_0
invoke-virtual {p0}, Lokhttp3/internal/http/HttpEngine;->close()Lokhttp3/internal/http/StreamAllocation;
move-result-object v6
.local v6, "streamAllocation":Lokhttp3/internal/http/StreamAllocation;
new-instance v0, Lokhttp3/internal/http/HttpEngine;
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
iget-object v2, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
iget-boolean v3, p0, Lokhttp3/internal/http/HttpEngine;->bufferRequestBody:Z
iget-boolean v4, p0, Lokhttp3/internal/http/HttpEngine;->callerWritesRequestBody:Z
iget-boolean v5, p0, Lokhttp3/internal/http/HttpEngine;->forWebSocket:Z
move-object v7, p2
check-cast v7, Lokhttp3/internal/http/RetryableSink;
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->priorResponse:Lokhttp3/Response;
invoke-direct/range {v0 .. v8}, Lokhttp3/internal/http/HttpEngine;-><init>(Lokhttp3/OkHttpClient;Lokhttp3/Request;ZZZLokhttp3/internal/http/StreamAllocation;Lokhttp3/internal/http/RetryableSink;Lokhttp3/Response;)V
goto :goto_0
.end method
.method public releaseStreamAllocation()V
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
iget-object v0, p0, Lokhttp3/internal/http/HttpEngine;->streamAllocation:Lokhttp3/internal/http/StreamAllocation;
invoke-virtual {v0}, Lokhttp3/internal/http/StreamAllocation;->release()V
return-void
.end method
.method public sameConnection(Lokhttp3/HttpUrl;)Z
.locals 3
.param p1, "followUp" # Lokhttp3/HttpUrl;
.prologue
iget-object v1, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
invoke-virtual {v1}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
move-result-object v0
.local v0, "url":Lokhttp3/HttpUrl;
invoke-virtual {v0}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
move-result-object v1
invoke-virtual {p1}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_0
invoke-virtual {v0}, Lokhttp3/HttpUrl;->port()I
move-result v1
invoke-virtual {p1}, Lokhttp3/HttpUrl;->port()I
move-result v2
if-ne v1, v2, :cond_0
invoke-virtual {v0}, Lokhttp3/HttpUrl;->scheme()Ljava/lang/String;
move-result-object v1
invoke-virtual {p1}, Lokhttp3/HttpUrl;->scheme()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_0
const/4 v1, 0x1
:goto_0
return v1
:cond_0
const/4 v1, 0x0
goto :goto_0
.end method
.method public sendRequest()V
.locals 10
.annotation system Ldalvik/annotation/Throws;
value = {
Lokhttp3/internal/http/RequestException;,
Lokhttp3/internal/http/RouteException;,
Ljava/io/IOException;
}
.end annotation
.prologue
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->cacheStrategy:Lokhttp3/internal/http/CacheStrategy;
if-eqz v8, :cond_1
:cond_0
:goto_0
return-void
:cond_1
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->httpStream:Lokhttp3/internal/http/HttpStream;
if-eqz v8, :cond_2
new-instance v8, Ljava/lang/IllegalStateException;
invoke-direct {v8}, Ljava/lang/IllegalStateException;-><init>()V
throw v8
:cond_2
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
invoke-direct {p0, v8}, Lokhttp3/internal/http/HttpEngine;->networkRequest(Lokhttp3/Request;)Lokhttp3/Request;
move-result-object v1
.local v1, "request":Lokhttp3/Request;
sget-object v8, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
iget-object v9, p0, Lokhttp3/internal/http/HttpEngine;->client:Lokhttp3/OkHttpClient;
invoke-virtual {v8, v9}, Lokhttp3/internal/Internal;->internalCache(Lokhttp3/OkHttpClient;)Lokhttp3/internal/InternalCache;
move-result-object v6
.local v6, "responseCache":Lokhttp3/internal/InternalCache;
if-eqz v6, :cond_5
invoke-interface {v6, v1}, Lokhttp3/internal/InternalCache;->get(Lokhttp3/Request;)Lokhttp3/Response;
move-result-object v0
.local v0, "cacheCandidate":Lokhttp3/Response;
:goto_1
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v4
.local v4, "now":J
new-instance v8, Lokhttp3/internal/http/CacheStrategy$Factory;
invoke-direct {v8, v4, v5, v1, v0}, Lokhttp3/internal/http/CacheStrategy$Factory;-><init>(JLokhttp3/Request;Lokhttp3/Response;)V
invoke-virtual {v8}, Lokhttp3/internal/http/CacheStrategy$Factory;->get()Lokhttp3/internal/http/CacheStrategy;
move-result-object v8
iput-object v8, p0, Lokhttp3/internal/http/HttpEngine;->cacheStrategy:Lokhttp3/internal/http/CacheStrategy;
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->cacheStrategy:Lokhttp3/internal/http/CacheStrategy;
iget-object v8, v8, Lokhttp3/internal/http/CacheStrategy;->networkRequest:Lokhttp3/Request;
iput-object v8, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->cacheStrategy:Lokhttp3/internal/http/CacheStrategy;
iget-object v8, v8, Lokhttp3/internal/http/CacheStrategy;->cacheResponse:Lokhttp3/Response;
iput-object v8, p0, Lokhttp3/internal/http/HttpEngine;->cacheResponse:Lokhttp3/Response;
if-eqz v6, :cond_3
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->cacheStrategy:Lokhttp3/internal/http/CacheStrategy;
invoke-interface {v6, v8}, Lokhttp3/internal/InternalCache;->trackResponse(Lokhttp3/internal/http/CacheStrategy;)V
:cond_3
if-eqz v0, :cond_4
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->cacheResponse:Lokhttp3/Response;
if-nez v8, :cond_4
invoke-virtual {v0}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
move-result-object v8
invoke-static {v8}, Lokhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V
:cond_4
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
if-nez v8, :cond_6
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->cacheResponse:Lokhttp3/Response;
if-nez v8, :cond_6
new-instance v8, Lokhttp3/Response$Builder;
invoke-direct {v8}, Lokhttp3/Response$Builder;-><init>()V
iget-object v9, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
invoke-virtual {v8, v9}, Lokhttp3/Response$Builder;->request(Lokhttp3/Request;)Lokhttp3/Response$Builder;
move-result-object v8
iget-object v9, p0, Lokhttp3/internal/http/HttpEngine;->priorResponse:Lokhttp3/Response;
invoke-static {v9}, Lokhttp3/internal/http/HttpEngine;->stripBody(Lokhttp3/Response;)Lokhttp3/Response;
move-result-object v9
invoke-virtual {v8, v9}, Lokhttp3/Response$Builder;->priorResponse(Lokhttp3/Response;)Lokhttp3/Response$Builder;
move-result-object v8
sget-object v9, Lokhttp3/Protocol;->HTTP_1_1:Lokhttp3/Protocol;
invoke-virtual {v8, v9}, Lokhttp3/Response$Builder;->protocol(Lokhttp3/Protocol;)Lokhttp3/Response$Builder;
move-result-object v8
const/16 v9, 0x1f8
invoke-virtual {v8, v9}, Lokhttp3/Response$Builder;->code(I)Lokhttp3/Response$Builder;
move-result-object v8
const-string v9, "Unsatisfiable Request (only-if-cached)"
invoke-virtual {v8, v9}, Lokhttp3/Response$Builder;->message(Ljava/lang/String;)Lokhttp3/Response$Builder;
move-result-object v8
sget-object v9, Lokhttp3/internal/http/HttpEngine;->EMPTY_BODY:Lokhttp3/ResponseBody;
invoke-virtual {v8, v9}, Lokhttp3/Response$Builder;->body(Lokhttp3/ResponseBody;)Lokhttp3/Response$Builder;
move-result-object v8
invoke-virtual {v8}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
move-result-object v8
iput-object v8, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
goto/16 :goto_0
.end local v0 # "cacheCandidate":Lokhttp3/Response;
.end local v4 # "now":J
:cond_5
const/4 v0, 0x0
goto :goto_1
.restart local v0 # "cacheCandidate":Lokhttp3/Response;
.restart local v4 # "now":J
:cond_6
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
if-nez v8, :cond_7
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->cacheResponse:Lokhttp3/Response;
invoke-virtual {v8}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder;
move-result-object v8
iget-object v9, p0, Lokhttp3/internal/http/HttpEngine;->userRequest:Lokhttp3/Request;
invoke-virtual {v8, v9}, Lokhttp3/Response$Builder;->request(Lokhttp3/Request;)Lokhttp3/Response$Builder;
move-result-object v8
iget-object v9, p0, Lokhttp3/internal/http/HttpEngine;->priorResponse:Lokhttp3/Response;
invoke-static {v9}, Lokhttp3/internal/http/HttpEngine;->stripBody(Lokhttp3/Response;)Lokhttp3/Response;
move-result-object v9
invoke-virtual {v8, v9}, Lokhttp3/Response$Builder;->priorResponse(Lokhttp3/Response;)Lokhttp3/Response$Builder;
move-result-object v8
iget-object v9, p0, Lokhttp3/internal/http/HttpEngine;->cacheResponse:Lokhttp3/Response;
invoke-static {v9}, Lokhttp3/internal/http/HttpEngine;->stripBody(Lokhttp3/Response;)Lokhttp3/Response;
move-result-object v9
invoke-virtual {v8, v9}, Lokhttp3/Response$Builder;->cacheResponse(Lokhttp3/Response;)Lokhttp3/Response$Builder;
move-result-object v8
invoke-virtual {v8}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
move-result-object v8
iput-object v8, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
invoke-direct {p0, v8}, Lokhttp3/internal/http/HttpEngine;->unzip(Lokhttp3/Response;)Lokhttp3/Response;
move-result-object v8
iput-object v8, p0, Lokhttp3/internal/http/HttpEngine;->userResponse:Lokhttp3/Response;
goto/16 :goto_0
:cond_7
const/4 v7, 0x0
.local v7, "success":Z
:try_start_0
invoke-direct {p0}, Lokhttp3/internal/http/HttpEngine;->connect()Lokhttp3/internal/http/HttpStream;
move-result-object v8
iput-object v8, p0, Lokhttp3/internal/http/HttpEngine;->httpStream:Lokhttp3/internal/http/HttpStream;
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->httpStream:Lokhttp3/internal/http/HttpStream;
invoke-interface {v8, p0}, Lokhttp3/internal/http/HttpStream;->setHttpEngine(Lokhttp3/internal/http/HttpEngine;)V
invoke-direct {p0}, Lokhttp3/internal/http/HttpEngine;->writeRequestHeadersEagerly()Z
move-result v8
if-eqz v8, :cond_a
invoke-static {v1}, Lokhttp3/internal/http/OkHeaders;->contentLength(Lokhttp3/Request;)J
move-result-wide v2
.local v2, "contentLength":J
iget-boolean v8, p0, Lokhttp3/internal/http/HttpEngine;->bufferRequestBody:Z
if-eqz v8, :cond_c
const-wide/32 v8, 0x7fffffff
cmp-long v8, v2, v8
if-lez v8, :cond_9
new-instance v8, Ljava/lang/IllegalStateException;
const-string v9, "Use setFixedLengthStreamingMode() or setChunkedStreamingMode() for requests larger than 2 GiB."
invoke-direct {v8, v9}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v8
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.end local v2 # "contentLength":J
:catchall_0
move-exception v8
if-nez v7, :cond_8
if-eqz v0, :cond_8
invoke-virtual {v0}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
move-result-object v9
invoke-static {v9}, Lokhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V
:cond_8
throw v8
.restart local v2 # "contentLength":J
:cond_9
const-wide/16 v8, -0x1
cmp-long v8, v2, v8
if-eqz v8, :cond_b
:try_start_1
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->httpStream:Lokhttp3/internal/http/HttpStream;
iget-object v9, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
invoke-interface {v8, v9}, Lokhttp3/internal/http/HttpStream;->writeRequestHeaders(Lokhttp3/Request;)V
new-instance v8, Lokhttp3/internal/http/RetryableSink;
long-to-int v9, v2
invoke-direct {v8, v9}, Lokhttp3/internal/http/RetryableSink;-><init>(I)V
iput-object v8, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
.end local v2 # "contentLength":J
:cond_a
:goto_2
const/4 v7, 0x1
if-nez v7, :cond_0
if-eqz v0, :cond_0
invoke-virtual {v0}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
move-result-object v8
invoke-static {v8}, Lokhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V
goto/16 :goto_0
.restart local v2 # "contentLength":J
:cond_b
:try_start_2
new-instance v8, Lokhttp3/internal/http/RetryableSink;
invoke-direct {v8}, Lokhttp3/internal/http/RetryableSink;-><init>()V
iput-object v8, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
goto :goto_2
:cond_c
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->httpStream:Lokhttp3/internal/http/HttpStream;
iget-object v9, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
invoke-interface {v8, v9}, Lokhttp3/internal/http/HttpStream;->writeRequestHeaders(Lokhttp3/Request;)V
iget-object v8, p0, Lokhttp3/internal/http/HttpEngine;->httpStream:Lokhttp3/internal/http/HttpStream;
iget-object v9, p0, Lokhttp3/internal/http/HttpEngine;->networkRequest:Lokhttp3/Request;
invoke-interface {v8, v9, v2, v3}, Lokhttp3/internal/http/HttpStream;->createRequestBody(Lokhttp3/Request;J)Lokio/Sink;
move-result-object v8
iput-object v8, p0, Lokhttp3/internal/http/HttpEngine;->requestBodyOut:Lokio/Sink;
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_0
goto :goto_2
.end method
.method public writingRequestHeaders()V
.locals 4
.prologue
iget-wide v0, p0, Lokhttp3/internal/http/HttpEngine;->sentRequestMillis:J
const-wide/16 v2, -0x1
cmp-long v0, v0, v2
if-eqz v0, :cond_0
new-instance v0, Ljava/lang/IllegalStateException;
invoke-direct {v0}, Ljava/lang/IllegalStateException;-><init>()V
throw v0
:cond_0
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v0
iput-wide v0, p0, Lokhttp3/internal/http/HttpEngine;->sentRequestMillis:J
return-void
.end method