529 lines
13 KiB
Smali
529 lines
13 KiB
Smali
.class public final Lokhttp3/internal/http/CallServerInterceptor;
|
|
.super Ljava/lang/Object;
|
|
.source "CallServerInterceptor.kt"
|
|
|
|
# interfaces
|
|
.implements Lokhttp3/Interceptor;
|
|
|
|
|
|
# annotations
|
|
.annotation runtime Lkotlin/Metadata;
|
|
bv = {
|
|
0x1,
|
|
0x0,
|
|
0x3
|
|
}
|
|
d1 = {
|
|
"\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u00a2\u0006\u0002\u0010\u0004J\u0010\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\u0008H\u0016R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004\u00a2\u0006\u0002\n\u0000\u00a8\u0006\t"
|
|
}
|
|
d2 = {
|
|
"Lokhttp3/internal/http/CallServerInterceptor;",
|
|
"Lokhttp3/Interceptor;",
|
|
"forWebSocket",
|
|
"",
|
|
"(Z)V",
|
|
"intercept",
|
|
"Lokhttp3/Response;",
|
|
"chain",
|
|
"Lokhttp3/Interceptor$Chain;",
|
|
"okhttp"
|
|
}
|
|
k = 0x1
|
|
mv = {
|
|
0x1,
|
|
0x4,
|
|
0x0
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field private final forWebSocket:Z
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Z)V
|
|
.locals 0
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
iput-boolean p1, p0, Lokhttp3/internal/http/CallServerInterceptor;->forWebSocket:Z
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public intercept(Lokhttp3/Interceptor$Chain;)Lokhttp3/Response;
|
|
.locals 11
|
|
.param p1 # Lokhttp3/Interceptor$Chain;
|
|
.annotation build Lorg/jetbrains/annotations/NotNull;
|
|
.end annotation
|
|
.end param
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.annotation build Lorg/jetbrains/annotations/NotNull;
|
|
.end annotation
|
|
|
|
const-string v0, "chain"
|
|
|
|
invoke-static {p1, v0}, Lkotlin/jvm/internal/f0;->p(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
.line 1
|
|
check-cast p1, Lokhttp3/internal/http/RealInterceptorChain;
|
|
|
|
.line 2
|
|
invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->getExchange$okhttp()Lokhttp3/internal/connection/Exchange;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0}, Lkotlin/jvm/internal/f0;->m(Ljava/lang/Object;)V
|
|
|
|
.line 3
|
|
invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->getRequest$okhttp()Lokhttp3/Request;
|
|
|
|
move-result-object p1
|
|
|
|
.line 4
|
|
invoke-virtual {p1}, Lokhttp3/Request;->body()Lokhttp3/RequestBody;
|
|
|
|
move-result-object v1
|
|
|
|
.line 5
|
|
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
|
|
|
|
move-result-wide v2
|
|
|
|
.line 6
|
|
invoke-virtual {v0, p1}, Lokhttp3/internal/connection/Exchange;->writeRequestHeaders(Lokhttp3/Request;)V
|
|
|
|
.line 7
|
|
invoke-virtual {p1}, Lokhttp3/Request;->method()Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-static {v4}, Lokhttp3/internal/http/HttpMethod;->permitsRequestBody(Ljava/lang/String;)Z
|
|
|
|
move-result v4
|
|
|
|
const/4 v5, 0x0
|
|
|
|
const/4 v6, 0x0
|
|
|
|
const/4 v7, 0x1
|
|
|
|
if-eqz v4, :cond_3
|
|
|
|
if-eqz v1, :cond_3
|
|
|
|
const-string v4, "Expect"
|
|
|
|
.line 8
|
|
invoke-virtual {p1, v4}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v4
|
|
|
|
const-string v8, "100-continue"
|
|
|
|
invoke-static {v8, v4, v7}, Lkotlin/text/u;->K1(Ljava/lang/String;Ljava/lang/String;Z)Z
|
|
|
|
move-result v4
|
|
|
|
if-eqz v4, :cond_0
|
|
|
|
.line 9
|
|
invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->flushRequest()V
|
|
|
|
.line 10
|
|
invoke-virtual {v0, v7}, Lokhttp3/internal/connection/Exchange;->readResponseHeaders(Z)Lokhttp3/Response$Builder;
|
|
|
|
move-result-object v4
|
|
|
|
.line 11
|
|
invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->responseHeadersStart()V
|
|
|
|
move v8, v6
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
move-object v4, v5
|
|
|
|
move v8, v7
|
|
|
|
:goto_0
|
|
if-nez v4, :cond_2
|
|
|
|
.line 12
|
|
invoke-virtual {v1}, Lokhttp3/RequestBody;->isDuplex()Z
|
|
|
|
move-result v9
|
|
|
|
if-eqz v9, :cond_1
|
|
|
|
.line 13
|
|
invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->flushRequest()V
|
|
|
|
.line 14
|
|
invoke-virtual {v0, p1, v7}, Lokhttp3/internal/connection/Exchange;->createRequestBody(Lokhttp3/Request;Z)Lzj/k0;
|
|
|
|
move-result-object v9
|
|
|
|
invoke-static {v9}, Lzj/z;->c(Lzj/k0;)Lzj/n;
|
|
|
|
move-result-object v9
|
|
|
|
.line 15
|
|
invoke-virtual {v1, v9}, Lokhttp3/RequestBody;->writeTo(Lzj/n;)V
|
|
|
|
goto :goto_1
|
|
|
|
.line 16
|
|
:cond_1
|
|
invoke-virtual {v0, p1, v6}, Lokhttp3/internal/connection/Exchange;->createRequestBody(Lokhttp3/Request;Z)Lzj/k0;
|
|
|
|
move-result-object v9
|
|
|
|
invoke-static {v9}, Lzj/z;->c(Lzj/k0;)Lzj/n;
|
|
|
|
move-result-object v9
|
|
|
|
.line 17
|
|
invoke-virtual {v1, v9}, Lokhttp3/RequestBody;->writeTo(Lzj/n;)V
|
|
|
|
.line 18
|
|
invoke-interface {v9}, Lzj/k0;->close()V
|
|
|
|
goto :goto_1
|
|
|
|
.line 19
|
|
:cond_2
|
|
invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->noRequestBody()V
|
|
|
|
.line 20
|
|
invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->getConnection$okhttp()Lokhttp3/internal/connection/RealConnection;
|
|
|
|
move-result-object v9
|
|
|
|
invoke-virtual {v9}, Lokhttp3/internal/connection/RealConnection;->isMultiplexed$okhttp()Z
|
|
|
|
move-result v9
|
|
|
|
if-nez v9, :cond_4
|
|
|
|
.line 21
|
|
invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->noNewExchangesOnConnection()V
|
|
|
|
goto :goto_1
|
|
|
|
.line 22
|
|
:cond_3
|
|
invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->noRequestBody()V
|
|
|
|
move-object v4, v5
|
|
|
|
move v8, v7
|
|
|
|
:cond_4
|
|
:goto_1
|
|
if-eqz v1, :cond_5
|
|
|
|
.line 23
|
|
invoke-virtual {v1}, Lokhttp3/RequestBody;->isDuplex()Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_6
|
|
|
|
.line 24
|
|
:cond_5
|
|
invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->finishRequest()V
|
|
|
|
:cond_6
|
|
if-nez v4, :cond_7
|
|
|
|
.line 25
|
|
invoke-virtual {v0, v6}, Lokhttp3/internal/connection/Exchange;->readResponseHeaders(Z)Lokhttp3/Response$Builder;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-static {v4}, Lkotlin/jvm/internal/f0;->m(Ljava/lang/Object;)V
|
|
|
|
if-eqz v8, :cond_7
|
|
|
|
.line 26
|
|
invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->responseHeadersStart()V
|
|
|
|
move v8, v6
|
|
|
|
.line 27
|
|
:cond_7
|
|
invoke-virtual {v4, p1}, Lokhttp3/Response$Builder;->request(Lokhttp3/Request;)Lokhttp3/Response$Builder;
|
|
|
|
move-result-object v1
|
|
|
|
.line 28
|
|
invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->getConnection$okhttp()Lokhttp3/internal/connection/RealConnection;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v4}, Lokhttp3/internal/connection/RealConnection;->handshake()Lokhttp3/Handshake;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v1, v4}, Lokhttp3/Response$Builder;->handshake(Lokhttp3/Handshake;)Lokhttp3/Response$Builder;
|
|
|
|
move-result-object v1
|
|
|
|
.line 29
|
|
invoke-virtual {v1, v2, v3}, Lokhttp3/Response$Builder;->sentRequestAtMillis(J)Lokhttp3/Response$Builder;
|
|
|
|
move-result-object v1
|
|
|
|
.line 30
|
|
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
|
|
|
|
move-result-wide v9
|
|
|
|
invoke-virtual {v1, v9, v10}, Lokhttp3/Response$Builder;->receivedResponseAtMillis(J)Lokhttp3/Response$Builder;
|
|
|
|
move-result-object v1
|
|
|
|
.line 31
|
|
invoke-virtual {v1}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
|
|
|
|
move-result-object v1
|
|
|
|
.line 32
|
|
invoke-virtual {v1}, Lokhttp3/Response;->code()I
|
|
|
|
move-result v4
|
|
|
|
const/16 v9, 0x64
|
|
|
|
if-ne v4, v9, :cond_9
|
|
|
|
.line 33
|
|
invoke-virtual {v0, v6}, Lokhttp3/internal/connection/Exchange;->readResponseHeaders(Z)Lokhttp3/Response$Builder;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-static {v1}, Lkotlin/jvm/internal/f0;->m(Ljava/lang/Object;)V
|
|
|
|
if-eqz v8, :cond_8
|
|
|
|
.line 34
|
|
invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->responseHeadersStart()V
|
|
|
|
.line 35
|
|
:cond_8
|
|
invoke-virtual {v1, p1}, Lokhttp3/Response$Builder;->request(Lokhttp3/Request;)Lokhttp3/Response$Builder;
|
|
|
|
move-result-object p1
|
|
|
|
.line 36
|
|
invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->getConnection$okhttp()Lokhttp3/internal/connection/RealConnection;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Lokhttp3/internal/connection/RealConnection;->handshake()Lokhttp3/Handshake;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {p1, v1}, Lokhttp3/Response$Builder;->handshake(Lokhttp3/Handshake;)Lokhttp3/Response$Builder;
|
|
|
|
move-result-object p1
|
|
|
|
.line 37
|
|
invoke-virtual {p1, v2, v3}, Lokhttp3/Response$Builder;->sentRequestAtMillis(J)Lokhttp3/Response$Builder;
|
|
|
|
move-result-object p1
|
|
|
|
.line 38
|
|
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
|
|
|
|
move-result-wide v1
|
|
|
|
invoke-virtual {p1, v1, v2}, Lokhttp3/Response$Builder;->receivedResponseAtMillis(J)Lokhttp3/Response$Builder;
|
|
|
|
move-result-object p1
|
|
|
|
.line 39
|
|
invoke-virtual {p1}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
|
|
|
|
move-result-object v1
|
|
|
|
.line 40
|
|
invoke-virtual {v1}, Lokhttp3/Response;->code()I
|
|
|
|
move-result v4
|
|
|
|
.line 41
|
|
:cond_9
|
|
invoke-virtual {v0, v1}, Lokhttp3/internal/connection/Exchange;->responseHeadersEnd(Lokhttp3/Response;)V
|
|
|
|
.line 42
|
|
iget-boolean p1, p0, Lokhttp3/internal/http/CallServerInterceptor;->forWebSocket:Z
|
|
|
|
if-eqz p1, :cond_a
|
|
|
|
const/16 p1, 0x65
|
|
|
|
if-ne v4, p1, :cond_a
|
|
|
|
.line 43
|
|
invoke-virtual {v1}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder;
|
|
|
|
move-result-object p1
|
|
|
|
.line 44
|
|
sget-object v1, Lokhttp3/internal/Util;->EMPTY_RESPONSE:Lokhttp3/ResponseBody;
|
|
|
|
invoke-virtual {p1, v1}, Lokhttp3/Response$Builder;->body(Lokhttp3/ResponseBody;)Lokhttp3/Response$Builder;
|
|
|
|
move-result-object p1
|
|
|
|
.line 45
|
|
invoke-virtual {p1}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
|
|
|
|
move-result-object p1
|
|
|
|
goto :goto_2
|
|
|
|
.line 46
|
|
:cond_a
|
|
invoke-virtual {v1}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder;
|
|
|
|
move-result-object p1
|
|
|
|
.line 47
|
|
invoke-virtual {v0, v1}, Lokhttp3/internal/connection/Exchange;->openResponseBody(Lokhttp3/Response;)Lokhttp3/ResponseBody;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {p1, v1}, Lokhttp3/Response$Builder;->body(Lokhttp3/ResponseBody;)Lokhttp3/Response$Builder;
|
|
|
|
move-result-object p1
|
|
|
|
.line 48
|
|
invoke-virtual {p1}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
|
|
|
|
move-result-object p1
|
|
|
|
.line 49
|
|
:goto_2
|
|
invoke-virtual {p1}, Lokhttp3/Response;->request()Lokhttp3/Request;
|
|
|
|
move-result-object v1
|
|
|
|
const-string v2, "Connection"
|
|
|
|
invoke-virtual {v1, v2}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
const-string v3, "close"
|
|
|
|
invoke-static {v3, v1, v7}, Lkotlin/text/u;->K1(Ljava/lang/String;Ljava/lang/String;Z)Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_b
|
|
|
|
const/4 v1, 0x2
|
|
|
|
.line 50
|
|
invoke-static {p1, v2, v5, v1, v5}, Lokhttp3/Response;->header$default(Lokhttp3/Response;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-static {v3, v1, v7}, Lkotlin/text/u;->K1(Ljava/lang/String;Ljava/lang/String;Z)Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_c
|
|
|
|
.line 51
|
|
:cond_b
|
|
invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->noNewExchangesOnConnection()V
|
|
|
|
:cond_c
|
|
const/16 v0, 0xcc
|
|
|
|
if-eq v4, v0, :cond_d
|
|
|
|
const/16 v0, 0xcd
|
|
|
|
if-ne v4, v0, :cond_10
|
|
|
|
.line 52
|
|
:cond_d
|
|
invoke-virtual {p1}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_e
|
|
|
|
invoke-virtual {v0}, Lokhttp3/ResponseBody;->contentLength()J
|
|
|
|
move-result-wide v0
|
|
|
|
goto :goto_3
|
|
|
|
:cond_e
|
|
const-wide/16 v0, -0x1
|
|
|
|
:goto_3
|
|
const-wide/16 v2, 0x0
|
|
|
|
cmp-long v0, v0, v2
|
|
|
|
if-lez v0, :cond_10
|
|
|
|
.line 53
|
|
new-instance v0, Ljava/net/ProtocolException;
|
|
|
|
const-string v1, "HTTP "
|
|
|
|
const-string v2, " had non-zero Content-Length: "
|
|
|
|
.line 54
|
|
invoke-static {v1, v4, v2}, Landroid/support/v4/media/a;->a(Ljava/lang/String;ILjava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {p1}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_f
|
|
|
|
invoke-virtual {p1}, Lokhttp3/ResponseBody;->contentLength()J
|
|
|
|
move-result-wide v2
|
|
|
|
invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;
|
|
|
|
move-result-object v5
|
|
|
|
:cond_f
|
|
invoke-virtual {v1, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
.line 55
|
|
invoke-direct {v0, p1}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_10
|
|
return-object p1
|
|
.end method
|