123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- .class public final Lokhttp3/internal/http/StatusLine;
- .super Ljava/lang/Object;
- .source ""
- # static fields
- .field public static final HTTP_CONTINUE:I = 0x64
- .field public static final HTTP_PERM_REDIRECT:I = 0x134
- .field public static final HTTP_TEMP_REDIRECT:I = 0x133
- # instance fields
- .field public final code:I
- .field public final message:Ljava/lang/String;
- .field public final protocol:Lokhttp3/Protocol;
- # direct methods
- .method public constructor <init>(Lokhttp3/Protocol;ILjava/lang/String;)V
- .locals 0
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- iput-object p1, p0, Lokhttp3/internal/http/StatusLine;->protocol:Lokhttp3/Protocol;
- iput p2, p0, Lokhttp3/internal/http/StatusLine;->code:I
- iput-object p3, p0, Lokhttp3/internal/http/StatusLine;->message:Ljava/lang/String;
- return-void
- .end method
- .method public static get(Lokhttp3/Response;)Lokhttp3/internal/http/StatusLine;
- .locals 3
- new-instance v0, Lokhttp3/internal/http/StatusLine;
- invoke-virtual {p0}, Lokhttp3/Response;->protocol()Lokhttp3/Protocol;
- move-result-object v1
- invoke-virtual {p0}, Lokhttp3/Response;->code()I
- move-result v2
- invoke-virtual {p0}, Lokhttp3/Response;->message()Ljava/lang/String;
- move-result-object p0
- invoke-direct {v0, v1, v2, p0}, Lokhttp3/internal/http/StatusLine;-><init>(Lokhttp3/Protocol;ILjava/lang/String;)V
- return-object v0
- .end method
- .method public static parse(Ljava/lang/String;)Lokhttp3/internal/http/StatusLine;
- .locals 8
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- const-string v0, "HTTP/1."
- invoke-virtual {p0, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
- move-result v0
- const/16 v1, 0x20
- const/4 v2, 0x4
- const/16 v3, 0x9
- const-string v4, "Unexpected status line: "
- if-eqz v0, :cond_3
- invoke-virtual {p0}, Ljava/lang/String;->length()I
- move-result v0
- if-lt v0, v3, :cond_2
- const/16 v0, 0x8
- invoke-virtual {p0, v0}, Ljava/lang/String;->charAt(I)C
- move-result v0
- if-ne v0, v1, :cond_2
- const/4 v0, 0x7
- invoke-virtual {p0, v0}, Ljava/lang/String;->charAt(I)C
- move-result v0
- add-int/lit8 v0, v0, -0x30
- if-nez v0, :cond_0
- sget-object v0, Lokhttp3/Protocol;->HTTP_1_0:Lokhttp3/Protocol;
- goto :goto_0
- :cond_0
- const/4 v5, 0x1
- if-ne v0, v5, :cond_1
- sget-object v0, Lokhttp3/Protocol;->HTTP_1_1:Lokhttp3/Protocol;
- goto :goto_0
- :cond_1
- new-instance v0, Ljava/net/ProtocolException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- invoke-virtual {v1, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p0
- invoke-direct {v0, p0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
- throw v0
- :cond_2
- new-instance v0, Ljava/net/ProtocolException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- invoke-virtual {v1, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p0
- invoke-direct {v0, p0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
- throw v0
- :cond_3
- const-string v0, "ICY "
- invoke-virtual {p0, v0}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
- move-result v0
- if-eqz v0, :cond_7
- sget-object v0, Lokhttp3/Protocol;->HTTP_1_0:Lokhttp3/Protocol;
- const/4 v3, 0x4
- :goto_0
- invoke-virtual {p0}, Ljava/lang/String;->length()I
- move-result v5
- add-int/lit8 v6, v3, 0x3
- if-lt v5, v6, :cond_6
- :try_start_0
- invoke-virtual {p0, v3, v6}, Ljava/lang/String;->substring(II)Ljava/lang/String;
- move-result-object v5
- invoke-static {v5}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
- move-result v5
- :try_end_0
- .catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_0
- invoke-virtual {p0}, Ljava/lang/String;->length()I
- move-result v7
- if-le v7, v6, :cond_5
- invoke-virtual {p0, v6}, Ljava/lang/String;->charAt(I)C
- move-result v6
- if-ne v6, v1, :cond_4
- add-int/2addr v3, v2
- invoke-virtual {p0, v3}, Ljava/lang/String;->substring(I)Ljava/lang/String;
- move-result-object p0
- goto :goto_1
- :cond_4
- new-instance v0, Ljava/net/ProtocolException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- invoke-virtual {v1, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p0
- invoke-direct {v0, p0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
- throw v0
- :cond_5
- const-string p0, ""
- :goto_1
- new-instance v1, Lokhttp3/internal/http/StatusLine;
- invoke-direct {v1, v0, v5, p0}, Lokhttp3/internal/http/StatusLine;-><init>(Lokhttp3/Protocol;ILjava/lang/String;)V
- return-object v1
- :catch_0
- new-instance v0, Ljava/net/ProtocolException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- invoke-virtual {v1, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p0
- invoke-direct {v0, p0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
- throw v0
- :cond_6
- new-instance v0, Ljava/net/ProtocolException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- invoke-virtual {v1, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p0
- invoke-direct {v0, p0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
- throw v0
- :cond_7
- new-instance v0, Ljava/net/ProtocolException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- invoke-virtual {v1, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p0
- invoke-direct {v0, p0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
- throw v0
- .end method
- # virtual methods
- .method public toString()Ljava/lang/String;
- .locals 3
- new-instance v0, Ljava/lang/StringBuilder;
- invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
- iget-object v1, p0, Lokhttp3/internal/http/StatusLine;->protocol:Lokhttp3/Protocol;
- sget-object v2, Lokhttp3/Protocol;->HTTP_1_0:Lokhttp3/Protocol;
- if-ne v1, v2, :cond_0
- const-string v1, "HTTP/1.0"
- goto :goto_0
- :cond_0
- const-string v1, "HTTP/1.1"
- :goto_0
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- const/16 v1, 0x20
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
- iget v2, p0, Lokhttp3/internal/http/StatusLine;->code:I
- invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
- iget-object v2, p0, Lokhttp3/internal/http/StatusLine;->message:Ljava/lang/String;
- if-eqz v2, :cond_1
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
- iget-object v1, p0, Lokhttp3/internal/http/StatusLine;->message:Ljava/lang/String;
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- :cond_1
- invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object v0
- return-object v0
- .end method
|