.class public final Lokhttp3/internal/http2/Http2ExchangeCodec; .super Ljava/lang/Object; .source "SourceFile" # interfaces .implements Lokhttp3/internal/http/ExchangeCodec; # static fields .field public static final HTTP_2_SKIPPED_REQUEST_HEADERS:Ljava/util/List; .field public static final HTTP_2_SKIPPED_RESPONSE_HEADERS:Ljava/util/List; # instance fields .field public volatile canceled:Z .field public final chain:Lokhttp3/Interceptor$Chain; .field public final connection:Lokhttp3/internal/http2/Http2Connection; .field public final protocol:Lokhttp3/Protocol; .field public final realConnection:Lokhttp3/internal/connection/RealConnection; .field public volatile stream:Lokhttp3/internal/http2/Http2Stream; # direct methods .method static constructor ()V .locals 12 const-string v0, "connection" const-string v1, "host" const-string v2, "keep-alive" const-string v3, "proxy-connection" const-string v4, "te" const-string v5, "transfer-encoding" const-string v6, "encoding" const-string v7, "upgrade" const-string v8, ":method" const-string v9, ":path" const-string v10, ":scheme" const-string v11, ":authority" filled-new-array/range {v0 .. v11}, [Ljava/lang/String; move-result-object v0 .line 63 invoke-static {v0}, Lokhttp3/internal/Util;->immutableList([Ljava/lang/Object;)Ljava/util/List; move-result-object v0 sput-object v0, Lokhttp3/internal/http2/Http2ExchangeCodec;->HTTP_2_SKIPPED_REQUEST_HEADERS:Ljava/util/List; const-string v1, "connection" const-string v2, "host" const-string v3, "keep-alive" const-string v4, "proxy-connection" const-string v5, "te" const-string v6, "transfer-encoding" const-string v7, "encoding" const-string v8, "upgrade" filled-new-array/range {v1 .. v8}, [Ljava/lang/String; move-result-object v0 .line 76 invoke-static {v0}, Lokhttp3/internal/Util;->immutableList([Ljava/lang/Object;)Ljava/util/List; move-result-object v0 sput-object v0, Lokhttp3/internal/http2/Http2ExchangeCodec;->HTTP_2_SKIPPED_RESPONSE_HEADERS:Ljava/util/List; return-void .end method .method public constructor (Lokhttp3/OkHttpClient;Lokhttp3/internal/connection/RealConnection;Lokhttp3/Interceptor$Chain;Lokhttp3/internal/http2/Http2Connection;)V .locals 0 .line 94 invoke-direct {p0}, Ljava/lang/Object;->()V iput-object p2, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->realConnection:Lokhttp3/internal/connection/RealConnection; iput-object p3, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->chain:Lokhttp3/Interceptor$Chain; iput-object p4, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->connection:Lokhttp3/internal/http2/Http2Connection; .line 98 invoke-virtual {p1}, Lokhttp3/OkHttpClient;->protocols()Ljava/util/List; move-result-object p1 sget-object p2, Lokhttp3/Protocol;->H2_PRIOR_KNOWLEDGE:Lokhttp3/Protocol; invoke-interface {p1, p2}, Ljava/util/List;->contains(Ljava/lang/Object;)Z move-result p1 if-eqz p1, :cond_0 goto :goto_0 .line 100 :cond_0 sget-object p2, Lokhttp3/Protocol;->HTTP_2:Lokhttp3/Protocol; :goto_0 iput-object p2, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->protocol:Lokhttp3/Protocol; return-void .end method .method public static http2HeadersList(Lokhttp3/Request;)Ljava/util/List; .locals 6 .line 145 invoke-virtual {p0}, Lokhttp3/Request;->headers()Lokhttp3/Headers; move-result-object v0 .line 146 new-instance v1, Ljava/util/ArrayList; invoke-virtual {v0}, Lokhttp3/Headers;->size()I move-result v2 add-int/lit8 v2, v2, 0x4 invoke-direct {v1, v2}, Ljava/util/ArrayList;->(I)V .line 147 new-instance v2, Lokhttp3/internal/http2/Header; sget-object v3, Lokhttp3/internal/http2/Header;->TARGET_METHOD:Lokio/ByteString; invoke-virtual {p0}, Lokhttp3/Request;->method()Ljava/lang/String; move-result-object v4 invoke-direct {v2, v3, v4}, Lokhttp3/internal/http2/Header;->(Lokio/ByteString;Ljava/lang/String;)V invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z .line 148 new-instance v2, Lokhttp3/internal/http2/Header; sget-object v3, Lokhttp3/internal/http2/Header;->TARGET_PATH:Lokio/ByteString; invoke-virtual {p0}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl; move-result-object v4 invoke-static {v4}, Lokhttp3/internal/http/RequestLine;->requestPath(Lokhttp3/HttpUrl;)Ljava/lang/String; move-result-object v4 invoke-direct {v2, v3, v4}, Lokhttp3/internal/http2/Header;->(Lokio/ByteString;Ljava/lang/String;)V invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z const-string v2, "Host" .line 149 invoke-virtual {p0, v2}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String; move-result-object v2 if-eqz v2, :cond_0 .line 151 new-instance v3, Lokhttp3/internal/http2/Header; sget-object v4, Lokhttp3/internal/http2/Header;->TARGET_AUTHORITY:Lokio/ByteString; invoke-direct {v3, v4, v2}, Lokhttp3/internal/http2/Header;->(Lokio/ByteString;Ljava/lang/String;)V invoke-interface {v1, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z .line 153 :cond_0 new-instance v2, Lokhttp3/internal/http2/Header; sget-object v3, Lokhttp3/internal/http2/Header;->TARGET_SCHEME:Lokio/ByteString; invoke-virtual {p0}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl; move-result-object p0 invoke-virtual {p0}, Lokhttp3/HttpUrl;->scheme()Ljava/lang/String; move-result-object p0 invoke-direct {v2, v3, p0}, Lokhttp3/internal/http2/Header;->(Lokio/ByteString;Ljava/lang/String;)V invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z .line 155 invoke-virtual {v0}, Lokhttp3/Headers;->size()I move-result p0 const/4 v2, 0x0 :goto_0 if-ge v2, p0, :cond_3 .line 157 invoke-virtual {v0, v2}, Lokhttp3/Headers;->name(I)Ljava/lang/String; move-result-object v3 sget-object v4, Ljava/util/Locale;->US:Ljava/util/Locale; invoke-virtual {v3, v4}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String; move-result-object v3 sget-object v4, Lokhttp3/internal/http2/Http2ExchangeCodec;->HTTP_2_SKIPPED_REQUEST_HEADERS:Ljava/util/List; .line 158 invoke-interface {v4, v3}, Ljava/util/List;->contains(Ljava/lang/Object;)Z move-result v4 if-eqz v4, :cond_1 const-string v4, "te" .line 159 invoke-virtual {v3, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v4 if-eqz v4, :cond_2 invoke-virtual {v0, v2}, Lokhttp3/Headers;->value(I)Ljava/lang/String; move-result-object v4 const-string v5, "trailers" invoke-virtual {v4, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v4 if-eqz v4, :cond_2 .line 160 :cond_1 new-instance v4, Lokhttp3/internal/http2/Header; invoke-virtual {v0, v2}, Lokhttp3/Headers;->value(I)Ljava/lang/String; move-result-object v5 invoke-direct {v4, v3, v5}, Lokhttp3/internal/http2/Header;->(Ljava/lang/String;Ljava/lang/String;)V invoke-interface {v1, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z :cond_2 add-int/lit8 v2, v2, 0x1 goto :goto_0 :cond_3 return-object v1 .end method .method public static readHttp2HeadersList(Lokhttp3/Headers;Lokhttp3/Protocol;)Lokhttp3/Response$Builder; .locals 7 .line 170 new-instance v0, Lokhttp3/Headers$Builder; invoke-direct {v0}, Lokhttp3/Headers$Builder;->()V .line 171 invoke-virtual {p0}, Lokhttp3/Headers;->size()I move-result v1 const/4 v2, 0x0 const/4 v3, 0x0 :goto_0 if-ge v3, v1, :cond_2 .line 172 invoke-virtual {p0, v3}, Lokhttp3/Headers;->name(I)Ljava/lang/String; move-result-object v4 .line 173 invoke-virtual {p0, v3}, Lokhttp3/Headers;->value(I)Ljava/lang/String; move-result-object v5 const-string v6, ":status" .line 174 invoke-virtual {v4, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v6 if-eqz v6, :cond_0 .line 175 new-instance v2, Ljava/lang/StringBuilder; invoke-direct {v2}, Ljava/lang/StringBuilder;->()V const-string v4, "HTTP/1.1 " invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; invoke-virtual {v2, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v2 invoke-static {v2}, Lokhttp3/internal/http/StatusLine;->parse(Ljava/lang/String;)Lokhttp3/internal/http/StatusLine; move-result-object v2 goto :goto_1 :cond_0 sget-object v6, Lokhttp3/internal/http2/Http2ExchangeCodec;->HTTP_2_SKIPPED_RESPONSE_HEADERS:Ljava/util/List; .line 176 invoke-interface {v6, v4}, Ljava/util/List;->contains(Ljava/lang/Object;)Z move-result v6 if-nez v6, :cond_1 sget-object v6, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal; .line 177 invoke-virtual {v6, v0, v4, v5}, Lokhttp3/internal/Internal;->addLenient(Lokhttp3/Headers$Builder;Ljava/lang/String;Ljava/lang/String;)V :cond_1 :goto_1 add-int/lit8 v3, v3, 0x1 goto :goto_0 :cond_2 if-eqz v2, :cond_3 .line 182 new-instance p0, Lokhttp3/Response$Builder; invoke-direct {p0}, Lokhttp3/Response$Builder;->()V .line 183 invoke-virtual {p0, p1}, Lokhttp3/Response$Builder;->protocol(Lokhttp3/Protocol;)Lokhttp3/Response$Builder; move-result-object p0 iget p1, v2, Lokhttp3/internal/http/StatusLine;->code:I .line 184 invoke-virtual {p0, p1}, Lokhttp3/Response$Builder;->code(I)Lokhttp3/Response$Builder; move-result-object p0 iget-object p1, v2, Lokhttp3/internal/http/StatusLine;->message:Ljava/lang/String; .line 185 invoke-virtual {p0, p1}, Lokhttp3/Response$Builder;->message(Ljava/lang/String;)Lokhttp3/Response$Builder; move-result-object p0 .line 186 invoke-virtual {v0}, Lokhttp3/Headers$Builder;->build()Lokhttp3/Headers; move-result-object p1 invoke-virtual {p0, p1}, Lokhttp3/Response$Builder;->headers(Lokhttp3/Headers;)Lokhttp3/Response$Builder; move-result-object p0 return-object p0 .line 180 :cond_3 new-instance p0, Ljava/net/ProtocolException; const-string p1, "Expected \':status\' header not present" invoke-direct {p0, p1}, Ljava/net/ProtocolException;->(Ljava/lang/String;)V throw p0 .end method # virtual methods .method public cancel()V .locals 2 const/4 v0, 0x1 iput-boolean v0, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->canceled:Z iget-object v0, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->stream:Lokhttp3/internal/http2/Http2Stream; if-eqz v0, :cond_0 iget-object v0, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->stream:Lokhttp3/internal/http2/Http2Stream; .line 203 sget-object v1, Lokhttp3/internal/http2/ErrorCode;->CANCEL:Lokhttp3/internal/http2/ErrorCode; invoke-virtual {v0, v1}, Lokhttp3/internal/http2/Http2Stream;->closeLater(Lokhttp3/internal/http2/ErrorCode;)V :cond_0 return-void .end method .method public connection()Lokhttp3/internal/connection/RealConnection; .locals 1 iget-object v0, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->realConnection:Lokhttp3/internal/connection/RealConnection; return-object v0 .end method .method public createRequestBody(Lokhttp3/Request;J)Lokio/Sink; .locals 0 iget-object p1, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->stream:Lokhttp3/internal/http2/Http2Stream; .line 108 invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Stream;->getSink()Lokio/Sink; move-result-object p1 return-object p1 .end method .method public finishRequest()V .locals 1 iget-object v0, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->stream:Lokhttp3/internal/http2/Http2Stream; .line 132 invoke-virtual {v0}, Lokhttp3/internal/http2/Http2Stream;->getSink()Lokio/Sink; move-result-object v0 invoke-interface {v0}, Lokio/Sink;->close()V return-void .end method .method public flushRequest()V .locals 1 iget-object v0, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->connection:Lokhttp3/internal/http2/Http2Connection; .line 128 invoke-virtual {v0}, Lokhttp3/internal/http2/Http2Connection;->flush()V return-void .end method .method public openResponseBodySource(Lokhttp3/Response;)Lokio/Source; .locals 0 iget-object p1, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->stream:Lokhttp3/internal/http2/Http2Stream; .line 194 invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Stream;->getSource()Lokio/Source; move-result-object p1 return-object p1 .end method .method public readResponseHeaders(Z)Lokhttp3/Response$Builder; .locals 2 iget-object v0, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->stream:Lokhttp3/internal/http2/Http2Stream; .line 136 invoke-virtual {v0}, Lokhttp3/internal/http2/Http2Stream;->takeHeaders()Lokhttp3/Headers; move-result-object v0 iget-object v1, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->protocol:Lokhttp3/Protocol; .line 137 invoke-static {v0, v1}, Lokhttp3/internal/http2/Http2ExchangeCodec;->readHttp2HeadersList(Lokhttp3/Headers;Lokhttp3/Protocol;)Lokhttp3/Response$Builder; move-result-object v0 if-eqz p1, :cond_0 sget-object p1, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal; .line 138 invoke-virtual {p1, v0}, Lokhttp3/internal/Internal;->code(Lokhttp3/Response$Builder;)I move-result p1 const/16 v1, 0x64 if-ne p1, v1, :cond_0 const/4 p1, 0x0 return-object p1 :cond_0 return-object v0 .end method .method public reportedContentLength(Lokhttp3/Response;)J .locals 2 .line 190 invoke-static {p1}, Lokhttp3/internal/http/HttpHeaders;->contentLength(Lokhttp3/Response;)J move-result-wide v0 return-wide v0 .end method .method public writeRequestHeaders(Lokhttp3/Request;)V .locals 3 iget-object v0, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->stream:Lokhttp3/internal/http2/Http2Stream; if-eqz v0, :cond_0 return-void .line 114 :cond_0 invoke-virtual {p1}, Lokhttp3/Request;->body()Lokhttp3/RequestBody; move-result-object v0 if-eqz v0, :cond_1 const/4 v0, 0x1 goto :goto_0 :cond_1 const/4 v0, 0x0 .line 115 :goto_0 invoke-static {p1}, Lokhttp3/internal/http2/Http2ExchangeCodec;->http2HeadersList(Lokhttp3/Request;)Ljava/util/List; move-result-object p1 iget-object v1, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->connection:Lokhttp3/internal/http2/Http2Connection; .line 116 invoke-virtual {v1, p1, v0}, Lokhttp3/internal/http2/Http2Connection;->newStream(Ljava/util/List;Z)Lokhttp3/internal/http2/Http2Stream; move-result-object p1 iput-object p1, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->stream:Lokhttp3/internal/http2/Http2Stream; iget-boolean p1, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->canceled:Z if-nez p1, :cond_2 iget-object p1, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->stream:Lokhttp3/internal/http2/Http2Stream; .line 123 invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Stream;->readTimeout()Lokio/Timeout; move-result-object p1 iget-object v0, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->chain:Lokhttp3/Interceptor$Chain; invoke-interface {v0}, Lokhttp3/Interceptor$Chain;->readTimeoutMillis()I move-result v0 int-to-long v0, v0 sget-object v2, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit; invoke-virtual {p1, v0, v1, v2}, Lokio/Timeout;->timeout(JLjava/util/concurrent/TimeUnit;)Lokio/Timeout; iget-object p1, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->stream:Lokhttp3/internal/http2/Http2Stream; .line 124 invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Stream;->writeTimeout()Lokio/Timeout; move-result-object p1 iget-object v0, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->chain:Lokhttp3/Interceptor$Chain; invoke-interface {v0}, Lokhttp3/Interceptor$Chain;->writeTimeoutMillis()I move-result v0 int-to-long v0, v0 invoke-virtual {p1, v0, v1, v2}, Lokio/Timeout;->timeout(JLjava/util/concurrent/TimeUnit;)Lokio/Timeout; return-void :cond_2 iget-object p1, p0, Lokhttp3/internal/http2/Http2ExchangeCodec;->stream:Lokhttp3/internal/http2/Http2Stream; .line 120 sget-object v0, Lokhttp3/internal/http2/ErrorCode;->CANCEL:Lokhttp3/internal/http2/ErrorCode; invoke-virtual {p1, v0}, Lokhttp3/internal/http2/Http2Stream;->closeLater(Lokhttp3/internal/http2/ErrorCode;)V .line 121 new-instance p1, Ljava/io/IOException; const-string v0, "Canceled" invoke-direct {p1, v0}, Ljava/io/IOException;->(Ljava/lang/String;)V throw p1 .end method