123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361 |
- .class public final Lokhttp3/internal/http/BridgeInterceptor;
- .super Ljava/lang/Object;
- .source ""
- # interfaces
- .implements Lokhttp3/Interceptor;
- # instance fields
- .field private final cookieJar:Lokhttp3/CookieJar;
- # direct methods
- .method public constructor <init>(Lokhttp3/CookieJar;)V
- .locals 0
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- iput-object p1, p0, Lokhttp3/internal/http/BridgeInterceptor;->cookieJar:Lokhttp3/CookieJar;
- return-void
- .end method
- .method private cookieHeader(Ljava/util/List;)Ljava/lang/String;
- .locals 5
- .annotation system Ldalvik/annotation/Signature;
- value = {
- "(",
- "Ljava/util/List<",
- "Lokhttp3/Cookie;",
- ">;)",
- "Ljava/lang/String;"
- }
- .end annotation
- new-instance v0, Ljava/lang/StringBuilder;
- invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
- invoke-interface {p1}, Ljava/util/List;->size()I
- move-result v1
- const/4 v2, 0x0
- :goto_0
- if-ge v2, v1, :cond_1
- if-lez v2, :cond_0
- const-string v3, "; "
- invoke-virtual {v0, v3}, 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 v3
- check-cast v3, Lokhttp3/Cookie;
- invoke-virtual {v3}, Lokhttp3/Cookie;->name()Ljava/lang/String;
- move-result-object v4
- invoke-virtual {v0, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- const/16 v4, 0x3d
- invoke-virtual {v0, v4}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
- invoke-virtual {v3}, Lokhttp3/Cookie;->value()Ljava/lang/String;
- move-result-object v3
- invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- add-int/lit8 v2, v2, 0x1
- goto :goto_0
- :cond_1
- invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p1
- return-object p1
- .end method
- # virtual methods
- .method public intercept(Lokhttp3/Interceptor$Chain;)Lokhttp3/Response;
- .locals 10
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- invoke-interface {p1}, Lokhttp3/Interceptor$Chain;->request()Lokhttp3/Request;
- move-result-object v0
- invoke-virtual {v0}, Lokhttp3/Request;->newBuilder()Lokhttp3/Request$Builder;
- move-result-object v1
- invoke-virtual {v0}, Lokhttp3/Request;->body()Lokhttp3/RequestBody;
- move-result-object v2
- const-string v3, "Content-Type"
- const-wide/16 v4, -0x1
- const-string v6, "Content-Length"
- if-eqz v2, :cond_2
- invoke-virtual {v2}, Lokhttp3/RequestBody;->contentType()Lokhttp3/MediaType;
- move-result-object v7
- if-eqz v7, :cond_0
- invoke-virtual {v7}, Lokhttp3/MediaType;->toString()Ljava/lang/String;
- move-result-object v7
- invoke-virtual {v1, v3, v7}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
- :cond_0
- invoke-virtual {v2}, Lokhttp3/RequestBody;->contentLength()J
- move-result-wide v7
- const-string v2, "Transfer-Encoding"
- cmp-long v9, v7, v4
- if-eqz v9, :cond_1
- invoke-static {v7, v8}, Ljava/lang/Long;->toString(J)Ljava/lang/String;
- move-result-object v7
- invoke-virtual {v1, v6, v7}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
- invoke-virtual {v1, v2}, Lokhttp3/Request$Builder;->removeHeader(Ljava/lang/String;)Lokhttp3/Request$Builder;
- goto :goto_0
- :cond_1
- const-string v7, "chunked"
- invoke-virtual {v1, v2, v7}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
- invoke-virtual {v1, v6}, Lokhttp3/Request$Builder;->removeHeader(Ljava/lang/String;)Lokhttp3/Request$Builder;
- :cond_2
- :goto_0
- const-string v2, "Host"
- invoke-virtual {v0, v2}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v7
- const/4 v8, 0x0
- if-nez v7, :cond_3
- invoke-virtual {v0}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
- move-result-object v7
- invoke-static {v7, v8}, Lokhttp3/internal/Util;->hostHeader(Lokhttp3/HttpUrl;Z)Ljava/lang/String;
- move-result-object v7
- invoke-virtual {v1, v2, v7}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
- :cond_3
- const-string v2, "Connection"
- invoke-virtual {v0, v2}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v7
- if-nez v7, :cond_4
- const-string v7, "Keep-Alive"
- invoke-virtual {v1, v2, v7}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
- :cond_4
- const-string v2, "Accept-Encoding"
- invoke-virtual {v0, v2}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v7
- const-string v9, "gzip"
- if-nez v7, :cond_5
- const-string v7, "Range"
- invoke-virtual {v0, v7}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v7
- if-nez v7, :cond_5
- const/4 v8, 0x1
- invoke-virtual {v1, v2, v9}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
- :cond_5
- iget-object v2, p0, Lokhttp3/internal/http/BridgeInterceptor;->cookieJar:Lokhttp3/CookieJar;
- invoke-virtual {v0}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
- move-result-object v7
- invoke-interface {v2, v7}, Lokhttp3/CookieJar;->loadForRequest(Lokhttp3/HttpUrl;)Ljava/util/List;
- move-result-object v2
- invoke-interface {v2}, Ljava/util/List;->isEmpty()Z
- move-result v7
- if-nez v7, :cond_6
- invoke-direct {p0, v2}, Lokhttp3/internal/http/BridgeInterceptor;->cookieHeader(Ljava/util/List;)Ljava/lang/String;
- move-result-object v2
- const-string v7, "Cookie"
- invoke-virtual {v1, v7, v2}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
- :cond_6
- const-string v2, "User-Agent"
- invoke-virtual {v0, v2}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v7
- if-nez v7, :cond_7
- invoke-static {}, Lokhttp3/internal/Version;->userAgent()Ljava/lang/String;
- move-result-object v7
- invoke-virtual {v1, v2, v7}, Lokhttp3/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Request$Builder;
- :cond_7
- invoke-virtual {v1}, Lokhttp3/Request$Builder;->build()Lokhttp3/Request;
- move-result-object v1
- invoke-interface {p1, v1}, Lokhttp3/Interceptor$Chain;->proceed(Lokhttp3/Request;)Lokhttp3/Response;
- move-result-object p1
- iget-object v1, p0, Lokhttp3/internal/http/BridgeInterceptor;->cookieJar:Lokhttp3/CookieJar;
- invoke-virtual {v0}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
- move-result-object v2
- invoke-virtual {p1}, Lokhttp3/Response;->headers()Lokhttp3/Headers;
- move-result-object v7
- invoke-static {v1, v2, v7}, Lokhttp3/internal/http/HttpHeaders;->receiveHeaders(Lokhttp3/CookieJar;Lokhttp3/HttpUrl;Lokhttp3/Headers;)V
- invoke-virtual {p1}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder;
- move-result-object v1
- invoke-virtual {v1, v0}, Lokhttp3/Response$Builder;->request(Lokhttp3/Request;)Lokhttp3/Response$Builder;
- move-result-object v0
- if-eqz v8, :cond_8
- const-string v1, "Content-Encoding"
- invoke-virtual {p1, v1}, Lokhttp3/Response;->header(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v2
- invoke-virtual {v9, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
- move-result v2
- if-eqz v2, :cond_8
- invoke-static {p1}, Lokhttp3/internal/http/HttpHeaders;->hasBody(Lokhttp3/Response;)Z
- move-result v2
- if-eqz v2, :cond_8
- new-instance v2, Lokio/GzipSource;
- invoke-virtual {p1}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
- move-result-object v7
- invoke-virtual {v7}, Lokhttp3/ResponseBody;->source()Lokio/BufferedSource;
- move-result-object v7
- invoke-direct {v2, v7}, Lokio/GzipSource;-><init>(Lokio/Source;)V
- invoke-virtual {p1}, Lokhttp3/Response;->headers()Lokhttp3/Headers;
- move-result-object v7
- invoke-virtual {v7}, Lokhttp3/Headers;->newBuilder()Lokhttp3/Headers$Builder;
- move-result-object v7
- invoke-virtual {v7, v1}, Lokhttp3/Headers$Builder;->removeAll(Ljava/lang/String;)Lokhttp3/Headers$Builder;
- move-result-object v1
- invoke-virtual {v1, v6}, Lokhttp3/Headers$Builder;->removeAll(Ljava/lang/String;)Lokhttp3/Headers$Builder;
- move-result-object v1
- invoke-virtual {v1}, Lokhttp3/Headers$Builder;->build()Lokhttp3/Headers;
- move-result-object v1
- invoke-virtual {v0, v1}, Lokhttp3/Response$Builder;->headers(Lokhttp3/Headers;)Lokhttp3/Response$Builder;
- invoke-virtual {p1, v3}, Lokhttp3/Response;->header(Ljava/lang/String;)Ljava/lang/String;
- move-result-object p1
- new-instance v1, Lokhttp3/internal/http/RealResponseBody;
- invoke-static {v2}, Lokio/Okio;->buffer(Lokio/Source;)Lokio/BufferedSource;
- move-result-object v2
- invoke-direct {v1, p1, v4, v5, v2}, Lokhttp3/internal/http/RealResponseBody;-><init>(Ljava/lang/String;JLokio/BufferedSource;)V
- invoke-virtual {v0, v1}, Lokhttp3/Response$Builder;->body(Lokhttp3/ResponseBody;)Lokhttp3/Response$Builder;
- :cond_8
- invoke-virtual {v0}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
- move-result-object p1
- return-object p1
- .end method
|