123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401 |
- .class public final Lokhttp3/internal/http/CallServerInterceptor;
- .super Ljava/lang/Object;
- .source ""
- # interfaces
- .implements Lokhttp3/Interceptor;
- # annotations
- .annotation system Ldalvik/annotation/MemberClasses;
- value = {
- Lokhttp3/internal/http/CallServerInterceptor$CountingSink;
- }
- .end annotation
- # instance fields
- .field private final forWebSocket:Z
- # direct methods
- .method public constructor <init>(Z)V
- .locals 0
- 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
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- check-cast p1, Lokhttp3/internal/http/RealInterceptorChain;
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->httpStream()Lokhttp3/internal/http/HttpCodec;
- move-result-object v0
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->streamAllocation()Lokhttp3/internal/connection/StreamAllocation;
- move-result-object v1
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->connection()Lokhttp3/Connection;
- move-result-object v2
- check-cast v2, Lokhttp3/internal/connection/RealConnection;
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->request()Lokhttp3/Request;
- move-result-object v3
- invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
- move-result-wide v4
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->eventListener()Lokhttp3/EventListener;
- move-result-object v6
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->call()Lokhttp3/Call;
- move-result-object v7
- invoke-virtual {v6, v7}, Lokhttp3/EventListener;->requestHeadersStart(Lokhttp3/Call;)V
- invoke-interface {v0, v3}, Lokhttp3/internal/http/HttpCodec;->writeRequestHeaders(Lokhttp3/Request;)V
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->eventListener()Lokhttp3/EventListener;
- move-result-object v6
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->call()Lokhttp3/Call;
- move-result-object v7
- invoke-virtual {v6, v7, v3}, Lokhttp3/EventListener;->requestHeadersEnd(Lokhttp3/Call;Lokhttp3/Request;)V
- invoke-virtual {v3}, Lokhttp3/Request;->method()Ljava/lang/String;
- move-result-object v6
- invoke-static {v6}, Lokhttp3/internal/http/HttpMethod;->permitsRequestBody(Ljava/lang/String;)Z
- move-result v6
- const/4 v7, 0x0
- if-eqz v6, :cond_2
- invoke-virtual {v3}, Lokhttp3/Request;->body()Lokhttp3/RequestBody;
- move-result-object v6
- if-eqz v6, :cond_2
- const-string v6, "Expect"
- invoke-virtual {v3, v6}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v6
- const-string v8, "100-continue"
- invoke-virtual {v8, v6}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
- move-result v6
- if-eqz v6, :cond_0
- invoke-interface {v0}, Lokhttp3/internal/http/HttpCodec;->flushRequest()V
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->eventListener()Lokhttp3/EventListener;
- move-result-object v6
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->call()Lokhttp3/Call;
- move-result-object v7
- invoke-virtual {v6, v7}, Lokhttp3/EventListener;->responseHeadersStart(Lokhttp3/Call;)V
- const/4 v6, 0x1
- invoke-interface {v0, v6}, Lokhttp3/internal/http/HttpCodec;->readResponseHeaders(Z)Lokhttp3/Response$Builder;
- move-result-object v7
- :cond_0
- if-nez v7, :cond_1
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->eventListener()Lokhttp3/EventListener;
- move-result-object v2
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->call()Lokhttp3/Call;
- move-result-object v6
- invoke-virtual {v2, v6}, Lokhttp3/EventListener;->requestBodyStart(Lokhttp3/Call;)V
- invoke-virtual {v3}, Lokhttp3/Request;->body()Lokhttp3/RequestBody;
- move-result-object v2
- invoke-virtual {v2}, Lokhttp3/RequestBody;->contentLength()J
- move-result-wide v8
- new-instance v2, Lokhttp3/internal/http/CallServerInterceptor$CountingSink;
- invoke-interface {v0, v3, v8, v9}, Lokhttp3/internal/http/HttpCodec;->createRequestBody(Lokhttp3/Request;J)Lokio/Sink;
- move-result-object v6
- invoke-direct {v2, v6}, Lokhttp3/internal/http/CallServerInterceptor$CountingSink;-><init>(Lokio/Sink;)V
- invoke-static {v2}, Lokio/Okio;->buffer(Lokio/Sink;)Lokio/BufferedSink;
- move-result-object v6
- invoke-virtual {v3}, Lokhttp3/Request;->body()Lokhttp3/RequestBody;
- move-result-object v8
- invoke-virtual {v8, v6}, Lokhttp3/RequestBody;->writeTo(Lokio/BufferedSink;)V
- invoke-interface {v6}, Lokio/Sink;->close()V
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->eventListener()Lokhttp3/EventListener;
- move-result-object v6
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->call()Lokhttp3/Call;
- move-result-object v8
- iget-wide v9, v2, Lokhttp3/internal/http/CallServerInterceptor$CountingSink;->successfulCount:J
- invoke-virtual {v6, v8, v9, v10}, Lokhttp3/EventListener;->requestBodyEnd(Lokhttp3/Call;J)V
- goto :goto_0
- :cond_1
- invoke-virtual {v2}, Lokhttp3/internal/connection/RealConnection;->isMultiplexed()Z
- move-result v2
- if-nez v2, :cond_2
- invoke-virtual {v1}, Lokhttp3/internal/connection/StreamAllocation;->noNewStreams()V
- :cond_2
- :goto_0
- invoke-interface {v0}, Lokhttp3/internal/http/HttpCodec;->finishRequest()V
- if-nez v7, :cond_3
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->eventListener()Lokhttp3/EventListener;
- move-result-object v2
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->call()Lokhttp3/Call;
- move-result-object v6
- invoke-virtual {v2, v6}, Lokhttp3/EventListener;->responseHeadersStart(Lokhttp3/Call;)V
- const/4 v2, 0x0
- invoke-interface {v0, v2}, Lokhttp3/internal/http/HttpCodec;->readResponseHeaders(Z)Lokhttp3/Response$Builder;
- move-result-object v7
- :cond_3
- invoke-virtual {v7, v3}, Lokhttp3/Response$Builder;->request(Lokhttp3/Request;)Lokhttp3/Response$Builder;
- move-result-object v2
- invoke-virtual {v1}, Lokhttp3/internal/connection/StreamAllocation;->connection()Lokhttp3/internal/connection/RealConnection;
- move-result-object v3
- invoke-virtual {v3}, Lokhttp3/internal/connection/RealConnection;->handshake()Lokhttp3/Handshake;
- move-result-object v3
- invoke-virtual {v2, v3}, Lokhttp3/Response$Builder;->handshake(Lokhttp3/Handshake;)Lokhttp3/Response$Builder;
- move-result-object v2
- invoke-virtual {v2, v4, v5}, Lokhttp3/Response$Builder;->sentRequestAtMillis(J)Lokhttp3/Response$Builder;
- move-result-object v2
- invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
- move-result-wide v3
- invoke-virtual {v2, v3, v4}, Lokhttp3/Response$Builder;->receivedResponseAtMillis(J)Lokhttp3/Response$Builder;
- move-result-object v2
- invoke-virtual {v2}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
- move-result-object v2
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->eventListener()Lokhttp3/EventListener;
- move-result-object v3
- invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->call()Lokhttp3/Call;
- move-result-object p1
- invoke-virtual {v3, p1, v2}, Lokhttp3/EventListener;->responseHeadersEnd(Lokhttp3/Call;Lokhttp3/Response;)V
- invoke-virtual {v2}, Lokhttp3/Response;->code()I
- move-result p1
- iget-boolean v3, p0, Lokhttp3/internal/http/CallServerInterceptor;->forWebSocket:Z
- if-eqz v3, :cond_4
- const/16 v3, 0x65
- if-ne p1, v3, :cond_4
- invoke-virtual {v2}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder;
- move-result-object v0
- sget-object v2, Lokhttp3/internal/Util;->EMPTY_RESPONSE:Lokhttp3/ResponseBody;
- invoke-virtual {v0, v2}, Lokhttp3/Response$Builder;->body(Lokhttp3/ResponseBody;)Lokhttp3/Response$Builder;
- move-result-object v0
- goto :goto_1
- :cond_4
- invoke-virtual {v2}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder;
- move-result-object v3
- invoke-interface {v0, v2}, Lokhttp3/internal/http/HttpCodec;->openResponseBody(Lokhttp3/Response;)Lokhttp3/ResponseBody;
- move-result-object v0
- invoke-virtual {v3, v0}, Lokhttp3/Response$Builder;->body(Lokhttp3/ResponseBody;)Lokhttp3/Response$Builder;
- move-result-object v0
- :goto_1
- invoke-virtual {v0}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
- move-result-object v0
- 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
- const-string v4, "close"
- invoke-virtual {v4, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
- move-result v2
- if-nez v2, :cond_5
- invoke-virtual {v0, v3}, Lokhttp3/Response;->header(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v2
- invoke-virtual {v4, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
- move-result v2
- if-eqz v2, :cond_6
- :cond_5
- invoke-virtual {v1}, Lokhttp3/internal/connection/StreamAllocation;->noNewStreams()V
- :cond_6
- const/16 v1, 0xcc
- if-eq p1, v1, :cond_7
- const/16 v1, 0xcd
- if-ne p1, v1, :cond_8
- :cond_7
- invoke-virtual {v0}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
- move-result-object v1
- invoke-virtual {v1}, Lokhttp3/ResponseBody;->contentLength()J
- move-result-wide v1
- const-wide/16 v3, 0x0
- cmp-long v5, v1, v3
- if-gtz v5, :cond_9
- :cond_8
- return-object v0
- :cond_9
- new-instance v1, Ljava/net/ProtocolException;
- new-instance v2, Ljava/lang/StringBuilder;
- invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
- const-string v3, "HTTP "
- invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
- const-string p1, " had non-zero Content-Length: "
- invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v0}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
- move-result-object p1
- invoke-virtual {p1}, Lokhttp3/ResponseBody;->contentLength()J
- move-result-wide v3
- invoke-virtual {v2, v3, v4}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
- invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p1
- invoke-direct {v1, p1}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
- throw v1
- .end method
|