c.smali

.class public final Lokhttp3/internal/http2/c;
.super Ljava/lang/Object;
.source "Http2Codec.java"

# interfaces
.implements Lokhttp3/internal/http/HttpCodec;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lokhttp3/internal/http2/c$a;
    }
.end annotation


# static fields
.field private static final a:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field

.field private static final b:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field


# instance fields
.field private final c:Lokhttp3/Interceptor$Chain;

.field final d:Lokhttp3/internal/connection/g;

.field private final e:Lokhttp3/internal/http2/k;

.field private f:Lokhttp3/internal/http2/p;

.field private final g:Lokhttp3/Protocol;


# direct methods
.method static constructor <clinit>()V
    .registers 18

    const/16 v0, 0xc

    .line 1
    new-array v0, v0, [Ljava/lang/String;

    const-string v1, "connection"

    const/4 v2, 0x0

    aput-object v1, v0, v2

    const-string v3, "host"

    const/4 v4, 0x1

    aput-object v3, v0, v4

    const-string v5, "keep-alive"

    const/4 v6, 0x2

    aput-object v5, v0, v6

    const-string v7, "proxy-connection"

    const/4 v8, 0x3

    aput-object v7, v0, v8

    const-string v9, "te"

    const/4 v10, 0x4

    aput-object v9, v0, v10

    const-string v11, "transfer-encoding"

    const/4 v12, 0x5

    aput-object v11, v0, v12

    const-string v13, "encoding"

    const/4 v14, 0x6

    aput-object v13, v0, v14

    const/4 v15, 0x7

    const-string v16, "upgrade"

    aput-object v16, v0, v15

    const/16 v16, 0x8

    const-string v17, ":method"

    aput-object v17, v0, v16

    const/16 v16, 0x9

    const-string v17, ":path"

    aput-object v17, v0, v16

    const/16 v16, 0xa

    const-string v17, ":scheme"

    aput-object v17, v0, v16

    const/16 v16, 0xb

    const-string v17, ":authority"

    aput-object v17, v0, v16

    invoke-static {v0}, Lokhttp3/a/e;->a([Ljava/lang/Object;)Ljava/util/List;

    move-result-object v0

    sput-object v0, Lokhttp3/internal/http2/c;->a:Ljava/util/List;

    const/16 v0, 0x8

    .line 2
    new-array v0, v0, [Ljava/lang/String;

    aput-object v1, v0, v2

    aput-object v3, v0, v4

    aput-object v5, v0, v6

    aput-object v7, v0, v8

    aput-object v9, v0, v10

    aput-object v11, v0, v12

    aput-object v13, v0, v14

    const-string v1, "upgrade"

    aput-object v1, v0, v15

    invoke-static {v0}, Lokhttp3/a/e;->a([Ljava/lang/Object;)Ljava/util/List;

    move-result-object v0

    sput-object v0, Lokhttp3/internal/http2/c;->b:Ljava/util/List;

    return-void
.end method

.method public constructor <init>(Lokhttp3/z;Lokhttp3/Interceptor$Chain;Lokhttp3/internal/connection/g;Lokhttp3/internal/http2/k;)V
    .registers 5

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    iput-object p2, p0, Lokhttp3/internal/http2/c;->c:Lokhttp3/Interceptor$Chain;

    .line 3
    iput-object p3, p0, Lokhttp3/internal/http2/c;->d:Lokhttp3/internal/connection/g;

    .line 4
    iput-object p4, p0, Lokhttp3/internal/http2/c;->e:Lokhttp3/internal/http2/k;

    .line 5
    invoke-virtual {p1}, Lokhttp3/z;->t()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_18

    .line 6
    sget-object p1, Lokhttp3/Protocol;->H2_PRIOR_KNOWLEDGE:Lokhttp3/Protocol;

    goto :goto_1a

    .line 7
    :cond_18
    sget-object p1, Lokhttp3/Protocol;->HTTP_2:Lokhttp3/Protocol;

    :goto_1a
    iput-object p1, p0, Lokhttp3/internal/http2/c;->g:Lokhttp3/Protocol;

    return-void
.end method

.method public static a(Lokhttp3/C;)Ljava/util/List;
    .registers 7
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lokhttp3/C;",
            ")",
            "Ljava/util/List<",
            "Lokhttp3/internal/http2/Header;",
            ">;"
        }
    .end annotation

    .line 1
    invoke-virtual {p0}, Lokhttp3/C;->c()Lokhttp3/u;

    move-result-object v0

    .line 2
    new-instance v1, Ljava/util/ArrayList;

    invoke-virtual {v0}, Lokhttp3/u;->b()I

    move-result v2

    add-int/lit8 v2, v2, 0x4

    invoke-direct {v1, v2}, Ljava/util/ArrayList;-><init>(I)V

    .line 3
    new-instance v2, Lokhttp3/internal/http2/Header;

    sget-object v3, Lokhttp3/internal/http2/Header;->c:Lokio/ByteString;

    invoke-virtual {p0}, Lokhttp3/C;->e()Ljava/lang/String;

    move-result-object v4

    invoke-direct {v2, v3, v4}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Ljava/lang/String;)V

    invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 4
    new-instance v2, Lokhttp3/internal/http2/Header;

    sget-object v3, Lokhttp3/internal/http2/Header;->d:Lokio/ByteString;

    invoke-virtual {p0}, Lokhttp3/C;->g()Lokhttp3/v;

    move-result-object v4

    invoke-static {v4}, Lokhttp3/internal/http/i;->a(Lokhttp3/v;)Ljava/lang/String;

    move-result-object v4

    invoke-direct {v2, v3, v4}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Ljava/lang/String;)V

    invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    const-string v2, "Host"

    .line 5
    invoke-virtual {p0, v2}, Lokhttp3/C;->a(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    if-eqz v2, :cond_41

    .line 6
    new-instance v3, Lokhttp3/internal/http2/Header;

    sget-object v4, Lokhttp3/internal/http2/Header;->f:Lokio/ByteString;

    invoke-direct {v3, v4, v2}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Ljava/lang/String;)V

    invoke-interface {v1, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 7
    :cond_41
    new-instance v2, Lokhttp3/internal/http2/Header;

    sget-object v3, Lokhttp3/internal/http2/Header;->e:Lokio/ByteString;

    invoke-virtual {p0}, Lokhttp3/C;->g()Lokhttp3/v;

    move-result-object p0

    invoke-virtual {p0}, Lokhttp3/v;->o()Ljava/lang/String;

    move-result-object p0

    invoke-direct {v2, v3, p0}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Ljava/lang/String;)V

    invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    const/4 p0, 0x0

    .line 8
    invoke-virtual {v0}, Lokhttp3/u;->b()I

    move-result v2

    :goto_58
    if-ge p0, v2, :cond_83

    .line 9
    invoke-virtual {v0, p0}, Lokhttp3/u;->a(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

    invoke-static {v3}, Lokio/ByteString;->encodeUtf8(Ljava/lang/String;)Lokio/ByteString;

    move-result-object v3

    .line 10
    sget-object v4, Lokhttp3/internal/http2/c;->a:Ljava/util/List;

    invoke-virtual {v3}, Lokio/ByteString;->utf8()Ljava/lang/String;

    move-result-object v5

    invoke-interface {v4, v5}, Ljava/util/List;->contains(Ljava/lang/Object;)Z

    move-result v4

    if-nez v4, :cond_80

    .line 11
    new-instance v4, Lokhttp3/internal/http2/Header;

    invoke-virtual {v0, p0}, Lokhttp3/u;->b(I)Ljava/lang/String;

    move-result-object v5

    invoke-direct {v4, v3, v5}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Ljava/lang/String;)V

    invoke-interface {v1, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    :cond_80
    add-int/lit8 p0, p0, 0x1

    goto :goto_58

    :cond_83
    return-object v1
.end method

.method public static a(Lokhttp3/u;Lokhttp3/Protocol;)Lokhttp3/H$a;
    .registers 9
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 12
    new-instance v0, Lokhttp3/u$a;

    invoke-direct {v0}, Lokhttp3/u$a;-><init>()V

    .line 13
    invoke-virtual {p0}, Lokhttp3/u;->b()I

    move-result v1

    const/4 v2, 0x0

    const/4 v3, 0x0

    :goto_b
    if-ge v3, v1, :cond_43

    .line 14
    invoke-virtual {p0, v3}, Lokhttp3/u;->a(I)Ljava/lang/String;

    move-result-object v4

    .line 15
    invoke-virtual {p0, v3}, Lokhttp3/u;->b(I)Ljava/lang/String;

    move-result-object v5

    const-string v6, ":status"

    .line 16
    invoke-virtual {v4, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-eqz v6, :cond_33

    .line 17
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()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/k;->a(Ljava/lang/String;)Lokhttp3/internal/http/k;

    move-result-object v2

    goto :goto_40

    .line 18
    :cond_33
    sget-object v6, Lokhttp3/internal/http2/c;->b:Ljava/util/List;

    invoke-interface {v6, v4}, Ljava/util/List;->contains(Ljava/lang/Object;)Z

    move-result v6

    if-nez v6, :cond_40

    .line 19
    sget-object v6, Lokhttp3/a/a;->a:Lokhttp3/a/a;

    invoke-virtual {v6, v0, v4, v5}, Lokhttp3/a/a;->a(Lokhttp3/u$a;Ljava/lang/String;Ljava/lang/String;)V

    :cond_40
    :goto_40
    add-int/lit8 v3, v3, 0x1

    goto :goto_b

    :cond_43
    if-eqz v2, :cond_5f

    .line 20
    new-instance p0, Lokhttp3/H$a;

    invoke-direct {p0}, Lokhttp3/H$a;-><init>()V

    .line 21
    invoke-virtual {p0, p1}, Lokhttp3/H$a;->a(Lokhttp3/Protocol;)Lokhttp3/H$a;

    iget p1, v2, Lokhttp3/internal/http/k;->b:I

    .line 22
    invoke-virtual {p0, p1}, Lokhttp3/H$a;->a(I)Lokhttp3/H$a;

    iget-object p1, v2, Lokhttp3/internal/http/k;->c:Ljava/lang/String;

    .line 23
    invoke-virtual {p0, p1}, Lokhttp3/H$a;->a(Ljava/lang/String;)Lokhttp3/H$a;

    .line 24
    invoke-virtual {v0}, Lokhttp3/u$a;->a()Lokhttp3/u;

    move-result-object p1

    invoke-virtual {p0, p1}, Lokhttp3/H$a;->a(Lokhttp3/u;)Lokhttp3/H$a;

    return-object p0

    .line 25
    :cond_5f
    new-instance p0, Ljava/net/ProtocolException;

    const-string p1, "Expected \':status\' header not present"

    invoke-direct {p0, p1}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V

    goto :goto_68

    :goto_67
    throw p0

    :goto_68
    goto :goto_67
.end method


# virtual methods
.method public cancel()V
    .registers 3

    .line 1
    iget-object v0, p0, Lokhttp3/internal/http2/c;->f:Lokhttp3/internal/http2/p;

    if-eqz v0, :cond_9

    sget-object v1, Lokhttp3/internal/http2/ErrorCode;->CANCEL:Lokhttp3/internal/http2/ErrorCode;

    invoke-virtual {v0, v1}, Lokhttp3/internal/http2/p;->b(Lokhttp3/internal/http2/ErrorCode;)V

    :cond_9
    return-void
.end method

.method public createRequestBody(Lokhttp3/C;J)Lokio/Sink;
    .registers 4

    .line 1
    iget-object p1, p0, Lokhttp3/internal/http2/c;->f:Lokhttp3/internal/http2/p;

    invoke-virtual {p1}, Lokhttp3/internal/http2/p;->d()Lokio/Sink;

    move-result-object p1

    return-object p1
.end method

.method public finishRequest()V
    .registers 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Lokhttp3/internal/http2/c;->f:Lokhttp3/internal/http2/p;

    invoke-virtual {v0}, Lokhttp3/internal/http2/p;->d()Lokio/Sink;

    move-result-object v0

    invoke-interface {v0}, Lokio/Sink;->close()V

    return-void
.end method

.method public flushRequest()V
    .registers 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Lokhttp3/internal/http2/c;->e:Lokhttp3/internal/http2/k;

    invoke-virtual {v0}, Lokhttp3/internal/http2/k;->flush()V

    return-void
.end method

.method public openResponseBody(Lokhttp3/H;)Lokhttp3/J;
    .registers 6
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Lokhttp3/internal/http2/c;->d:Lokhttp3/internal/connection/g;

    iget-object v1, v0, Lokhttp3/internal/connection/g;->f:Lokhttp3/EventListener;

    iget-object v0, v0, Lokhttp3/internal/connection/g;->e:Lokhttp3/Call;

    invoke-virtual {v1, v0}, Lokhttp3/EventListener;->e(Lokhttp3/Call;)V

    const-string v0, "Content-Type"

    .line 2
    invoke-virtual {p1, v0}, Lokhttp3/H;->a(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    .line 3
    invoke-static {p1}, Lokhttp3/internal/http/e;->a(Lokhttp3/H;)J

    move-result-wide v1

    .line 4
    new-instance p1, Lokhttp3/internal/http2/c$a;

    iget-object v3, p0, Lokhttp3/internal/http2/c;->f:Lokhttp3/internal/http2/p;

    invoke-virtual {v3}, Lokhttp3/internal/http2/p;->e()Lokio/Source;

    move-result-object v3

    invoke-direct {p1, p0, v3}, Lokhttp3/internal/http2/c$a;-><init>(Lokhttp3/internal/http2/c;Lokio/Source;)V

    .line 5
    new-instance v3, Lokhttp3/internal/http/h;

    invoke-static {p1}, Lokio/Okio;->buffer(Lokio/Source;)Lokio/BufferedSource;

    move-result-object p1

    invoke-direct {v3, v0, v1, v2, p1}, Lokhttp3/internal/http/h;-><init>(Ljava/lang/String;JLokio/BufferedSource;)V

    return-object v3
.end method

.method public readResponseHeaders(Z)Lokhttp3/H$a;
    .registers 4
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Lokhttp3/internal/http2/c;->f:Lokhttp3/internal/http2/p;

    invoke-virtual {v0}, Lokhttp3/internal/http2/p;->j()Lokhttp3/u;

    move-result-object v0

    .line 2
    iget-object v1, p0, Lokhttp3/internal/http2/c;->g:Lokhttp3/Protocol;

    invoke-static {v0, v1}, Lokhttp3/internal/http2/c;->a(Lokhttp3/u;Lokhttp3/Protocol;)Lokhttp3/H$a;

    move-result-object v0

    if-eqz p1, :cond_1a

    .line 3
    sget-object p1, Lokhttp3/a/a;->a:Lokhttp3/a/a;

    invoke-virtual {p1, v0}, Lokhttp3/a/a;->a(Lokhttp3/H$a;)I

    move-result p1

    const/16 v1, 0x64

    if-ne p1, v1, :cond_1a

    const/4 p1, 0x0

    return-object p1

    :cond_1a
    return-object v0
.end method

.method public writeRequestHeaders(Lokhttp3/C;)V
    .registers 5
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Lokhttp3/internal/http2/c;->f:Lokhttp3/internal/http2/p;

    if-eqz v0, :cond_5

    return-void

    .line 2
    :cond_5
    invoke-virtual {p1}, Lokhttp3/C;->a()Lokhttp3/G;

    move-result-object v0

    if-eqz v0, :cond_d

    const/4 v0, 0x1

    goto :goto_e

    :cond_d
    const/4 v0, 0x0

    .line 3
    :goto_e
    invoke-static {p1}, Lokhttp3/internal/http2/c;->a(Lokhttp3/C;)Ljava/util/List;

    move-result-object p1

    .line 4
    iget-object v1, p0, Lokhttp3/internal/http2/c;->e:Lokhttp3/internal/http2/k;

    invoke-virtual {v1, p1, v0}, Lokhttp3/internal/http2/k;->a(Ljava/util/List;Z)Lokhttp3/internal/http2/p;

    move-result-object p1

    iput-object p1, p0, Lokhttp3/internal/http2/c;->f:Lokhttp3/internal/http2/p;

    .line 5
    iget-object p1, p0, Lokhttp3/internal/http2/c;->f:Lokhttp3/internal/http2/p;

    invoke-virtual {p1}, Lokhttp3/internal/http2/p;->h()Lokio/Timeout;

    move-result-object p1

    iget-object v0, p0, Lokhttp3/internal/http2/c;->c: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;

    .line 6
    iget-object p1, p0, Lokhttp3/internal/http2/c;->f:Lokhttp3/internal/http2/p;

    invoke-virtual {p1}, Lokhttp3/internal/http2/p;->l()Lokio/Timeout;

    move-result-object p1

    iget-object v0, p0, Lokhttp3/internal/http2/c;->c:Lokhttp3/Interceptor$Chain;

    invoke-interface {v0}, Lokhttp3/Interceptor$Chain;->writeTimeoutMillis()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;

    return-void
.end method