.class public final Lokhttp3/internal/http/CallServerInterceptor; .super Ljava/lang/Object; .source "CallServerInterceptor.kt" # interfaces .implements Lokhttp3/Interceptor; # annotations .annotation runtime Lkotlin/Metadata; bv = { 0x1, 0x0, 0x3 } d1 = { "\u0000\u001e\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u0018\u00002\u00020\u0001B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u00a2\u0006\u0002\u0010\u0004J\u0010\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\u0008H\u0016R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004\u00a2\u0006\u0002\n\u0000\u00a8\u0006\t" } d2 = { "Lokhttp3/internal/http/CallServerInterceptor;", "Lokhttp3/Interceptor;", "forWebSocket", "", "(Z)V", "intercept", "Lokhttp3/Response;", "chain", "Lokhttp3/Interceptor$Chain;", "okhttp" } k = 0x1 mv = { 0x1, 0x4, 0x0 } .end annotation # instance fields .field private final forWebSocket:Z # direct methods .method public constructor (Z)V .locals 0 .line 26 invoke-direct {p0}, Ljava/lang/Object;->()V iput-boolean p1, p0, Lokhttp3/internal/http/CallServerInterceptor;->forWebSocket:Z return-void .end method # virtual methods .method public intercept(Lokhttp3/Interceptor$Chain;)Lokhttp3/Response; .locals 11 .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException; } .end annotation const-string v0, "chain" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 30 check-cast p1, Lokhttp3/internal/http/RealInterceptorChain; .line 31 invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->getExchange$okhttp()Lokhttp3/internal/connection/Exchange; move-result-object v0 invoke-static {v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V .line 32 invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->getRequest$okhttp()Lokhttp3/Request; move-result-object p1 .line 33 invoke-virtual {p1}, Lokhttp3/Request;->body()Lokhttp3/RequestBody; move-result-object v1 .line 34 invoke-static {}, Ljava/lang/System;->currentTimeMillis()J move-result-wide v2 .line 36 invoke-virtual {v0, p1}, Lokhttp3/internal/connection/Exchange;->writeRequestHeaders(Lokhttp3/Request;)V const/4 v4, 0x0 .line 39 move-object v5, v4 check-cast v5, Lokhttp3/Response$Builder; .line 40 invoke-virtual {p1}, Lokhttp3/Request;->method()Ljava/lang/String; move-result-object v5 invoke-static {v5}, Lokhttp3/internal/http/HttpMethod;->permitsRequestBody(Ljava/lang/String;)Z move-result v5 const/4 v6, 0x0 const/4 v7, 0x1 if-eqz v5, :cond_3 if-eqz v1, :cond_3 const-string v5, "Expect" .line 44 invoke-virtual {p1, v5}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String; move-result-object v5 const-string v8, "100-continue" invoke-static {v8, v5, v7}, Lkotlin/text/StringsKt;->equals(Ljava/lang/String;Ljava/lang/String;Z)Z move-result v5 if-eqz v5, :cond_0 .line 45 invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->flushRequest()V .line 46 invoke-virtual {v0, v7}, Lokhttp3/internal/connection/Exchange;->readResponseHeaders(Z)Lokhttp3/Response$Builder; move-result-object v5 .line 47 invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->responseHeadersStart()V move v8, v6 goto :goto_0 :cond_0 move-object v5, v4 move v8, v7 :goto_0 if-nez v5, :cond_2 .line 51 invoke-virtual {v1}, Lokhttp3/RequestBody;->isDuplex()Z move-result v9 if-eqz v9, :cond_1 .line 53 invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->flushRequest()V .line 54 invoke-virtual {v0, p1, v7}, Lokhttp3/internal/connection/Exchange;->createRequestBody(Lokhttp3/Request;Z)Lokio/Sink; move-result-object v9 invoke-static {v9}, Lokio/Okio;->buffer(Lokio/Sink;)Lokio/BufferedSink; move-result-object v9 .line 55 invoke-virtual {v1, v9}, Lokhttp3/RequestBody;->writeTo(Lokio/BufferedSink;)V goto :goto_1 .line 58 :cond_1 invoke-virtual {v0, p1, v6}, Lokhttp3/internal/connection/Exchange;->createRequestBody(Lokhttp3/Request;Z)Lokio/Sink; move-result-object v9 invoke-static {v9}, Lokio/Okio;->buffer(Lokio/Sink;)Lokio/BufferedSink; move-result-object v9 .line 59 invoke-virtual {v1, v9}, Lokhttp3/RequestBody;->writeTo(Lokio/BufferedSink;)V .line 60 invoke-interface {v9}, Lokio/BufferedSink;->close()V goto :goto_1 .line 63 :cond_2 invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->noRequestBody()V .line 64 invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->getConnection$okhttp()Lokhttp3/internal/connection/RealConnection; move-result-object v9 invoke-virtual {v9}, Lokhttp3/internal/connection/RealConnection;->isMultiplexed$okhttp()Z move-result v9 if-nez v9, :cond_4 .line 68 invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->noNewExchangesOnConnection()V goto :goto_1 .line 72 :cond_3 invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->noRequestBody()V move-object v5, v4 move v8, v7 :cond_4 :goto_1 if-eqz v1, :cond_5 .line 75 invoke-virtual {v1}, Lokhttp3/RequestBody;->isDuplex()Z move-result v1 if-nez v1, :cond_6 .line 76 :cond_5 invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->finishRequest()V :cond_6 if-nez v5, :cond_7 .line 79 invoke-virtual {v0, v6}, Lokhttp3/internal/connection/Exchange;->readResponseHeaders(Z)Lokhttp3/Response$Builder; move-result-object v5 invoke-static {v5}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V if-eqz v8, :cond_7 .line 81 invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->responseHeadersStart()V move v8, v6 .line 86 :cond_7 invoke-virtual {v5, p1}, Lokhttp3/Response$Builder;->request(Lokhttp3/Request;)Lokhttp3/Response$Builder; move-result-object v1 .line 87 invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->getConnection$okhttp()Lokhttp3/internal/connection/RealConnection; move-result-object v5 invoke-virtual {v5}, Lokhttp3/internal/connection/RealConnection;->handshake()Lokhttp3/Handshake; move-result-object v5 invoke-virtual {v1, v5}, Lokhttp3/Response$Builder;->handshake(Lokhttp3/Handshake;)Lokhttp3/Response$Builder; move-result-object v1 .line 88 invoke-virtual {v1, v2, v3}, Lokhttp3/Response$Builder;->sentRequestAtMillis(J)Lokhttp3/Response$Builder; move-result-object v1 .line 89 invoke-static {}, Ljava/lang/System;->currentTimeMillis()J move-result-wide v9 invoke-virtual {v1, v9, v10}, Lokhttp3/Response$Builder;->receivedResponseAtMillis(J)Lokhttp3/Response$Builder; move-result-object v1 .line 90 invoke-virtual {v1}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response; move-result-object v1 .line 91 invoke-virtual {v1}, Lokhttp3/Response;->code()I move-result v5 const/16 v9, 0x64 if-ne v5, v9, :cond_9 .line 95 invoke-virtual {v0, v6}, Lokhttp3/internal/connection/Exchange;->readResponseHeaders(Z)Lokhttp3/Response$Builder; move-result-object v1 invoke-static {v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V if-eqz v8, :cond_8 .line 97 invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->responseHeadersStart()V .line 100 :cond_8 invoke-virtual {v1, p1}, Lokhttp3/Response$Builder;->request(Lokhttp3/Request;)Lokhttp3/Response$Builder; move-result-object p1 .line 101 invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->getConnection$okhttp()Lokhttp3/internal/connection/RealConnection; move-result-object v1 invoke-virtual {v1}, Lokhttp3/internal/connection/RealConnection;->handshake()Lokhttp3/Handshake; move-result-object v1 invoke-virtual {p1, v1}, Lokhttp3/Response$Builder;->handshake(Lokhttp3/Handshake;)Lokhttp3/Response$Builder; move-result-object p1 .line 102 invoke-virtual {p1, v2, v3}, Lokhttp3/Response$Builder;->sentRequestAtMillis(J)Lokhttp3/Response$Builder; move-result-object p1 .line 103 invoke-static {}, Ljava/lang/System;->currentTimeMillis()J move-result-wide v1 invoke-virtual {p1, v1, v2}, Lokhttp3/Response$Builder;->receivedResponseAtMillis(J)Lokhttp3/Response$Builder; move-result-object p1 .line 104 invoke-virtual {p1}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response; move-result-object v1 .line 105 invoke-virtual {v1}, Lokhttp3/Response;->code()I move-result v5 .line 108 :cond_9 invoke-virtual {v0, v1}, Lokhttp3/internal/connection/Exchange;->responseHeadersEnd(Lokhttp3/Response;)V iget-boolean p0, p0, Lokhttp3/internal/http/CallServerInterceptor;->forWebSocket:Z if-eqz p0, :cond_a const/16 p0, 0x65 if-ne v5, p0, :cond_a .line 112 invoke-virtual {v1}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder; move-result-object p0 .line 113 sget-object p1, Lokhttp3/internal/Util;->EMPTY_RESPONSE:Lokhttp3/ResponseBody; invoke-virtual {p0, p1}, Lokhttp3/Response$Builder;->body(Lokhttp3/ResponseBody;)Lokhttp3/Response$Builder; move-result-object p0 .line 114 invoke-virtual {p0}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response; move-result-object p0 goto :goto_2 .line 116 :cond_a invoke-virtual {v1}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder; move-result-object p0 .line 117 invoke-virtual {v0, v1}, Lokhttp3/internal/connection/Exchange;->openResponseBody(Lokhttp3/Response;)Lokhttp3/ResponseBody; move-result-object p1 invoke-virtual {p0, p1}, Lokhttp3/Response$Builder;->body(Lokhttp3/ResponseBody;)Lokhttp3/Response$Builder; move-result-object p0 .line 118 invoke-virtual {p0}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response; move-result-object p0 .line 120 :goto_2 invoke-virtual {p0}, Lokhttp3/Response;->request()Lokhttp3/Request; move-result-object p1 const-string v1, "Connection" invoke-virtual {p1, v1}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String; move-result-object p1 const-string v2, "close" invoke-static {v2, p1, v7}, Lkotlin/text/StringsKt;->equals(Ljava/lang/String;Ljava/lang/String;Z)Z move-result p1 if-nez p1, :cond_b const/4 p1, 0x2 .line 121 invoke-static {p0, v1, v4, p1, v4}, Lokhttp3/Response;->header$default(Lokhttp3/Response;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String; move-result-object p1 invoke-static {v2, p1, v7}, Lkotlin/text/StringsKt;->equals(Ljava/lang/String;Ljava/lang/String;Z)Z move-result p1 if-eqz p1, :cond_c .line 122 :cond_b invoke-virtual {v0}, Lokhttp3/internal/connection/Exchange;->noNewExchangesOnConnection()V :cond_c const/16 p1, 0xcc if-eq v5, p1, :cond_d const/16 p1, 0xcd if-ne v5, p1, :cond_10 .line 124 :cond_d invoke-virtual {p0}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody; move-result-object p1 if-eqz p1, :cond_e invoke-virtual {p1}, Lokhttp3/ResponseBody;->contentLength()J move-result-wide v0 goto :goto_3 :cond_e const-wide/16 v0, -0x1 :goto_3 const-wide/16 v2, 0x0 cmp-long p1, v0, v2 if-lez p1, :cond_10 .line 125 new-instance p1, Ljava/net/ProtocolException; .line 126 new-instance v0, Ljava/lang/StringBuilder; const-string v1, "HTTP " invoke-direct {v0, v1}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V invoke-virtual {v0, v5}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v0 const-string v1, " had non-zero Content-Length: " invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v0 invoke-virtual {p0}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody; move-result-object p0 if-eqz p0, :cond_f invoke-virtual {p0}, Lokhttp3/ResponseBody;->contentLength()J move-result-wide v1 invoke-static {v1, v2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long; move-result-object v4 :cond_f invoke-virtual {v0, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object p0 invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object p0 .line 125 invoke-direct {p1, p0}, Ljava/net/ProtocolException;->(Ljava/lang/String;)V check-cast p1, Ljava/lang/Throwable; throw p1 :cond_10 return-object p0 .end method