123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803 |
- .class public Lokhttp3/internal/cache/CacheStrategy$Factory;
- .super Ljava/lang/Object;
- .source ""
- # annotations
- .annotation system Ldalvik/annotation/EnclosingClass;
- value = Lokhttp3/internal/cache/CacheStrategy;
- .end annotation
- .annotation system Ldalvik/annotation/InnerClass;
- accessFlags = 0x9
- name = "Factory"
- .end annotation
- # instance fields
- .field private ageSeconds:I
- .field final cacheResponse:Lokhttp3/Response;
- .field private etag:Ljava/lang/String;
- .field private expires:Ljava/util/Date;
- .field private lastModified:Ljava/util/Date;
- .field private lastModifiedString:Ljava/lang/String;
- .field final nowMillis:J
- .field private receivedResponseMillis:J
- .field final request:Lokhttp3/Request;
- .field private sentRequestMillis:J
- .field private servedDate:Ljava/util/Date;
- .field private servedDateString:Ljava/lang/String;
- # direct methods
- .method public constructor <init>(JLokhttp3/Request;Lokhttp3/Response;)V
- .locals 3
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- const/4 v0, -0x1
- iput v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->ageSeconds:I
- iput-wide p1, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->nowMillis:J
- iput-object p3, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->request:Lokhttp3/Request;
- iput-object p4, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->cacheResponse:Lokhttp3/Response;
- if-eqz p4, :cond_5
- invoke-virtual {p4}, Lokhttp3/Response;->sentRequestAtMillis()J
- move-result-wide p1
- iput-wide p1, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->sentRequestMillis:J
- invoke-virtual {p4}, Lokhttp3/Response;->receivedResponseAtMillis()J
- move-result-wide p1
- iput-wide p1, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->receivedResponseMillis:J
- invoke-virtual {p4}, Lokhttp3/Response;->headers()Lokhttp3/Headers;
- move-result-object p1
- const/4 p2, 0x0
- invoke-virtual {p1}, Lokhttp3/Headers;->size()I
- move-result p3
- :goto_0
- if-ge p2, p3, :cond_5
- invoke-virtual {p1, p2}, Lokhttp3/Headers;->name(I)Ljava/lang/String;
- move-result-object p4
- invoke-virtual {p1, p2}, Lokhttp3/Headers;->value(I)Ljava/lang/String;
- move-result-object v1
- const-string v2, "Date"
- invoke-virtual {v2, p4}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
- move-result v2
- if-eqz v2, :cond_0
- invoke-static {v1}, Lokhttp3/internal/http/HttpDate;->parse(Ljava/lang/String;)Ljava/util/Date;
- move-result-object p4
- iput-object p4, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->servedDate:Ljava/util/Date;
- iput-object v1, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->servedDateString:Ljava/lang/String;
- goto :goto_1
- :cond_0
- const-string v2, "Expires"
- invoke-virtual {v2, p4}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
- move-result v2
- if-eqz v2, :cond_1
- invoke-static {v1}, Lokhttp3/internal/http/HttpDate;->parse(Ljava/lang/String;)Ljava/util/Date;
- move-result-object p4
- iput-object p4, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->expires:Ljava/util/Date;
- goto :goto_1
- :cond_1
- const-string v2, "Last-Modified"
- invoke-virtual {v2, p4}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
- move-result v2
- if-eqz v2, :cond_2
- invoke-static {v1}, Lokhttp3/internal/http/HttpDate;->parse(Ljava/lang/String;)Ljava/util/Date;
- move-result-object p4
- iput-object p4, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->lastModified:Ljava/util/Date;
- iput-object v1, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->lastModifiedString:Ljava/lang/String;
- goto :goto_1
- :cond_2
- const-string v2, "ETag"
- invoke-virtual {v2, p4}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
- move-result v2
- if-eqz v2, :cond_3
- iput-object v1, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->etag:Ljava/lang/String;
- goto :goto_1
- :cond_3
- const-string v2, "Age"
- invoke-virtual {v2, p4}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
- move-result p4
- if-eqz p4, :cond_4
- invoke-static {v1, v0}, Lokhttp3/internal/http/HttpHeaders;->parseSeconds(Ljava/lang/String;I)I
- move-result p4
- iput p4, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->ageSeconds:I
- :cond_4
- :goto_1
- add-int/lit8 p2, p2, 0x1
- goto :goto_0
- :cond_5
- return-void
- .end method
- .method private cacheResponseAge()J
- .locals 9
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->servedDate:Ljava/util/Date;
- const-wide/16 v1, 0x0
- if-eqz v0, :cond_0
- iget-wide v3, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->receivedResponseMillis:J
- invoke-virtual {v0}, Ljava/util/Date;->getTime()J
- move-result-wide v5
- sub-long/2addr v3, v5
- invoke-static {v1, v2, v3, v4}, Ljava/lang/Math;->max(JJ)J
- move-result-wide v1
- :cond_0
- iget v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->ageSeconds:I
- const/4 v3, -0x1
- if-eq v0, v3, :cond_1
- sget-object v3, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
- int-to-long v4, v0
- invoke-virtual {v3, v4, v5}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J
- move-result-wide v3
- invoke-static {v1, v2, v3, v4}, Ljava/lang/Math;->max(JJ)J
- move-result-wide v1
- :cond_1
- iget-wide v3, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->receivedResponseMillis:J
- iget-wide v5, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->sentRequestMillis:J
- sub-long v5, v3, v5
- iget-wide v7, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->nowMillis:J
- sub-long/2addr v7, v3
- add-long/2addr v1, v5
- add-long/2addr v1, v7
- return-wide v1
- .end method
- .method private computeFreshnessLifetime()J
- .locals 7
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->cacheResponse:Lokhttp3/Response;
- invoke-virtual {v0}, Lokhttp3/Response;->cacheControl()Lokhttp3/CacheControl;
- move-result-object v0
- invoke-virtual {v0}, Lokhttp3/CacheControl;->maxAgeSeconds()I
- move-result v1
- const/4 v2, -0x1
- if-eq v1, v2, :cond_0
- sget-object v1, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
- invoke-virtual {v0}, Lokhttp3/CacheControl;->maxAgeSeconds()I
- move-result v0
- int-to-long v2, v0
- invoke-virtual {v1, v2, v3}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J
- move-result-wide v0
- return-wide v0
- :cond_0
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->expires:Ljava/util/Date;
- const-wide/16 v1, 0x0
- if-eqz v0, :cond_3
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->servedDate:Ljava/util/Date;
- if-eqz v0, :cond_1
- invoke-virtual {v0}, Ljava/util/Date;->getTime()J
- move-result-wide v3
- goto :goto_0
- :cond_1
- iget-wide v3, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->receivedResponseMillis:J
- :goto_0
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->expires:Ljava/util/Date;
- invoke-virtual {v0}, Ljava/util/Date;->getTime()J
- move-result-wide v5
- sub-long v3, v5, v3
- cmp-long v0, v3, v1
- if-lez v0, :cond_2
- move-wide v1, v3
- :cond_2
- return-wide v1
- :cond_3
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->lastModified:Ljava/util/Date;
- if-eqz v0, :cond_5
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->cacheResponse:Lokhttp3/Response;
- invoke-virtual {v0}, Lokhttp3/Response;->request()Lokhttp3/Request;
- move-result-object v0
- invoke-virtual {v0}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
- move-result-object v0
- invoke-virtual {v0}, Lokhttp3/HttpUrl;->query()Ljava/lang/String;
- move-result-object v0
- if-nez v0, :cond_5
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->servedDate:Ljava/util/Date;
- if-eqz v0, :cond_4
- invoke-virtual {v0}, Ljava/util/Date;->getTime()J
- move-result-wide v3
- goto :goto_1
- :cond_4
- iget-wide v3, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->sentRequestMillis:J
- :goto_1
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->lastModified:Ljava/util/Date;
- invoke-virtual {v0}, Ljava/util/Date;->getTime()J
- move-result-wide v5
- sub-long/2addr v3, v5
- cmp-long v0, v3, v1
- if-lez v0, :cond_5
- const-wide/16 v0, 0xa
- div-long v1, v3, v0
- :cond_5
- return-wide v1
- .end method
- .method private getCandidate()Lokhttp3/internal/cache/CacheStrategy;
- .locals 13
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->cacheResponse:Lokhttp3/Response;
- const/4 v1, 0x0
- if-nez v0, :cond_0
- new-instance v0, Lokhttp3/internal/cache/CacheStrategy;
- iget-object v2, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->request:Lokhttp3/Request;
- invoke-direct {v0, v2, v1}, Lokhttp3/internal/cache/CacheStrategy;-><init>(Lokhttp3/Request;Lokhttp3/Response;)V
- return-object v0
- :cond_0
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->request:Lokhttp3/Request;
- invoke-virtual {v0}, Lokhttp3/Request;->isHttps()Z
- move-result v0
- if-eqz v0, :cond_1
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->cacheResponse:Lokhttp3/Response;
- invoke-virtual {v0}, Lokhttp3/Response;->handshake()Lokhttp3/Handshake;
- move-result-object v0
- if-nez v0, :cond_1
- new-instance v0, Lokhttp3/internal/cache/CacheStrategy;
- iget-object v2, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->request:Lokhttp3/Request;
- invoke-direct {v0, v2, v1}, Lokhttp3/internal/cache/CacheStrategy;-><init>(Lokhttp3/Request;Lokhttp3/Response;)V
- return-object v0
- :cond_1
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->cacheResponse:Lokhttp3/Response;
- iget-object v2, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->request:Lokhttp3/Request;
- invoke-static {v0, v2}, Lokhttp3/internal/cache/CacheStrategy;->isCacheable(Lokhttp3/Response;Lokhttp3/Request;)Z
- move-result v0
- if-nez v0, :cond_2
- new-instance v0, Lokhttp3/internal/cache/CacheStrategy;
- iget-object v2, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->request:Lokhttp3/Request;
- invoke-direct {v0, v2, v1}, Lokhttp3/internal/cache/CacheStrategy;-><init>(Lokhttp3/Request;Lokhttp3/Response;)V
- return-object v0
- :cond_2
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->request:Lokhttp3/Request;
- invoke-virtual {v0}, Lokhttp3/Request;->cacheControl()Lokhttp3/CacheControl;
- move-result-object v0
- invoke-virtual {v0}, Lokhttp3/CacheControl;->noCache()Z
- move-result v2
- if-nez v2, :cond_e
- iget-object v2, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->request:Lokhttp3/Request;
- invoke-static {v2}, Lokhttp3/internal/cache/CacheStrategy$Factory;->hasConditions(Lokhttp3/Request;)Z
- move-result v2
- if-eqz v2, :cond_3
- goto/16 :goto_2
- :cond_3
- iget-object v2, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->cacheResponse:Lokhttp3/Response;
- invoke-virtual {v2}, Lokhttp3/Response;->cacheControl()Lokhttp3/CacheControl;
- move-result-object v2
- invoke-virtual {v2}, Lokhttp3/CacheControl;->immutable()Z
- move-result v3
- if-eqz v3, :cond_4
- new-instance v0, Lokhttp3/internal/cache/CacheStrategy;
- iget-object v2, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->cacheResponse:Lokhttp3/Response;
- invoke-direct {v0, v1, v2}, Lokhttp3/internal/cache/CacheStrategy;-><init>(Lokhttp3/Request;Lokhttp3/Response;)V
- return-object v0
- :cond_4
- invoke-direct {p0}, Lokhttp3/internal/cache/CacheStrategy$Factory;->cacheResponseAge()J
- move-result-wide v3
- invoke-direct {p0}, Lokhttp3/internal/cache/CacheStrategy$Factory;->computeFreshnessLifetime()J
- move-result-wide v5
- invoke-virtual {v0}, Lokhttp3/CacheControl;->maxAgeSeconds()I
- move-result v7
- const/4 v8, -0x1
- if-eq v7, v8, :cond_5
- sget-object v7, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
- invoke-virtual {v0}, Lokhttp3/CacheControl;->maxAgeSeconds()I
- move-result v9
- int-to-long v9, v9
- invoke-virtual {v7, v9, v10}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J
- move-result-wide v9
- invoke-static {v5, v6, v9, v10}, Ljava/lang/Math;->min(JJ)J
- move-result-wide v5
- :cond_5
- invoke-virtual {v0}, Lokhttp3/CacheControl;->minFreshSeconds()I
- move-result v7
- const-wide/16 v9, 0x0
- if-eq v7, v8, :cond_6
- sget-object v7, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
- invoke-virtual {v0}, Lokhttp3/CacheControl;->minFreshSeconds()I
- move-result v11
- int-to-long v11, v11
- invoke-virtual {v7, v11, v12}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J
- move-result-wide v11
- goto :goto_0
- :cond_6
- move-wide v11, v9
- :goto_0
- invoke-virtual {v2}, Lokhttp3/CacheControl;->mustRevalidate()Z
- move-result v7
- if-nez v7, :cond_7
- invoke-virtual {v0}, Lokhttp3/CacheControl;->maxStaleSeconds()I
- move-result v7
- if-eq v7, v8, :cond_7
- sget-object v7, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
- invoke-virtual {v0}, Lokhttp3/CacheControl;->maxStaleSeconds()I
- move-result v0
- int-to-long v8, v0
- invoke-virtual {v7, v8, v9}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J
- move-result-wide v9
- :cond_7
- invoke-virtual {v2}, Lokhttp3/CacheControl;->noCache()Z
- move-result v0
- if-nez v0, :cond_a
- add-long/2addr v11, v3
- add-long/2addr v9, v5
- cmp-long v0, v11, v9
- if-gez v0, :cond_a
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->cacheResponse:Lokhttp3/Response;
- invoke-virtual {v0}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder;
- move-result-object v0
- const-string v2, "Warning"
- cmp-long v7, v11, v5
- if-ltz v7, :cond_8
- const-string v5, "110 HttpURLConnection \"Response is stale\""
- invoke-virtual {v0, v2, v5}, Lokhttp3/Response$Builder;->addHeader(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Response$Builder;
- :cond_8
- const-wide/32 v5, 0x5265c00
- cmp-long v7, v3, v5
- if-lez v7, :cond_9
- invoke-direct {p0}, Lokhttp3/internal/cache/CacheStrategy$Factory;->isFreshnessLifetimeHeuristic()Z
- move-result v3
- if-eqz v3, :cond_9
- const-string v3, "113 HttpURLConnection \"Heuristic expiration\""
- invoke-virtual {v0, v2, v3}, Lokhttp3/Response$Builder;->addHeader(Ljava/lang/String;Ljava/lang/String;)Lokhttp3/Response$Builder;
- :cond_9
- new-instance v2, Lokhttp3/internal/cache/CacheStrategy;
- invoke-virtual {v0}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
- move-result-object v0
- invoke-direct {v2, v1, v0}, Lokhttp3/internal/cache/CacheStrategy;-><init>(Lokhttp3/Request;Lokhttp3/Response;)V
- return-object v2
- :cond_a
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->etag:Ljava/lang/String;
- const-string v2, "If-Modified-Since"
- if-eqz v0, :cond_b
- const-string v2, "If-None-Match"
- goto :goto_1
- :cond_b
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->lastModified:Ljava/util/Date;
- if-eqz v0, :cond_c
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->lastModifiedString:Ljava/lang/String;
- goto :goto_1
- :cond_c
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->servedDate:Ljava/util/Date;
- if-eqz v0, :cond_d
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->servedDateString:Ljava/lang/String;
- :goto_1
- iget-object v1, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->request:Lokhttp3/Request;
- invoke-virtual {v1}, Lokhttp3/Request;->headers()Lokhttp3/Headers;
- move-result-object v1
- invoke-virtual {v1}, Lokhttp3/Headers;->newBuilder()Lokhttp3/Headers$Builder;
- move-result-object v1
- sget-object v3, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
- invoke-virtual {v3, v1, v2, v0}, Lokhttp3/internal/Internal;->addLenient(Lokhttp3/Headers$Builder;Ljava/lang/String;Ljava/lang/String;)V
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->request:Lokhttp3/Request;
- invoke-virtual {v0}, Lokhttp3/Request;->newBuilder()Lokhttp3/Request$Builder;
- move-result-object v0
- invoke-virtual {v1}, Lokhttp3/Headers$Builder;->build()Lokhttp3/Headers;
- move-result-object v1
- invoke-virtual {v0, v1}, Lokhttp3/Request$Builder;->headers(Lokhttp3/Headers;)Lokhttp3/Request$Builder;
- move-result-object v0
- invoke-virtual {v0}, Lokhttp3/Request$Builder;->build()Lokhttp3/Request;
- move-result-object v0
- new-instance v1, Lokhttp3/internal/cache/CacheStrategy;
- iget-object v2, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->cacheResponse:Lokhttp3/Response;
- invoke-direct {v1, v0, v2}, Lokhttp3/internal/cache/CacheStrategy;-><init>(Lokhttp3/Request;Lokhttp3/Response;)V
- return-object v1
- :cond_d
- new-instance v0, Lokhttp3/internal/cache/CacheStrategy;
- iget-object v2, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->request:Lokhttp3/Request;
- invoke-direct {v0, v2, v1}, Lokhttp3/internal/cache/CacheStrategy;-><init>(Lokhttp3/Request;Lokhttp3/Response;)V
- return-object v0
- :cond_e
- :goto_2
- new-instance v0, Lokhttp3/internal/cache/CacheStrategy;
- iget-object v2, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->request:Lokhttp3/Request;
- invoke-direct {v0, v2, v1}, Lokhttp3/internal/cache/CacheStrategy;-><init>(Lokhttp3/Request;Lokhttp3/Response;)V
- return-object v0
- .end method
- .method private static hasConditions(Lokhttp3/Request;)Z
- .locals 1
- const-string v0, "If-Modified-Since"
- invoke-virtual {p0, v0}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
- move-result-object v0
- if-nez v0, :cond_1
- const-string v0, "If-None-Match"
- invoke-virtual {p0, v0}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
- move-result-object p0
- if-eqz p0, :cond_0
- goto :goto_0
- :cond_0
- const/4 p0, 0x0
- goto :goto_1
- :cond_1
- :goto_0
- const/4 p0, 0x1
- :goto_1
- return p0
- .end method
- .method private isFreshnessLifetimeHeuristic()Z
- .locals 2
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->cacheResponse:Lokhttp3/Response;
- invoke-virtual {v0}, Lokhttp3/Response;->cacheControl()Lokhttp3/CacheControl;
- move-result-object v0
- invoke-virtual {v0}, Lokhttp3/CacheControl;->maxAgeSeconds()I
- move-result v0
- const/4 v1, -0x1
- if-ne v0, v1, :cond_0
- iget-object v0, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->expires:Ljava/util/Date;
- if-nez v0, :cond_0
- const/4 v0, 0x1
- goto :goto_0
- :cond_0
- const/4 v0, 0x0
- :goto_0
- return v0
- .end method
- # virtual methods
- .method public get()Lokhttp3/internal/cache/CacheStrategy;
- .locals 2
- invoke-direct {p0}, Lokhttp3/internal/cache/CacheStrategy$Factory;->getCandidate()Lokhttp3/internal/cache/CacheStrategy;
- move-result-object v0
- iget-object v1, v0, Lokhttp3/internal/cache/CacheStrategy;->networkRequest:Lokhttp3/Request;
- if-eqz v1, :cond_0
- iget-object v1, p0, Lokhttp3/internal/cache/CacheStrategy$Factory;->request:Lokhttp3/Request;
- invoke-virtual {v1}, Lokhttp3/Request;->cacheControl()Lokhttp3/CacheControl;
- move-result-object v1
- invoke-virtual {v1}, Lokhttp3/CacheControl;->onlyIfCached()Z
- move-result v1
- if-eqz v1, :cond_0
- new-instance v0, Lokhttp3/internal/cache/CacheStrategy;
- const/4 v1, 0x0
- invoke-direct {v0, v1, v1}, Lokhttp3/internal/cache/CacheStrategy;-><init>(Lokhttp3/Request;Lokhttp3/Response;)V
- :cond_0
- return-object v0
- .end method
|