1600 lines
45 KiB
Smali
1600 lines
45 KiB
Smali
.class public final Lokhttp3/internal/io/RealConnection;
|
|
.super Lokhttp3/internal/framed/FramedConnection$Listener;
|
|
.source "RealConnection.java"
|
|
|
|
# interfaces
|
|
.implements Lokhttp3/Connection;
|
|
|
|
|
|
# instance fields
|
|
.field public allocationLimit:I
|
|
|
|
.field public final allocations:Ljava/util/List;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/List",
|
|
"<",
|
|
"Ljava/lang/ref/Reference",
|
|
"<",
|
|
"Lokhttp3/internal/http/StreamAllocation;",
|
|
">;>;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field public volatile framedConnection:Lokhttp3/internal/framed/FramedConnection;
|
|
|
|
.field private handshake:Lokhttp3/Handshake;
|
|
|
|
.field public idleAtNanos:J
|
|
|
|
.field public noNewStreams:Z
|
|
|
|
.field private protocol:Lokhttp3/Protocol;
|
|
|
|
.field private rawSocket:Ljava/net/Socket;
|
|
|
|
.field private final route:Lokhttp3/Route;
|
|
|
|
.field public sink:Lokio/BufferedSink;
|
|
|
|
.field public socket:Ljava/net/Socket;
|
|
|
|
.field public source:Lokio/BufferedSource;
|
|
|
|
.field public successCount:I
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Lokhttp3/Route;)V
|
|
.locals 2
|
|
.param p1, "route" # Lokhttp3/Route;
|
|
|
|
.prologue
|
|
invoke-direct {p0}, Lokhttp3/internal/framed/FramedConnection$Listener;-><init>()V
|
|
|
|
new-instance v0, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
iput-object v0, p0, Lokhttp3/internal/io/RealConnection;->allocations:Ljava/util/List;
|
|
|
|
const-wide v0, 0x7fffffffffffffffL
|
|
|
|
iput-wide v0, p0, Lokhttp3/internal/io/RealConnection;->idleAtNanos:J
|
|
|
|
iput-object p1, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private connectSocket(IIILokhttp3/internal/ConnectionSpecSelector;)V
|
|
.locals 7
|
|
.param p1, "connectTimeout" # I
|
|
.param p2, "readTimeout" # I
|
|
.param p3, "writeTimeout" # I
|
|
.param p4, "connectionSpecSelector" # Lokhttp3/internal/ConnectionSpecSelector;
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
const/4 v5, 0x1
|
|
|
|
iget-object v2, p0, Lokhttp3/internal/io/RealConnection;->rawSocket:Ljava/net/Socket;
|
|
|
|
invoke-virtual {v2, p2}, Ljava/net/Socket;->setSoTimeout(I)V
|
|
|
|
:try_start_0
|
|
invoke-static {}, Lokhttp3/internal/Platform;->get()Lokhttp3/internal/Platform;
|
|
|
|
move-result-object v2
|
|
|
|
iget-object v3, p0, Lokhttp3/internal/io/RealConnection;->rawSocket:Ljava/net/Socket;
|
|
|
|
iget-object v4, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v4}, Lokhttp3/Route;->socketAddress()Ljava/net/InetSocketAddress;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v2, v3, v4, p1}, Lokhttp3/internal/Platform;->connectSocket(Ljava/net/Socket;Ljava/net/InetSocketAddress;I)V
|
|
:try_end_0
|
|
.catch Ljava/net/ConnectException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
iget-object v2, p0, Lokhttp3/internal/io/RealConnection;->rawSocket:Ljava/net/Socket;
|
|
|
|
invoke-static {v2}, Lokio/Okio;->source(Ljava/net/Socket;)Lokio/Source;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-static {v2}, Lokio/Okio;->buffer(Lokio/Source;)Lokio/BufferedSource;
|
|
|
|
move-result-object v2
|
|
|
|
iput-object v2, p0, Lokhttp3/internal/io/RealConnection;->source:Lokio/BufferedSource;
|
|
|
|
iget-object v2, p0, Lokhttp3/internal/io/RealConnection;->rawSocket:Ljava/net/Socket;
|
|
|
|
invoke-static {v2}, Lokio/Okio;->sink(Ljava/net/Socket;)Lokio/Sink;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-static {v2}, Lokio/Okio;->buffer(Lokio/Sink;)Lokio/BufferedSink;
|
|
|
|
move-result-object v2
|
|
|
|
iput-object v2, p0, Lokhttp3/internal/io/RealConnection;->sink:Lokio/BufferedSink;
|
|
|
|
iget-object v2, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v2}, Lokhttp3/Route;->address()Lokhttp3/Address;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v2}, Lokhttp3/Address;->sslSocketFactory()Ljavax/net/ssl/SSLSocketFactory;
|
|
|
|
move-result-object v2
|
|
|
|
if-eqz v2, :cond_1
|
|
|
|
invoke-direct {p0, p2, p3, p4}, Lokhttp3/internal/io/RealConnection;->connectTls(IILokhttp3/internal/ConnectionSpecSelector;)V
|
|
|
|
:goto_0
|
|
iget-object v2, p0, Lokhttp3/internal/io/RealConnection;->protocol:Lokhttp3/Protocol;
|
|
|
|
sget-object v3, Lokhttp3/Protocol;->SPDY_3:Lokhttp3/Protocol;
|
|
|
|
if-eq v2, v3, :cond_0
|
|
|
|
iget-object v2, p0, Lokhttp3/internal/io/RealConnection;->protocol:Lokhttp3/Protocol;
|
|
|
|
sget-object v3, Lokhttp3/Protocol;->HTTP_2:Lokhttp3/Protocol;
|
|
|
|
if-ne v2, v3, :cond_2
|
|
|
|
:cond_0
|
|
iget-object v2, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
const/4 v3, 0x0
|
|
|
|
invoke-virtual {v2, v3}, Ljava/net/Socket;->setSoTimeout(I)V
|
|
|
|
new-instance v2, Lokhttp3/internal/framed/FramedConnection$Builder;
|
|
|
|
invoke-direct {v2, v5}, Lokhttp3/internal/framed/FramedConnection$Builder;-><init>(Z)V
|
|
|
|
iget-object v3, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
iget-object v4, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v4}, Lokhttp3/Route;->address()Lokhttp3/Address;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v4}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v4}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
iget-object v5, p0, Lokhttp3/internal/io/RealConnection;->source:Lokio/BufferedSource;
|
|
|
|
iget-object v6, p0, Lokhttp3/internal/io/RealConnection;->sink:Lokio/BufferedSink;
|
|
|
|
invoke-virtual {v2, v3, v4, v5, v6}, Lokhttp3/internal/framed/FramedConnection$Builder;->socket(Ljava/net/Socket;Ljava/lang/String;Lokio/BufferedSource;Lokio/BufferedSink;)Lokhttp3/internal/framed/FramedConnection$Builder;
|
|
|
|
move-result-object v2
|
|
|
|
iget-object v3, p0, Lokhttp3/internal/io/RealConnection;->protocol:Lokhttp3/Protocol;
|
|
|
|
invoke-virtual {v2, v3}, Lokhttp3/internal/framed/FramedConnection$Builder;->protocol(Lokhttp3/Protocol;)Lokhttp3/internal/framed/FramedConnection$Builder;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v2, p0}, Lokhttp3/internal/framed/FramedConnection$Builder;->listener(Lokhttp3/internal/framed/FramedConnection$Listener;)Lokhttp3/internal/framed/FramedConnection$Builder;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v2}, Lokhttp3/internal/framed/FramedConnection$Builder;->build()Lokhttp3/internal/framed/FramedConnection;
|
|
|
|
move-result-object v1
|
|
|
|
.local v1, "framedConnection":Lokhttp3/internal/framed/FramedConnection;
|
|
invoke-virtual {v1}, Lokhttp3/internal/framed/FramedConnection;->sendConnectionPreface()V
|
|
|
|
invoke-virtual {v1}, Lokhttp3/internal/framed/FramedConnection;->maxConcurrentStreams()I
|
|
|
|
move-result v2
|
|
|
|
iput v2, p0, Lokhttp3/internal/io/RealConnection;->allocationLimit:I
|
|
|
|
iput-object v1, p0, Lokhttp3/internal/io/RealConnection;->framedConnection:Lokhttp3/internal/framed/FramedConnection;
|
|
|
|
.end local v1 # "framedConnection":Lokhttp3/internal/framed/FramedConnection;
|
|
:goto_1
|
|
return-void
|
|
|
|
:catch_0
|
|
move-exception v0
|
|
|
|
.local v0, "e":Ljava/net/ConnectException;
|
|
new-instance v2, Ljava/net/ConnectException;
|
|
|
|
new-instance v3, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v4, "Failed to connect to "
|
|
|
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v3
|
|
|
|
iget-object v4, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v4}, Lokhttp3/Route;->socketAddress()Ljava/net/InetSocketAddress;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-direct {v2, v3}, Ljava/net/ConnectException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v2
|
|
|
|
.end local v0 # "e":Ljava/net/ConnectException;
|
|
:cond_1
|
|
sget-object v2, Lokhttp3/Protocol;->HTTP_1_1:Lokhttp3/Protocol;
|
|
|
|
iput-object v2, p0, Lokhttp3/internal/io/RealConnection;->protocol:Lokhttp3/Protocol;
|
|
|
|
iget-object v2, p0, Lokhttp3/internal/io/RealConnection;->rawSocket:Ljava/net/Socket;
|
|
|
|
iput-object v2, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
iput v5, p0, Lokhttp3/internal/io/RealConnection;->allocationLimit:I
|
|
|
|
goto :goto_1
|
|
.end method
|
|
|
|
.method private connectTls(IILokhttp3/internal/ConnectionSpecSelector;)V
|
|
.locals 14
|
|
.param p1, "readTimeout" # I
|
|
.param p2, "writeTimeout" # I
|
|
.param p3, "connectionSpecSelector" # Lokhttp3/internal/ConnectionSpecSelector;
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
iget-object v10, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v10}, Lokhttp3/Route;->requiresTunnel()Z
|
|
|
|
move-result v10
|
|
|
|
if-eqz v10, :cond_0
|
|
|
|
invoke-direct/range {p0 .. p2}, Lokhttp3/internal/io/RealConnection;->createTunnel(II)V
|
|
|
|
:cond_0
|
|
iget-object v10, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v10}, Lokhttp3/Route;->address()Lokhttp3/Address;
|
|
|
|
move-result-object v1
|
|
|
|
.local v1, "address":Lokhttp3/Address;
|
|
invoke-virtual {v1}, Lokhttp3/Address;->sslSocketFactory()Ljavax/net/ssl/SSLSocketFactory;
|
|
|
|
move-result-object v7
|
|
|
|
.local v7, "sslSocketFactory":Ljavax/net/ssl/SSLSocketFactory;
|
|
const/4 v8, 0x0
|
|
|
|
.local v8, "success":Z
|
|
const/4 v6, 0x0
|
|
|
|
.local v6, "sslSocket":Ljavax/net/ssl/SSLSocket;
|
|
:try_start_0
|
|
iget-object v10, p0, Lokhttp3/internal/io/RealConnection;->rawSocket:Ljava/net/Socket;
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v11}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-virtual {v12}, Lokhttp3/HttpUrl;->port()I
|
|
|
|
move-result v12
|
|
|
|
const/4 v13, 0x1
|
|
|
|
invoke-virtual {v7, v10, v11, v12, v13}, Ljavax/net/ssl/SSLSocketFactory;->createSocket(Ljava/net/Socket;Ljava/lang/String;IZ)Ljava/net/Socket;
|
|
|
|
move-result-object v10
|
|
|
|
move-object v0, v10
|
|
|
|
check-cast v0, Ljavax/net/ssl/SSLSocket;
|
|
|
|
move-object v6, v0
|
|
|
|
move-object/from16 v0, p3
|
|
|
|
invoke-virtual {v0, v6}, Lokhttp3/internal/ConnectionSpecSelector;->configureSecureSocket(Ljavax/net/ssl/SSLSocket;)Lokhttp3/ConnectionSpec;
|
|
|
|
move-result-object v3
|
|
|
|
.local v3, "connectionSpec":Lokhttp3/ConnectionSpec;
|
|
invoke-virtual {v3}, Lokhttp3/ConnectionSpec;->supportsTlsExtensions()Z
|
|
|
|
move-result v10
|
|
|
|
if-eqz v10, :cond_1
|
|
|
|
invoke-static {}, Lokhttp3/internal/Platform;->get()Lokhttp3/internal/Platform;
|
|
|
|
move-result-object v10
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v11}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Address;->protocols()Ljava/util/List;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-virtual {v10, v6, v11, v12}, Lokhttp3/internal/Platform;->configureTlsExtensions(Ljavax/net/ssl/SSLSocket;Ljava/lang/String;Ljava/util/List;)V
|
|
|
|
:cond_1
|
|
invoke-virtual {v6}, Ljavax/net/ssl/SSLSocket;->startHandshake()V
|
|
|
|
invoke-virtual {v6}, Ljavax/net/ssl/SSLSocket;->getSession()Ljavax/net/ssl/SSLSession;
|
|
|
|
move-result-object v10
|
|
|
|
invoke-static {v10}, Lokhttp3/Handshake;->get(Ljavax/net/ssl/SSLSession;)Lokhttp3/Handshake;
|
|
|
|
move-result-object v9
|
|
|
|
.local v9, "unverifiedHandshake":Lokhttp3/Handshake;
|
|
invoke-virtual {v1}, Lokhttp3/Address;->hostnameVerifier()Ljavax/net/ssl/HostnameVerifier;
|
|
|
|
move-result-object v10
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v11}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v6}, Ljavax/net/ssl/SSLSocket;->getSession()Ljavax/net/ssl/SSLSession;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-interface {v10, v11, v12}, Ljavax/net/ssl/HostnameVerifier;->verify(Ljava/lang/String;Ljavax/net/ssl/SSLSession;)Z
|
|
|
|
move-result v10
|
|
|
|
if-nez v10, :cond_4
|
|
|
|
invoke-virtual {v9}, Lokhttp3/Handshake;->peerCertificates()Ljava/util/List;
|
|
|
|
move-result-object v10
|
|
|
|
const/4 v11, 0x0
|
|
|
|
invoke-interface {v10, v11}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
check-cast v2, Ljava/security/cert/X509Certificate;
|
|
|
|
.local v2, "cert":Ljava/security/cert/X509Certificate;
|
|
new-instance v10, Ljavax/net/ssl/SSLPeerUnverifiedException;
|
|
|
|
new-instance v11, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v11}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v12, "Hostname "
|
|
|
|
invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-virtual {v12}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v11
|
|
|
|
const-string v12, " not verified:"
|
|
|
|
invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v11
|
|
|
|
const-string v12, "\n certificate: "
|
|
|
|
invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-static {v2}, Lokhttp3/CertificatePinner;->pin(Ljava/security/cert/Certificate;)Ljava/lang/String;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v11
|
|
|
|
const-string v12, "\n DN: "
|
|
|
|
invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v2}, Ljava/security/cert/X509Certificate;->getSubjectDN()Ljava/security/Principal;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-interface {v12}, Ljava/security/Principal;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v11
|
|
|
|
const-string v12, "\n subjectAltNames: "
|
|
|
|
invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-static {v2}, Lokhttp3/internal/tls/OkHostnameVerifier;->allSubjectAltNames(Ljava/security/cert/X509Certificate;)Ljava/util/List;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-direct {v10, v11}, Ljavax/net/ssl/SSLPeerUnverifiedException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v10
|
|
:try_end_0
|
|
.catch Ljava/lang/AssertionError; {:try_start_0 .. :try_end_0} :catch_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
.end local v2 # "cert":Ljava/security/cert/X509Certificate;
|
|
.end local v3 # "connectionSpec":Lokhttp3/ConnectionSpec;
|
|
.end local v9 # "unverifiedHandshake":Lokhttp3/Handshake;
|
|
:catch_0
|
|
move-exception v4
|
|
|
|
.local v4, "e":Ljava/lang/AssertionError;
|
|
:try_start_1
|
|
invoke-static {v4}, Lokhttp3/internal/Util;->isAndroidGetsocknameError(Ljava/lang/AssertionError;)Z
|
|
|
|
move-result v10
|
|
|
|
if-eqz v10, :cond_9
|
|
|
|
new-instance v10, Ljava/io/IOException;
|
|
|
|
invoke-direct {v10, v4}, Ljava/io/IOException;-><init>(Ljava/lang/Throwable;)V
|
|
|
|
throw v10
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
.end local v4 # "e":Ljava/lang/AssertionError;
|
|
:catchall_0
|
|
move-exception v10
|
|
|
|
if-eqz v6, :cond_2
|
|
|
|
invoke-static {}, Lokhttp3/internal/Platform;->get()Lokhttp3/internal/Platform;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v11, v6}, Lokhttp3/internal/Platform;->afterHandshake(Ljavax/net/ssl/SSLSocket;)V
|
|
|
|
:cond_2
|
|
if-nez v8, :cond_3
|
|
|
|
invoke-static {v6}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
|
|
|
|
:cond_3
|
|
throw v10
|
|
|
|
.restart local v3 # "connectionSpec":Lokhttp3/ConnectionSpec;
|
|
.restart local v9 # "unverifiedHandshake":Lokhttp3/Handshake;
|
|
:cond_4
|
|
:try_start_2
|
|
invoke-virtual {v1}, Lokhttp3/Address;->certificatePinner()Lokhttp3/CertificatePinner;
|
|
|
|
move-result-object v10
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v11}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
|
|
|
|
move-result-object v11
|
|
|
|
invoke-virtual {v9}, Lokhttp3/Handshake;->peerCertificates()Ljava/util/List;
|
|
|
|
move-result-object v12
|
|
|
|
invoke-virtual {v10, v11, v12}, Lokhttp3/CertificatePinner;->check(Ljava/lang/String;Ljava/util/List;)V
|
|
|
|
invoke-virtual {v3}, Lokhttp3/ConnectionSpec;->supportsTlsExtensions()Z
|
|
|
|
move-result v10
|
|
|
|
if-eqz v10, :cond_7
|
|
|
|
invoke-static {}, Lokhttp3/internal/Platform;->get()Lokhttp3/internal/Platform;
|
|
|
|
move-result-object v10
|
|
|
|
invoke-virtual {v10, v6}, Lokhttp3/internal/Platform;->getSelectedProtocol(Ljavax/net/ssl/SSLSocket;)Ljava/lang/String;
|
|
|
|
move-result-object v5
|
|
|
|
.local v5, "maybeProtocol":Ljava/lang/String;
|
|
:goto_0
|
|
iput-object v6, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
iget-object v10, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
invoke-static {v10}, Lokio/Okio;->source(Ljava/net/Socket;)Lokio/Source;
|
|
|
|
move-result-object v10
|
|
|
|
invoke-static {v10}, Lokio/Okio;->buffer(Lokio/Source;)Lokio/BufferedSource;
|
|
|
|
move-result-object v10
|
|
|
|
iput-object v10, p0, Lokhttp3/internal/io/RealConnection;->source:Lokio/BufferedSource;
|
|
|
|
iget-object v10, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
invoke-static {v10}, Lokio/Okio;->sink(Ljava/net/Socket;)Lokio/Sink;
|
|
|
|
move-result-object v10
|
|
|
|
invoke-static {v10}, Lokio/Okio;->buffer(Lokio/Sink;)Lokio/BufferedSink;
|
|
|
|
move-result-object v10
|
|
|
|
iput-object v10, p0, Lokhttp3/internal/io/RealConnection;->sink:Lokio/BufferedSink;
|
|
|
|
iput-object v9, p0, Lokhttp3/internal/io/RealConnection;->handshake:Lokhttp3/Handshake;
|
|
|
|
if-eqz v5, :cond_8
|
|
|
|
invoke-static {v5}, Lokhttp3/Protocol;->get(Ljava/lang/String;)Lokhttp3/Protocol;
|
|
|
|
move-result-object v10
|
|
|
|
:goto_1
|
|
iput-object v10, p0, Lokhttp3/internal/io/RealConnection;->protocol:Lokhttp3/Protocol;
|
|
:try_end_2
|
|
.catch Ljava/lang/AssertionError; {:try_start_2 .. :try_end_2} :catch_0
|
|
.catchall {:try_start_2 .. :try_end_2} :catchall_0
|
|
|
|
const/4 v8, 0x1
|
|
|
|
if-eqz v6, :cond_5
|
|
|
|
invoke-static {}, Lokhttp3/internal/Platform;->get()Lokhttp3/internal/Platform;
|
|
|
|
move-result-object v10
|
|
|
|
invoke-virtual {v10, v6}, Lokhttp3/internal/Platform;->afterHandshake(Ljavax/net/ssl/SSLSocket;)V
|
|
|
|
:cond_5
|
|
if-nez v8, :cond_6
|
|
|
|
invoke-static {v6}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
|
|
|
|
:cond_6
|
|
return-void
|
|
|
|
.end local v5 # "maybeProtocol":Ljava/lang/String;
|
|
:cond_7
|
|
const/4 v5, 0x0
|
|
|
|
goto :goto_0
|
|
|
|
.restart local v5 # "maybeProtocol":Ljava/lang/String;
|
|
:cond_8
|
|
:try_start_3
|
|
sget-object v10, Lokhttp3/Protocol;->HTTP_1_1:Lokhttp3/Protocol;
|
|
:try_end_3
|
|
.catch Ljava/lang/AssertionError; {:try_start_3 .. :try_end_3} :catch_0
|
|
.catchall {:try_start_3 .. :try_end_3} :catchall_0
|
|
|
|
goto :goto_1
|
|
|
|
.end local v3 # "connectionSpec":Lokhttp3/ConnectionSpec;
|
|
.end local v5 # "maybeProtocol":Ljava/lang/String;
|
|
.end local v9 # "unverifiedHandshake":Lokhttp3/Handshake;
|
|
.restart local v4 # "e":Ljava/lang/AssertionError;
|
|
:cond_9
|
|
:try_start_4
|
|
throw v4
|
|
:try_end_4
|
|
.catchall {:try_start_4 .. :try_end_4} :catchall_0
|
|
.end method
|
|
|
|
.method private createTunnel(II)V
|
|
.locals 12
|
|
.param p1, "readTimeout" # I
|
|
.param p2, "writeTimeout" # I
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
invoke-direct {p0}, Lokhttp3/internal/io/RealConnection;->createTunnelRequest()Lokhttp3/Request;
|
|
|
|
move-result-object v6
|
|
|
|
.local v6, "tunnelRequest":Lokhttp3/Request;
|
|
invoke-virtual {v6}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
|
|
|
|
move-result-object v7
|
|
|
|
.local v7, "url":Lokhttp3/HttpUrl;
|
|
new-instance v8, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v8}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v9, "CONNECT "
|
|
|
|
invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v8
|
|
|
|
const/4 v9, 0x1
|
|
|
|
invoke-static {v7, v9}, Lokhttp3/internal/Util;->hostHeader(Lokhttp3/HttpUrl;Z)Ljava/lang/String;
|
|
|
|
move-result-object v9
|
|
|
|
invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v8
|
|
|
|
const-string v9, " HTTP/1.1"
|
|
|
|
invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
.local v1, "requestLine":Ljava/lang/String;
|
|
:cond_0
|
|
new-instance v5, Lokhttp3/internal/http/Http1xStream;
|
|
|
|
const/4 v8, 0x0
|
|
|
|
iget-object v9, p0, Lokhttp3/internal/io/RealConnection;->source:Lokio/BufferedSource;
|
|
|
|
iget-object v10, p0, Lokhttp3/internal/io/RealConnection;->sink:Lokio/BufferedSink;
|
|
|
|
invoke-direct {v5, v8, v9, v10}, Lokhttp3/internal/http/Http1xStream;-><init>(Lokhttp3/internal/http/StreamAllocation;Lokio/BufferedSource;Lokio/BufferedSink;)V
|
|
|
|
.local v5, "tunnelConnection":Lokhttp3/internal/http/Http1xStream;
|
|
iget-object v8, p0, Lokhttp3/internal/io/RealConnection;->source:Lokio/BufferedSource;
|
|
|
|
invoke-interface {v8}, Lokio/BufferedSource;->timeout()Lokio/Timeout;
|
|
|
|
move-result-object v8
|
|
|
|
int-to-long v10, p1
|
|
|
|
sget-object v9, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
|
|
|
|
invoke-virtual {v8, v10, v11, v9}, Lokio/Timeout;->timeout(JLjava/util/concurrent/TimeUnit;)Lokio/Timeout;
|
|
|
|
iget-object v8, p0, Lokhttp3/internal/io/RealConnection;->sink:Lokio/BufferedSink;
|
|
|
|
invoke-interface {v8}, Lokio/BufferedSink;->timeout()Lokio/Timeout;
|
|
|
|
move-result-object v8
|
|
|
|
int-to-long v10, p2
|
|
|
|
sget-object v9, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
|
|
|
|
invoke-virtual {v8, v10, v11, v9}, Lokio/Timeout;->timeout(JLjava/util/concurrent/TimeUnit;)Lokio/Timeout;
|
|
|
|
invoke-virtual {v6}, Lokhttp3/Request;->headers()Lokhttp3/Headers;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-virtual {v5, v8, v1}, Lokhttp3/internal/http/Http1xStream;->writeRequest(Lokhttp3/Headers;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v5}, Lokhttp3/internal/http/Http1xStream;->finishRequest()V
|
|
|
|
invoke-virtual {v5}, Lokhttp3/internal/http/Http1xStream;->readResponse()Lokhttp3/Response$Builder;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-virtual {v8, v6}, Lokhttp3/Response$Builder;->request(Lokhttp3/Request;)Lokhttp3/Response$Builder;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-virtual {v8}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
|
|
|
|
move-result-object v4
|
|
|
|
.local v4, "response":Lokhttp3/Response;
|
|
invoke-static {v4}, Lokhttp3/internal/http/OkHeaders;->contentLength(Lokhttp3/Response;)J
|
|
|
|
move-result-wide v2
|
|
|
|
.local v2, "contentLength":J
|
|
const-wide/16 v8, -0x1
|
|
|
|
cmp-long v8, v2, v8
|
|
|
|
if-nez v8, :cond_1
|
|
|
|
const-wide/16 v2, 0x0
|
|
|
|
:cond_1
|
|
invoke-virtual {v5, v2, v3}, Lokhttp3/internal/http/Http1xStream;->newFixedLengthSource(J)Lokio/Source;
|
|
|
|
move-result-object v0
|
|
|
|
.local v0, "body":Lokio/Source;
|
|
const v8, 0x7fffffff
|
|
|
|
sget-object v9, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
|
|
|
|
invoke-static {v0, v8, v9}, Lokhttp3/internal/Util;->skipAll(Lokio/Source;ILjava/util/concurrent/TimeUnit;)Z
|
|
|
|
invoke-interface {v0}, Lokio/Source;->close()V
|
|
|
|
invoke-virtual {v4}, Lokhttp3/Response;->code()I
|
|
|
|
move-result v8
|
|
|
|
sparse-switch v8, :sswitch_data_0
|
|
|
|
new-instance v8, Ljava/io/IOException;
|
|
|
|
new-instance v9, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v9}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v10, "Unexpected response code for CONNECT: "
|
|
|
|
invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v9
|
|
|
|
invoke-virtual {v4}, Lokhttp3/Response;->code()I
|
|
|
|
move-result v10
|
|
|
|
invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v9
|
|
|
|
invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v9
|
|
|
|
invoke-direct {v8, v9}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v8
|
|
|
|
:sswitch_0
|
|
iget-object v8, p0, Lokhttp3/internal/io/RealConnection;->source:Lokio/BufferedSource;
|
|
|
|
invoke-interface {v8}, Lokio/BufferedSource;->buffer()Lokio/Buffer;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-virtual {v8}, Lokio/Buffer;->exhausted()Z
|
|
|
|
move-result v8
|
|
|
|
if-eqz v8, :cond_2
|
|
|
|
iget-object v8, p0, Lokhttp3/internal/io/RealConnection;->sink:Lokio/BufferedSink;
|
|
|
|
invoke-interface {v8}, Lokio/BufferedSink;->buffer()Lokio/Buffer;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-virtual {v8}, Lokio/Buffer;->exhausted()Z
|
|
|
|
move-result v8
|
|
|
|
if-nez v8, :cond_3
|
|
|
|
:cond_2
|
|
new-instance v8, Ljava/io/IOException;
|
|
|
|
const-string v9, "TLS tunnel buffered too many bytes!"
|
|
|
|
invoke-direct {v8, v9}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v8
|
|
|
|
:sswitch_1
|
|
iget-object v8, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v8}, Lokhttp3/Route;->address()Lokhttp3/Address;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-virtual {v8}, Lokhttp3/Address;->proxyAuthenticator()Lokhttp3/Authenticator;
|
|
|
|
move-result-object v8
|
|
|
|
iget-object v9, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-interface {v8, v9, v4}, Lokhttp3/Authenticator;->authenticate(Lokhttp3/Route;Lokhttp3/Response;)Lokhttp3/Request;
|
|
|
|
move-result-object v6
|
|
|
|
if-nez v6, :cond_0
|
|
|
|
new-instance v8, Ljava/io/IOException;
|
|
|
|
const-string v9, "Failed to authenticate with proxy"
|
|
|
|
invoke-direct {v8, v9}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v8
|
|
|
|
:cond_3
|
|
return-void
|
|
|
|
:sswitch_data_0
|
|
.sparse-switch
|
|
0xc8 -> :sswitch_0
|
|
0x197 -> :sswitch_1
|
|
.end sparse-switch
|
|
.end method
|
|
|
|
.method private createTunnelRequest()Lokhttp3/Request;
|
|
.locals 4
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
new-instance v0, Lokhttp3/Request$Builder;
|
|
|
|
invoke-direct {v0}, Lokhttp3/Request$Builder;-><init>()V
|
|
|
|
iget-object v1, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Route;->address()Lokhttp3/Address;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1}, Lokhttp3/Request$Builder;->url(Lokhttp3/HttpUrl;)Lokhttp3/Request$Builder;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "Host"
|
|
|
|
iget-object v2, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v2}, Lokhttp3/Route;->address()Lokhttp3/Address;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v2}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
|
|
|
|
move-result-object v2
|
|
|
|
const/4 v3, 0x1
|
|
|
|
invoke-static {v2, v3}, Lokhttp3/internal/Util;->hostHeader(Lokhttp3/HttpUrl;Z)Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v0, v1, v2}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "Proxy-Connection"
|
|
|
|
const-string v2, "Keep-Alive"
|
|
|
|
invoke-virtual {v0, v1, v2}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "User-Agent"
|
|
|
|
invoke-static {}, Lokhttp3/internal/Version;->userAgent()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v0, v1, v2}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Lokhttp3/Request$Builder;->build()Lokhttp3/Request;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public cancel()V
|
|
.locals 1
|
|
|
|
.prologue
|
|
iget-object v0, p0, Lokhttp3/internal/io/RealConnection;->rawSocket:Ljava/net/Socket;
|
|
|
|
invoke-static {v0}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public connect(IIILjava/util/List;Z)V
|
|
.locals 9
|
|
.param p1, "connectTimeout" # I
|
|
.param p2, "readTimeout" # I
|
|
.param p3, "writeTimeout" # I
|
|
.param p5, "connectionRetryEnabled" # Z
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(III",
|
|
"Ljava/util/List",
|
|
"<",
|
|
"Lokhttp3/ConnectionSpec;",
|
|
">;Z)V"
|
|
}
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Lokhttp3/internal/http/RouteException;
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
.local p4, "connectionSpecs":Ljava/util/List;, "Ljava/util/List<Lokhttp3/ConnectionSpec;>;"
|
|
const/4 v7, 0x0
|
|
|
|
iget-object v5, p0, Lokhttp3/internal/io/RealConnection;->protocol:Lokhttp3/Protocol;
|
|
|
|
if-eqz v5, :cond_0
|
|
|
|
new-instance v5, Ljava/lang/IllegalStateException;
|
|
|
|
const-string v6, "already connected"
|
|
|
|
invoke-direct {v5, v6}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v5
|
|
|
|
:cond_0
|
|
const/4 v4, 0x0
|
|
|
|
.local v4, "routeException":Lokhttp3/internal/http/RouteException;
|
|
new-instance v1, Lokhttp3/internal/ConnectionSpecSelector;
|
|
|
|
invoke-direct {v1, p4}, Lokhttp3/internal/ConnectionSpecSelector;-><init>(Ljava/util/List;)V
|
|
|
|
.local v1, "connectionSpecSelector":Lokhttp3/internal/ConnectionSpecSelector;
|
|
iget-object v5, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v5}, Lokhttp3/Route;->proxy()Ljava/net/Proxy;
|
|
|
|
move-result-object v3
|
|
|
|
.local v3, "proxy":Ljava/net/Proxy;
|
|
iget-object v5, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v5}, Lokhttp3/Route;->address()Lokhttp3/Address;
|
|
|
|
move-result-object v0
|
|
|
|
.local v0, "address":Lokhttp3/Address;
|
|
iget-object v5, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v5}, Lokhttp3/Route;->address()Lokhttp3/Address;
|
|
|
|
move-result-object v5
|
|
|
|
invoke-virtual {v5}, Lokhttp3/Address;->sslSocketFactory()Ljavax/net/ssl/SSLSocketFactory;
|
|
|
|
move-result-object v5
|
|
|
|
if-nez v5, :cond_2
|
|
|
|
sget-object v5, Lokhttp3/ConnectionSpec;->CLEARTEXT:Lokhttp3/ConnectionSpec;
|
|
|
|
invoke-interface {p4, v5}, Ljava/util/List;->contains(Ljava/lang/Object;)Z
|
|
|
|
move-result v5
|
|
|
|
if-nez v5, :cond_2
|
|
|
|
new-instance v5, Lokhttp3/internal/http/RouteException;
|
|
|
|
new-instance v6, Ljava/net/UnknownServiceException;
|
|
|
|
new-instance v7, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v8, "CLEARTEXT communication not supported: "
|
|
|
|
invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v7
|
|
|
|
invoke-virtual {v7, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v7
|
|
|
|
invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v7
|
|
|
|
invoke-direct {v6, v7}, Ljava/net/UnknownServiceException;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-direct {v5, v6}, Lokhttp3/internal/http/RouteException;-><init>(Ljava/io/IOException;)V
|
|
|
|
throw v5
|
|
|
|
:cond_1
|
|
:try_start_0
|
|
new-instance v5, Ljava/net/Socket;
|
|
|
|
invoke-direct {v5, v3}, Ljava/net/Socket;-><init>(Ljava/net/Proxy;)V
|
|
|
|
:goto_0
|
|
iput-object v5, p0, Lokhttp3/internal/io/RealConnection;->rawSocket:Ljava/net/Socket;
|
|
|
|
invoke-direct {p0, p1, p2, p3, v1}, Lokhttp3/internal/io/RealConnection;->connectSocket(IIILokhttp3/internal/ConnectionSpecSelector;)V
|
|
:try_end_0
|
|
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
:cond_2
|
|
iget-object v5, p0, Lokhttp3/internal/io/RealConnection;->protocol:Lokhttp3/Protocol;
|
|
|
|
if-nez v5, :cond_6
|
|
|
|
:try_start_1
|
|
invoke-virtual {v3}, Ljava/net/Proxy;->type()Ljava/net/Proxy$Type;
|
|
|
|
move-result-object v5
|
|
|
|
sget-object v6, Ljava/net/Proxy$Type;->DIRECT:Ljava/net/Proxy$Type;
|
|
|
|
if-eq v5, v6, :cond_3
|
|
|
|
invoke-virtual {v3}, Ljava/net/Proxy;->type()Ljava/net/Proxy$Type;
|
|
|
|
move-result-object v5
|
|
|
|
sget-object v6, Ljava/net/Proxy$Type;->HTTP:Ljava/net/Proxy$Type;
|
|
|
|
if-ne v5, v6, :cond_1
|
|
|
|
:cond_3
|
|
invoke-virtual {v0}, Lokhttp3/Address;->socketFactory()Ljavax/net/SocketFactory;
|
|
|
|
move-result-object v5
|
|
|
|
invoke-virtual {v5}, Ljavax/net/SocketFactory;->createSocket()Ljava/net/Socket;
|
|
:try_end_1
|
|
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0
|
|
|
|
move-result-object v5
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception v2
|
|
|
|
.local v2, "e":Ljava/io/IOException;
|
|
iget-object v5, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
invoke-static {v5}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
|
|
|
|
iget-object v5, p0, Lokhttp3/internal/io/RealConnection;->rawSocket:Ljava/net/Socket;
|
|
|
|
invoke-static {v5}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
|
|
|
|
iput-object v7, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
iput-object v7, p0, Lokhttp3/internal/io/RealConnection;->rawSocket:Ljava/net/Socket;
|
|
|
|
iput-object v7, p0, Lokhttp3/internal/io/RealConnection;->source:Lokio/BufferedSource;
|
|
|
|
iput-object v7, p0, Lokhttp3/internal/io/RealConnection;->sink:Lokio/BufferedSink;
|
|
|
|
iput-object v7, p0, Lokhttp3/internal/io/RealConnection;->handshake:Lokhttp3/Handshake;
|
|
|
|
iput-object v7, p0, Lokhttp3/internal/io/RealConnection;->protocol:Lokhttp3/Protocol;
|
|
|
|
if-nez v4, :cond_5
|
|
|
|
new-instance v4, Lokhttp3/internal/http/RouteException;
|
|
|
|
.end local v4 # "routeException":Lokhttp3/internal/http/RouteException;
|
|
invoke-direct {v4, v2}, Lokhttp3/internal/http/RouteException;-><init>(Ljava/io/IOException;)V
|
|
|
|
.restart local v4 # "routeException":Lokhttp3/internal/http/RouteException;
|
|
:goto_1
|
|
if-eqz p5, :cond_4
|
|
|
|
invoke-virtual {v1, v2}, Lokhttp3/internal/ConnectionSpecSelector;->connectionFailed(Ljava/io/IOException;)Z
|
|
|
|
move-result v5
|
|
|
|
if-nez v5, :cond_2
|
|
|
|
:cond_4
|
|
throw v4
|
|
|
|
:cond_5
|
|
invoke-virtual {v4, v2}, Lokhttp3/internal/http/RouteException;->addConnectException(Ljava/io/IOException;)V
|
|
|
|
goto :goto_1
|
|
|
|
.end local v2 # "e":Ljava/io/IOException;
|
|
:cond_6
|
|
return-void
|
|
.end method
|
|
|
|
.method public handshake()Lokhttp3/Handshake;
|
|
.locals 1
|
|
|
|
.prologue
|
|
iget-object v0, p0, Lokhttp3/internal/io/RealConnection;->handshake:Lokhttp3/Handshake;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method isConnected()Z
|
|
.locals 1
|
|
|
|
.prologue
|
|
iget-object v0, p0, Lokhttp3/internal/io/RealConnection;->protocol:Lokhttp3/Protocol;
|
|
|
|
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 public isHealthy(Z)Z
|
|
.locals 6
|
|
.param p1, "doExtensiveChecks" # Z
|
|
|
|
.prologue
|
|
const/4 v3, 0x0
|
|
|
|
const/4 v2, 0x1
|
|
|
|
iget-object v4, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
invoke-virtual {v4}, Ljava/net/Socket;->isClosed()Z
|
|
|
|
move-result v4
|
|
|
|
if-nez v4, :cond_0
|
|
|
|
iget-object v4, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
invoke-virtual {v4}, Ljava/net/Socket;->isInputShutdown()Z
|
|
|
|
move-result v4
|
|
|
|
if-nez v4, :cond_0
|
|
|
|
iget-object v4, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
invoke-virtual {v4}, Ljava/net/Socket;->isOutputShutdown()Z
|
|
|
|
move-result v4
|
|
|
|
if-eqz v4, :cond_2
|
|
|
|
:cond_0
|
|
move v2, v3
|
|
|
|
:cond_1
|
|
:goto_0
|
|
return v2
|
|
|
|
:cond_2
|
|
iget-object v4, p0, Lokhttp3/internal/io/RealConnection;->framedConnection:Lokhttp3/internal/framed/FramedConnection;
|
|
|
|
if-nez v4, :cond_1
|
|
|
|
if-eqz p1, :cond_1
|
|
|
|
:try_start_0
|
|
iget-object v4, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
invoke-virtual {v4}, Ljava/net/Socket;->getSoTimeout()I
|
|
:try_end_0
|
|
.catch Ljava/net/SocketTimeoutException; {:try_start_0 .. :try_end_0} :catch_0
|
|
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1
|
|
|
|
move-result v1
|
|
|
|
.local v1, "readTimeout":I
|
|
:try_start_1
|
|
iget-object v4, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
const/4 v5, 0x1
|
|
|
|
invoke-virtual {v4, v5}, Ljava/net/Socket;->setSoTimeout(I)V
|
|
|
|
iget-object v4, p0, Lokhttp3/internal/io/RealConnection;->source:Lokio/BufferedSource;
|
|
|
|
invoke-interface {v4}, Lokio/BufferedSource;->exhausted()Z
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
move-result v4
|
|
|
|
if-eqz v4, :cond_3
|
|
|
|
:try_start_2
|
|
iget-object v4, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
invoke-virtual {v4, v1}, Ljava/net/Socket;->setSoTimeout(I)V
|
|
|
|
move v2, v3
|
|
|
|
goto :goto_0
|
|
|
|
:cond_3
|
|
iget-object v4, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
invoke-virtual {v4, v1}, Ljava/net/Socket;->setSoTimeout(I)V
|
|
|
|
goto :goto_0
|
|
|
|
.end local v1 # "readTimeout":I
|
|
:catch_0
|
|
move-exception v3
|
|
|
|
goto :goto_0
|
|
|
|
.restart local v1 # "readTimeout":I
|
|
:catchall_0
|
|
move-exception v4
|
|
|
|
iget-object v5, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
invoke-virtual {v5, v1}, Ljava/net/Socket;->setSoTimeout(I)V
|
|
|
|
throw v4
|
|
:try_end_2
|
|
.catch Ljava/net/SocketTimeoutException; {:try_start_2 .. :try_end_2} :catch_0
|
|
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_1
|
|
|
|
.end local v1 # "readTimeout":I
|
|
:catch_1
|
|
move-exception v0
|
|
|
|
.local v0, "e":Ljava/io/IOException;
|
|
move v2, v3
|
|
|
|
goto :goto_0
|
|
.end method
|
|
|
|
.method public isMultiplexed()Z
|
|
.locals 1
|
|
|
|
.prologue
|
|
iget-object v0, p0, Lokhttp3/internal/io/RealConnection;->framedConnection:Lokhttp3/internal/framed/FramedConnection;
|
|
|
|
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 public onSettings(Lokhttp3/internal/framed/FramedConnection;)V
|
|
.locals 1
|
|
.param p1, "connection" # Lokhttp3/internal/framed/FramedConnection;
|
|
|
|
.prologue
|
|
invoke-virtual {p1}, Lokhttp3/internal/framed/FramedConnection;->maxConcurrentStreams()I
|
|
|
|
move-result v0
|
|
|
|
iput v0, p0, Lokhttp3/internal/io/RealConnection;->allocationLimit:I
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public onStream(Lokhttp3/internal/framed/FramedStream;)V
|
|
.locals 1
|
|
.param p1, "stream" # Lokhttp3/internal/framed/FramedStream;
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
sget-object v0, Lokhttp3/internal/framed/ErrorCode;->REFUSED_STREAM:Lokhttp3/internal/framed/ErrorCode;
|
|
|
|
invoke-virtual {p1, v0}, Lokhttp3/internal/framed/FramedStream;->close(Lokhttp3/internal/framed/ErrorCode;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public protocol()Lokhttp3/Protocol;
|
|
.locals 1
|
|
|
|
.prologue
|
|
iget-object v0, p0, Lokhttp3/internal/io/RealConnection;->framedConnection:Lokhttp3/internal/framed/FramedConnection;
|
|
|
|
if-nez v0, :cond_1
|
|
|
|
iget-object v0, p0, Lokhttp3/internal/io/RealConnection;->protocol:Lokhttp3/Protocol;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
iget-object v0, p0, Lokhttp3/internal/io/RealConnection;->protocol:Lokhttp3/Protocol;
|
|
|
|
:goto_0
|
|
return-object v0
|
|
|
|
:cond_0
|
|
sget-object v0, Lokhttp3/Protocol;->HTTP_1_1:Lokhttp3/Protocol;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
iget-object v0, p0, Lokhttp3/internal/io/RealConnection;->framedConnection:Lokhttp3/internal/framed/FramedConnection;
|
|
|
|
invoke-virtual {v0}, Lokhttp3/internal/framed/FramedConnection;->getProtocol()Lokhttp3/Protocol;
|
|
|
|
move-result-object v0
|
|
|
|
goto :goto_0
|
|
.end method
|
|
|
|
.method public route()Lokhttp3/Route;
|
|
.locals 1
|
|
|
|
.prologue
|
|
iget-object v0, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public socket()Ljava/net/Socket;
|
|
.locals 1
|
|
|
|
.prologue
|
|
iget-object v0, p0, Lokhttp3/internal/io/RealConnection;->socket:Ljava/net/Socket;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public toString()Ljava/lang/String;
|
|
.locals 2
|
|
|
|
.prologue
|
|
new-instance v0, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v1, "Connection{"
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
iget-object v1, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Route;->address()Lokhttp3/Address;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, ":"
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
iget-object v1, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Route;->address()Lokhttp3/Address;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Lokhttp3/HttpUrl;->port()I
|
|
|
|
move-result v1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, ", proxy="
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
iget-object v1, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Route;->proxy()Ljava/net/Proxy;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, " hostAddress="
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
iget-object v1, p0, Lokhttp3/internal/io/RealConnection;->route:Lokhttp3/Route;
|
|
|
|
invoke-virtual {v1}, Lokhttp3/Route;->socketAddress()Ljava/net/InetSocketAddress;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, " cipherSuite="
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v1
|
|
|
|
iget-object v0, p0, Lokhttp3/internal/io/RealConnection;->handshake:Lokhttp3/Handshake;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
iget-object v0, p0, Lokhttp3/internal/io/RealConnection;->handshake:Lokhttp3/Handshake;
|
|
|
|
invoke-virtual {v0}, Lokhttp3/Handshake;->cipherSuite()Lokhttp3/CipherSuite;
|
|
|
|
move-result-object v0
|
|
|
|
:goto_0
|
|
invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, " protocol="
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
iget-object v1, p0, Lokhttp3/internal/io/RealConnection;->protocol:Lokhttp3/Protocol;
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
const/16 v1, 0x7d
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
|
|
:cond_0
|
|
const-string v0, "none"
|
|
|
|
goto :goto_0
|
|
.end method
|