123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884 |
- .class public final Lokhttp3/internal/http1/Http1Codec;
- .super Ljava/lang/Object;
- .source ""
- # interfaces
- .implements Lokhttp3/internal/http/HttpCodec;
- # annotations
- .annotation system Ldalvik/annotation/MemberClasses;
- value = {
- Lokhttp3/internal/http1/Http1Codec$UnknownLengthSource;,
- Lokhttp3/internal/http1/Http1Codec$ChunkedSource;,
- Lokhttp3/internal/http1/Http1Codec$FixedLengthSource;,
- Lokhttp3/internal/http1/Http1Codec$AbstractSource;,
- Lokhttp3/internal/http1/Http1Codec$ChunkedSink;,
- Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;
- }
- .end annotation
- # static fields
- .field private static final STATE_CLOSED:I = 0x6
- .field private static final STATE_IDLE:I = 0x0
- .field private static final STATE_OPEN_REQUEST_BODY:I = 0x1
- .field private static final STATE_OPEN_RESPONSE_BODY:I = 0x4
- .field private static final STATE_READING_RESPONSE_BODY:I = 0x5
- .field private static final STATE_READ_RESPONSE_HEADERS:I = 0x3
- .field private static final STATE_WRITING_REQUEST_BODY:I = 0x2
- # instance fields
- .field final client:Lokhttp3/OkHttpClient;
- .field final sink:Lokio/BufferedSink;
- .field final source:Lokio/BufferedSource;
- .field state:I
- .field final streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
- # direct methods
- .method public constructor <init>(Lokhttp3/OkHttpClient;Lokhttp3/internal/connection/StreamAllocation;Lokio/BufferedSource;Lokio/BufferedSink;)V
- .locals 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- const/4 v0, 0x0
- iput v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- iput-object p1, p0, Lokhttp3/internal/http1/Http1Codec;->client:Lokhttp3/OkHttpClient;
- iput-object p2, p0, Lokhttp3/internal/http1/Http1Codec;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
- iput-object p3, p0, Lokhttp3/internal/http1/Http1Codec;->source:Lokio/BufferedSource;
- iput-object p4, p0, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink;
- return-void
- .end method
- # virtual methods
- .method public cancel()V
- .locals 1
- iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
- invoke-virtual {v0}, Lokhttp3/internal/connection/StreamAllocation;->connection()Lokhttp3/internal/connection/RealConnection;
- move-result-object v0
- if-eqz v0, :cond_0
- invoke-virtual {v0}, Lokhttp3/internal/connection/RealConnection;->cancel()V
- :cond_0
- return-void
- .end method
- .method public createRequestBody(Lokhttp3/Request;J)Lokio/Sink;
- .locals 2
- const-string v0, "Transfer-Encoding"
- invoke-virtual {p1, v0}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
- move-result-object p1
- const-string v0, "chunked"
- invoke-virtual {v0, p1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
- move-result p1
- if-eqz p1, :cond_0
- invoke-virtual {p0}, Lokhttp3/internal/http1/Http1Codec;->newChunkedSink()Lokio/Sink;
- move-result-object p1
- return-object p1
- :cond_0
- const-wide/16 v0, -0x1
- cmp-long p1, p2, v0
- if-eqz p1, :cond_1
- invoke-virtual {p0, p2, p3}, Lokhttp3/internal/http1/Http1Codec;->newFixedLengthSink(J)Lokio/Sink;
- move-result-object p1
- return-object p1
- :cond_1
- new-instance p1, Ljava/lang/IllegalStateException;
- const-string p2, "Cannot stream a request body without chunked encoding or a known content length!"
- invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
- throw p1
- .end method
- .method detachTimeout(Lokio/ForwardingTimeout;)V
- .locals 2
- invoke-virtual {p1}, Lokio/ForwardingTimeout;->delegate()Lokio/Timeout;
- move-result-object v0
- sget-object v1, Lokio/Timeout;->NONE:Lokio/Timeout;
- invoke-virtual {p1, v1}, Lokio/ForwardingTimeout;->setDelegate(Lokio/Timeout;)Lokio/ForwardingTimeout;
- invoke-virtual {v0}, Lokio/Timeout;->clearDeadline()Lokio/Timeout;
- invoke-virtual {v0}, Lokio/Timeout;->clearTimeout()Lokio/Timeout;
- return-void
- .end method
- .method public finishRequest()V
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink;
- invoke-interface {v0}, Lokio/BufferedSink;->flush()V
- return-void
- .end method
- .method public flushRequest()V
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink;
- invoke-interface {v0}, Lokio/BufferedSink;->flush()V
- return-void
- .end method
- .method public isClosed()Z
- .locals 2
- iget v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- const/4 v1, 0x6
- if-ne v0, v1, :cond_0
- const/4 v0, 0x1
- goto :goto_0
- :cond_0
- const/4 v0, 0x0
- :goto_0
- return v0
- .end method
- .method public newChunkedSink()Lokio/Sink;
- .locals 3
- iget v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- const/4 v1, 0x1
- if-ne v0, v1, :cond_0
- const/4 v0, 0x2
- iput v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- new-instance v0, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;
- invoke-direct {v0, p0}, Lokhttp3/internal/http1/Http1Codec$ChunkedSink;-><init>(Lokhttp3/internal/http1/Http1Codec;)V
- return-object v0
- :cond_0
- new-instance v0, Ljava/lang/IllegalStateException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- const-string v2, "state: "
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- iget v2, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object v1
- invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
- throw v0
- .end method
- .method public newChunkedSource(Lokhttp3/HttpUrl;)Lokio/Source;
- .locals 2
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- const/4 v1, 0x4
- if-ne v0, v1, :cond_0
- const/4 v0, 0x5
- iput v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- new-instance v0, Lokhttp3/internal/http1/Http1Codec$ChunkedSource;
- invoke-direct {v0, p0, p1}, Lokhttp3/internal/http1/Http1Codec$ChunkedSource;-><init>(Lokhttp3/internal/http1/Http1Codec;Lokhttp3/HttpUrl;)V
- return-object v0
- :cond_0
- new-instance p1, Ljava/lang/IllegalStateException;
- new-instance v0, Ljava/lang/StringBuilder;
- invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
- const-string v1, "state: "
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- iget v1, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
- invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object v0
- invoke-direct {p1, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
- throw p1
- .end method
- .method public newFixedLengthSink(J)Lokio/Sink;
- .locals 2
- iget v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- const/4 v1, 0x1
- if-ne v0, v1, :cond_0
- const/4 v0, 0x2
- iput v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- new-instance v0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;
- invoke-direct {v0, p0, p1, p2}, Lokhttp3/internal/http1/Http1Codec$FixedLengthSink;-><init>(Lokhttp3/internal/http1/Http1Codec;J)V
- return-object v0
- :cond_0
- new-instance p1, Ljava/lang/IllegalStateException;
- new-instance p2, Ljava/lang/StringBuilder;
- invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V
- const-string v0, "state: "
- invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- iget v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
- invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p2
- invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
- throw p1
- .end method
- .method public newFixedLengthSource(J)Lokio/Source;
- .locals 2
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- const/4 v1, 0x4
- if-ne v0, v1, :cond_0
- const/4 v0, 0x5
- iput v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- new-instance v0, Lokhttp3/internal/http1/Http1Codec$FixedLengthSource;
- invoke-direct {v0, p0, p1, p2}, Lokhttp3/internal/http1/Http1Codec$FixedLengthSource;-><init>(Lokhttp3/internal/http1/Http1Codec;J)V
- return-object v0
- :cond_0
- new-instance p1, Ljava/lang/IllegalStateException;
- new-instance p2, Ljava/lang/StringBuilder;
- invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V
- const-string v0, "state: "
- invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- iget v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
- invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p2
- invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
- throw p1
- .end method
- .method public newUnknownLengthSource()Lokio/Source;
- .locals 3
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- const/4 v1, 0x4
- if-ne v0, v1, :cond_1
- iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
- if-eqz v0, :cond_0
- const/4 v1, 0x5
- iput v1, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- invoke-virtual {v0}, Lokhttp3/internal/connection/StreamAllocation;->noNewStreams()V
- new-instance v0, Lokhttp3/internal/http1/Http1Codec$UnknownLengthSource;
- invoke-direct {v0, p0}, Lokhttp3/internal/http1/Http1Codec$UnknownLengthSource;-><init>(Lokhttp3/internal/http1/Http1Codec;)V
- return-object v0
- :cond_0
- new-instance v0, Ljava/lang/IllegalStateException;
- const-string v1, "streamAllocation == null"
- invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
- throw v0
- :cond_1
- new-instance v0, Ljava/lang/IllegalStateException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- const-string v2, "state: "
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- iget v2, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object v1
- invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
- throw v0
- .end method
- .method public openResponseBody(Lokhttp3/Response;)Lokhttp3/ResponseBody;
- .locals 6
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
- iget-object v1, v0, Lokhttp3/internal/connection/StreamAllocation;->eventListener:Lokhttp3/EventListener;
- iget-object v0, v0, Lokhttp3/internal/connection/StreamAllocation;->call:Lokhttp3/Call;
- invoke-virtual {v1, v0}, Lokhttp3/EventListener;->responseBodyStart(Lokhttp3/Call;)V
- const-string v0, "Content-Type"
- invoke-virtual {p1, v0}, Lokhttp3/Response;->header(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- invoke-static {p1}, Lokhttp3/internal/http/HttpHeaders;->hasBody(Lokhttp3/Response;)Z
- move-result v1
- if-nez v1, :cond_0
- const-wide/16 v1, 0x0
- invoke-virtual {p0, v1, v2}, Lokhttp3/internal/http1/Http1Codec;->newFixedLengthSource(J)Lokio/Source;
- move-result-object p1
- new-instance v3, Lokhttp3/internal/http/RealResponseBody;
- invoke-static {p1}, Lokio/Okio;->buffer(Lokio/Source;)Lokio/BufferedSource;
- move-result-object p1
- invoke-direct {v3, v0, v1, v2, p1}, Lokhttp3/internal/http/RealResponseBody;-><init>(Ljava/lang/String;JLokio/BufferedSource;)V
- return-object v3
- :cond_0
- const-string v1, "Transfer-Encoding"
- invoke-virtual {p1, v1}, Lokhttp3/Response;->header(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v1
- const-string v2, "chunked"
- invoke-virtual {v2, v1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
- move-result v1
- const-wide/16 v2, -0x1
- if-eqz v1, :cond_1
- invoke-virtual {p1}, Lokhttp3/Response;->request()Lokhttp3/Request;
- move-result-object p1
- invoke-virtual {p1}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
- move-result-object p1
- invoke-virtual {p0, p1}, Lokhttp3/internal/http1/Http1Codec;->newChunkedSource(Lokhttp3/HttpUrl;)Lokio/Source;
- move-result-object p1
- new-instance v1, Lokhttp3/internal/http/RealResponseBody;
- invoke-static {p1}, Lokio/Okio;->buffer(Lokio/Source;)Lokio/BufferedSource;
- move-result-object p1
- invoke-direct {v1, v0, v2, v3, p1}, Lokhttp3/internal/http/RealResponseBody;-><init>(Ljava/lang/String;JLokio/BufferedSource;)V
- return-object v1
- :cond_1
- invoke-static {p1}, Lokhttp3/internal/http/HttpHeaders;->contentLength(Lokhttp3/Response;)J
- move-result-wide v4
- cmp-long p1, v4, v2
- if-eqz p1, :cond_2
- invoke-virtual {p0, v4, v5}, Lokhttp3/internal/http1/Http1Codec;->newFixedLengthSource(J)Lokio/Source;
- move-result-object p1
- new-instance v1, Lokhttp3/internal/http/RealResponseBody;
- invoke-static {p1}, Lokio/Okio;->buffer(Lokio/Source;)Lokio/BufferedSource;
- move-result-object p1
- invoke-direct {v1, v0, v4, v5, p1}, Lokhttp3/internal/http/RealResponseBody;-><init>(Ljava/lang/String;JLokio/BufferedSource;)V
- return-object v1
- :cond_2
- new-instance p1, Lokhttp3/internal/http/RealResponseBody;
- invoke-virtual {p0}, Lokhttp3/internal/http1/Http1Codec;->newUnknownLengthSource()Lokio/Source;
- move-result-object v1
- invoke-static {v1}, Lokio/Okio;->buffer(Lokio/Source;)Lokio/BufferedSource;
- move-result-object v1
- invoke-direct {p1, v0, v2, v3, v1}, Lokhttp3/internal/http/RealResponseBody;-><init>(Ljava/lang/String;JLokio/BufferedSource;)V
- return-object p1
- .end method
- .method public readHeaders()Lokhttp3/Headers;
- .locals 3
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- new-instance v0, Lokhttp3/Headers$Builder;
- invoke-direct {v0}, Lokhttp3/Headers$Builder;-><init>()V
- :goto_0
- iget-object v1, p0, Lokhttp3/internal/http1/Http1Codec;->source:Lokio/BufferedSource;
- invoke-interface {v1}, Lokio/BufferedSource;->readUtf8LineStrict()Ljava/lang/String;
- move-result-object v1
- invoke-virtual {v1}, Ljava/lang/String;->length()I
- move-result v2
- if-eqz v2, :cond_0
- sget-object v2, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
- invoke-virtual {v2, v0, v1}, Lokhttp3/internal/Internal;->addLenient(Lokhttp3/Headers$Builder;Ljava/lang/String;)V
- goto :goto_0
- :cond_0
- invoke-virtual {v0}, Lokhttp3/Headers$Builder;->build()Lokhttp3/Headers;
- move-result-object v0
- return-object v0
- .end method
- .method public readResponseHeaders(Z)Lokhttp3/Response$Builder;
- .locals 3
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- const/4 v1, 0x1
- if-eq v0, v1, :cond_1
- const/4 v1, 0x3
- if-ne v0, v1, :cond_0
- goto :goto_0
- :cond_0
- new-instance p1, Ljava/lang/IllegalStateException;
- new-instance v0, Ljava/lang/StringBuilder;
- invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
- const-string v1, "state: "
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- iget v1, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
- invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object v0
- invoke-direct {p1, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
- throw p1
- :cond_1
- :goto_0
- :try_start_0
- iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec;->source:Lokio/BufferedSource;
- invoke-interface {v0}, Lokio/BufferedSource;->readUtf8LineStrict()Ljava/lang/String;
- move-result-object v0
- invoke-static {v0}, Lokhttp3/internal/http/StatusLine;->parse(Ljava/lang/String;)Lokhttp3/internal/http/StatusLine;
- move-result-object v0
- new-instance v1, Lokhttp3/Response$Builder;
- invoke-direct {v1}, Lokhttp3/Response$Builder;-><init>()V
- iget-object v2, v0, Lokhttp3/internal/http/StatusLine;->protocol:Lokhttp3/Protocol;
- invoke-virtual {v1, v2}, Lokhttp3/Response$Builder;->protocol(Lokhttp3/Protocol;)Lokhttp3/Response$Builder;
- move-result-object v1
- iget v2, v0, Lokhttp3/internal/http/StatusLine;->code:I
- invoke-virtual {v1, v2}, Lokhttp3/Response$Builder;->code(I)Lokhttp3/Response$Builder;
- move-result-object v1
- iget-object v2, v0, Lokhttp3/internal/http/StatusLine;->message:Ljava/lang/String;
- invoke-virtual {v1, v2}, Lokhttp3/Response$Builder;->message(Ljava/lang/String;)Lokhttp3/Response$Builder;
- move-result-object v1
- invoke-virtual {p0}, Lokhttp3/internal/http1/Http1Codec;->readHeaders()Lokhttp3/Headers;
- move-result-object v2
- invoke-virtual {v1, v2}, Lokhttp3/Response$Builder;->headers(Lokhttp3/Headers;)Lokhttp3/Response$Builder;
- move-result-object v1
- if-eqz p1, :cond_2
- iget p1, v0, Lokhttp3/internal/http/StatusLine;->code:I
- const/16 v0, 0x64
- if-ne p1, v0, :cond_2
- const/4 p1, 0x0
- return-object p1
- :cond_2
- const/4 p1, 0x4
- iput p1, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- :try_end_0
- .catch Ljava/io/EOFException; {:try_start_0 .. :try_end_0} :catch_0
- return-object v1
- :catch_0
- move-exception p1
- new-instance v0, Ljava/io/IOException;
- new-instance v1, Ljava/lang/StringBuilder;
- invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
- const-string v2, "unexpected end of stream on "
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- iget-object v2, p0, Lokhttp3/internal/http1/Http1Codec;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
- invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
- invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object v1
- invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
- invoke-virtual {v0, p1}, Ljava/io/IOException;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;
- throw v0
- .end method
- .method public writeRequest(Lokhttp3/Headers;Ljava/lang/String;)V
- .locals 4
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- if-nez v0, :cond_1
- iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink;
- invoke-interface {v0, p2}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- move-result-object p2
- const-string v0, "\r\n"
- invoke-interface {p2, v0}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- const/4 p2, 0x0
- invoke-virtual {p1}, Lokhttp3/Headers;->size()I
- move-result v1
- :goto_0
- if-ge p2, v1, :cond_0
- iget-object v2, p0, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink;
- invoke-virtual {p1, p2}, Lokhttp3/Headers;->name(I)Ljava/lang/String;
- move-result-object v3
- invoke-interface {v2, v3}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- move-result-object v2
- const-string v3, ": "
- invoke-interface {v2, v3}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- move-result-object v2
- invoke-virtual {p1, p2}, Lokhttp3/Headers;->value(I)Ljava/lang/String;
- move-result-object v3
- invoke-interface {v2, v3}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- move-result-object v2
- invoke-interface {v2, v0}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- add-int/lit8 p2, p2, 0x1
- goto :goto_0
- :cond_0
- iget-object p1, p0, Lokhttp3/internal/http1/Http1Codec;->sink:Lokio/BufferedSink;
- invoke-interface {p1, v0}, Lokio/BufferedSink;->writeUtf8(Ljava/lang/String;)Lokio/BufferedSink;
- const/4 p1, 0x1
- iput p1, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- return-void
- :cond_1
- new-instance p1, Ljava/lang/IllegalStateException;
- new-instance p2, Ljava/lang/StringBuilder;
- invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V
- const-string v0, "state: "
- invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
- iget v0, p0, Lokhttp3/internal/http1/Http1Codec;->state:I
- invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
- invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
- move-result-object p2
- invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
- goto :goto_2
- :goto_1
- throw p1
- :goto_2
- goto :goto_1
- .end method
- .method public writeRequestHeaders(Lokhttp3/Request;)V
- .locals 1
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- iget-object v0, p0, Lokhttp3/internal/http1/Http1Codec;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
- invoke-virtual {v0}, Lokhttp3/internal/connection/StreamAllocation;->connection()Lokhttp3/internal/connection/RealConnection;
- move-result-object v0
- invoke-virtual {v0}, Lokhttp3/internal/connection/RealConnection;->route()Lokhttp3/Route;
- move-result-object v0
- invoke-virtual {v0}, Lokhttp3/Route;->proxy()Ljava/net/Proxy;
- move-result-object v0
- invoke-virtual {v0}, Ljava/net/Proxy;->type()Ljava/net/Proxy$Type;
- move-result-object v0
- invoke-static {p1, v0}, Lokhttp3/internal/http/RequestLine;->get(Lokhttp3/Request;Ljava/net/Proxy$Type;)Ljava/lang/String;
- move-result-object v0
- invoke-virtual {p1}, Lokhttp3/Request;->headers()Lokhttp3/Headers;
- move-result-object p1
- invoke-virtual {p0, p1, v0}, Lokhttp3/internal/http1/Http1Codec;->writeRequest(Lokhttp3/Headers;Ljava/lang/String;)V
- return-void
- .end method
|