2022-06-10 21:38:30 +09:00

631 lines
16 KiB
Smali

.class public Lorg/apache/http/impl/cookie/BestMatchSpec;
.super Ljava/lang/Object;
.source "BestMatchSpec.java"
# interfaces
.implements Lorg/apache/http/cookie/CookieSpec;
# annotations
.annotation build Lorg/apache/http/annotation/NotThreadSafe;
.end annotation
# instance fields
.field private compat:Lorg/apache/http/impl/cookie/BrowserCompatSpec;
.field private final datepatterns:[Ljava/lang/String;
.field private netscape:Lorg/apache/http/impl/cookie/NetscapeDraftSpec;
.field private obsoleteStrict:Lorg/apache/http/impl/cookie/RFC2109Spec;
.field private final oneHeader:Z
.field private strict:Lorg/apache/http/impl/cookie/RFC2965Spec;
# direct methods
.method public constructor <init>()V
.locals 2
const/4 v0, 0x0
const/4 v1, 0x0
.line 4
invoke-direct {p0, v0, v1}, Lorg/apache/http/impl/cookie/BestMatchSpec;-><init>([Ljava/lang/String;Z)V
return-void
.end method
.method public constructor <init>([Ljava/lang/String;Z)V
.locals 0
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
if-nez p1, :cond_0
const/4 p1, 0x0
goto :goto_0
.line 2
:cond_0
invoke-virtual {p1}, [Ljava/lang/String;->clone()Ljava/lang/Object;
move-result-object p1
check-cast p1, [Ljava/lang/String;
:goto_0
iput-object p1, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->datepatterns:[Ljava/lang/String;
.line 3
iput-boolean p2, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->oneHeader:Z
return-void
.end method
.method private getCompat()Lorg/apache/http/impl/cookie/BrowserCompatSpec;
.locals 2
.line 1
iget-object v0, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->compat:Lorg/apache/http/impl/cookie/BrowserCompatSpec;
if-nez v0, :cond_0
.line 2
new-instance v0, Lorg/apache/http/impl/cookie/BrowserCompatSpec;
iget-object v1, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->datepatterns:[Ljava/lang/String;
invoke-direct {v0, v1}, Lorg/apache/http/impl/cookie/BrowserCompatSpec;-><init>([Ljava/lang/String;)V
iput-object v0, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->compat:Lorg/apache/http/impl/cookie/BrowserCompatSpec;
.line 3
:cond_0
iget-object v0, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->compat:Lorg/apache/http/impl/cookie/BrowserCompatSpec;
return-object v0
.end method
.method private getNetscape()Lorg/apache/http/impl/cookie/NetscapeDraftSpec;
.locals 2
.line 1
iget-object v0, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->netscape:Lorg/apache/http/impl/cookie/NetscapeDraftSpec;
if-nez v0, :cond_0
.line 2
new-instance v0, Lorg/apache/http/impl/cookie/NetscapeDraftSpec;
iget-object v1, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->datepatterns:[Ljava/lang/String;
invoke-direct {v0, v1}, Lorg/apache/http/impl/cookie/NetscapeDraftSpec;-><init>([Ljava/lang/String;)V
iput-object v0, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->netscape:Lorg/apache/http/impl/cookie/NetscapeDraftSpec;
.line 3
:cond_0
iget-object v0, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->netscape:Lorg/apache/http/impl/cookie/NetscapeDraftSpec;
return-object v0
.end method
.method private getObsoleteStrict()Lorg/apache/http/impl/cookie/RFC2109Spec;
.locals 3
.line 1
iget-object v0, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->obsoleteStrict:Lorg/apache/http/impl/cookie/RFC2109Spec;
if-nez v0, :cond_0
.line 2
new-instance v0, Lorg/apache/http/impl/cookie/RFC2109Spec;
iget-object v1, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->datepatterns:[Ljava/lang/String;
iget-boolean v2, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->oneHeader:Z
invoke-direct {v0, v1, v2}, Lorg/apache/http/impl/cookie/RFC2109Spec;-><init>([Ljava/lang/String;Z)V
iput-object v0, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->obsoleteStrict:Lorg/apache/http/impl/cookie/RFC2109Spec;
.line 3
:cond_0
iget-object v0, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->obsoleteStrict:Lorg/apache/http/impl/cookie/RFC2109Spec;
return-object v0
.end method
.method private getStrict()Lorg/apache/http/impl/cookie/RFC2965Spec;
.locals 3
.line 1
iget-object v0, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->strict:Lorg/apache/http/impl/cookie/RFC2965Spec;
if-nez v0, :cond_0
.line 2
new-instance v0, Lorg/apache/http/impl/cookie/RFC2965Spec;
iget-object v1, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->datepatterns:[Ljava/lang/String;
iget-boolean v2, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->oneHeader:Z
invoke-direct {v0, v1, v2}, Lorg/apache/http/impl/cookie/RFC2965Spec;-><init>([Ljava/lang/String;Z)V
iput-object v0, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->strict:Lorg/apache/http/impl/cookie/RFC2965Spec;
.line 3
:cond_0
iget-object v0, p0, Lorg/apache/http/impl/cookie/BestMatchSpec;->strict:Lorg/apache/http/impl/cookie/RFC2965Spec;
return-object v0
.end method
# virtual methods
.method public formatCookies(Ljava/util/List;)Ljava/util/List;
.locals 5
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/List<",
"Lorg/apache/http/cookie/Cookie;",
">;)",
"Ljava/util/List<",
"Lorg/apache/http/Header;",
">;"
}
.end annotation
if-eqz p1, :cond_5
const v0, 0x7fffffff
const/4 v1, 0x1
.line 1
invoke-interface {p1}, Ljava/util/List;->iterator()Ljava/util/Iterator;
move-result-object v2
:cond_0
:goto_0
invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z
move-result v3
if-eqz v3, :cond_2
invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v3
check-cast v3, Lorg/apache/http/cookie/Cookie;
.line 2
instance-of v4, v3, Lorg/apache/http/cookie/SetCookie2;
if-nez v4, :cond_1
const/4 v1, 0x0
.line 3
:cond_1
invoke-interface {v3}, Lorg/apache/http/cookie/Cookie;->getVersion()I
move-result v4
if-ge v4, v0, :cond_0
.line 4
invoke-interface {v3}, Lorg/apache/http/cookie/Cookie;->getVersion()I
move-result v0
goto :goto_0
:cond_2
if-lez v0, :cond_4
if-eqz v1, :cond_3
.line 5
invoke-direct {p0}, Lorg/apache/http/impl/cookie/BestMatchSpec;->getStrict()Lorg/apache/http/impl/cookie/RFC2965Spec;
move-result-object v0
invoke-virtual {v0, p1}, Lorg/apache/http/impl/cookie/RFC2109Spec;->formatCookies(Ljava/util/List;)Ljava/util/List;
move-result-object p1
return-object p1
.line 6
:cond_3
invoke-direct {p0}, Lorg/apache/http/impl/cookie/BestMatchSpec;->getObsoleteStrict()Lorg/apache/http/impl/cookie/RFC2109Spec;
move-result-object v0
invoke-virtual {v0, p1}, Lorg/apache/http/impl/cookie/RFC2109Spec;->formatCookies(Ljava/util/List;)Ljava/util/List;
move-result-object p1
return-object p1
.line 7
:cond_4
invoke-direct {p0}, Lorg/apache/http/impl/cookie/BestMatchSpec;->getCompat()Lorg/apache/http/impl/cookie/BrowserCompatSpec;
move-result-object v0
invoke-virtual {v0, p1}, Lorg/apache/http/impl/cookie/BrowserCompatSpec;->formatCookies(Ljava/util/List;)Ljava/util/List;
move-result-object p1
return-object p1
.line 8
:cond_5
new-instance p1, Ljava/lang/IllegalArgumentException;
const-string v0, "List of cookie may not be null"
invoke-direct {p1, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
.end method
.method public getVersion()I
.locals 1
.line 1
invoke-direct {p0}, Lorg/apache/http/impl/cookie/BestMatchSpec;->getStrict()Lorg/apache/http/impl/cookie/RFC2965Spec;
move-result-object v0
invoke-virtual {v0}, Lorg/apache/http/impl/cookie/RFC2965Spec;->getVersion()I
move-result v0
return v0
.end method
.method public getVersionHeader()Lorg/apache/http/Header;
.locals 1
.line 1
invoke-direct {p0}, Lorg/apache/http/impl/cookie/BestMatchSpec;->getStrict()Lorg/apache/http/impl/cookie/RFC2965Spec;
move-result-object v0
invoke-virtual {v0}, Lorg/apache/http/impl/cookie/RFC2965Spec;->getVersionHeader()Lorg/apache/http/Header;
move-result-object v0
return-object v0
.end method
.method public match(Lorg/apache/http/cookie/Cookie;Lorg/apache/http/cookie/CookieOrigin;)Z
.locals 1
if-eqz p1, :cond_3
if-eqz p2, :cond_2
.line 1
invoke-interface {p1}, Lorg/apache/http/cookie/Cookie;->getVersion()I
move-result v0
if-lez v0, :cond_1
.line 2
instance-of v0, p1, Lorg/apache/http/cookie/SetCookie2;
if-eqz v0, :cond_0
.line 3
invoke-direct {p0}, Lorg/apache/http/impl/cookie/BestMatchSpec;->getStrict()Lorg/apache/http/impl/cookie/RFC2965Spec;
move-result-object v0
invoke-virtual {v0, p1, p2}, Lorg/apache/http/impl/cookie/RFC2965Spec;->match(Lorg/apache/http/cookie/Cookie;Lorg/apache/http/cookie/CookieOrigin;)Z
move-result p1
return p1
.line 4
:cond_0
invoke-direct {p0}, Lorg/apache/http/impl/cookie/BestMatchSpec;->getObsoleteStrict()Lorg/apache/http/impl/cookie/RFC2109Spec;
move-result-object v0
invoke-virtual {v0, p1, p2}, Lorg/apache/http/impl/cookie/CookieSpecBase;->match(Lorg/apache/http/cookie/Cookie;Lorg/apache/http/cookie/CookieOrigin;)Z
move-result p1
return p1
.line 5
:cond_1
invoke-direct {p0}, Lorg/apache/http/impl/cookie/BestMatchSpec;->getCompat()Lorg/apache/http/impl/cookie/BrowserCompatSpec;
move-result-object v0
invoke-virtual {v0, p1, p2}, Lorg/apache/http/impl/cookie/CookieSpecBase;->match(Lorg/apache/http/cookie/Cookie;Lorg/apache/http/cookie/CookieOrigin;)Z
move-result p1
return p1
.line 6
:cond_2
new-instance p1, Ljava/lang/IllegalArgumentException;
const-string p2, "Cookie origin may not be null"
invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
.line 7
:cond_3
new-instance p1, Ljava/lang/IllegalArgumentException;
const-string p2, "Cookie may not be null"
invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
.end method
.method public parse(Lorg/apache/http/Header;Lorg/apache/http/cookie/CookieOrigin;)Ljava/util/List;
.locals 8
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lorg/apache/http/Header;",
"Lorg/apache/http/cookie/CookieOrigin;",
")",
"Ljava/util/List<",
"Lorg/apache/http/cookie/Cookie;",
">;"
}
.end annotation
.annotation system Ldalvik/annotation/Throws;
value = {
Lorg/apache/http/cookie/MalformedCookieException;
}
.end annotation
if-eqz p1, :cond_7
if-eqz p2, :cond_6
.line 1
invoke-interface {p1}, Lorg/apache/http/Header;->getElements()[Lorg/apache/http/HeaderElement;
move-result-object v0
.line 2
array-length v1, v0
const/4 v2, 0x0
move v3, v2
move v4, v3
:goto_0
if-ge v2, v1, :cond_2
aget-object v5, v0, v2
const-string v6, "version"
.line 3
invoke-interface {v5, v6}, Lorg/apache/http/HeaderElement;->getParameterByName(Ljava/lang/String;)Lorg/apache/http/NameValuePair;
move-result-object v6
const/4 v7, 0x1
if-eqz v6, :cond_0
move v3, v7
:cond_0
const-string v6, "expires"
.line 4
invoke-interface {v5, v6}, Lorg/apache/http/HeaderElement;->getParameterByName(Ljava/lang/String;)Lorg/apache/http/NameValuePair;
move-result-object v5
if-eqz v5, :cond_1
move v4, v7
:cond_1
add-int/lit8 v2, v2, 0x1
goto :goto_0
:cond_2
if-eqz v3, :cond_4
.line 5
invoke-interface {p1}, Lorg/apache/http/Header;->getName()Ljava/lang/String;
move-result-object p1
const-string v1, "Set-Cookie2"
invoke-virtual {v1, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result p1
if-eqz p1, :cond_3
.line 6
invoke-direct {p0}, Lorg/apache/http/impl/cookie/BestMatchSpec;->getStrict()Lorg/apache/http/impl/cookie/RFC2965Spec;
move-result-object p1
invoke-virtual {p1, v0, p2}, Lorg/apache/http/impl/cookie/RFC2965Spec;->parse([Lorg/apache/http/HeaderElement;Lorg/apache/http/cookie/CookieOrigin;)Ljava/util/List;
move-result-object p1
return-object p1
.line 7
:cond_3
invoke-direct {p0}, Lorg/apache/http/impl/cookie/BestMatchSpec;->getObsoleteStrict()Lorg/apache/http/impl/cookie/RFC2109Spec;
move-result-object p1
invoke-virtual {p1, v0, p2}, Lorg/apache/http/impl/cookie/CookieSpecBase;->parse([Lorg/apache/http/HeaderElement;Lorg/apache/http/cookie/CookieOrigin;)Ljava/util/List;
move-result-object p1
return-object p1
:cond_4
if-eqz v4, :cond_5
.line 8
invoke-direct {p0}, Lorg/apache/http/impl/cookie/BestMatchSpec;->getNetscape()Lorg/apache/http/impl/cookie/NetscapeDraftSpec;
move-result-object v0
invoke-virtual {v0, p1, p2}, Lorg/apache/http/impl/cookie/NetscapeDraftSpec;->parse(Lorg/apache/http/Header;Lorg/apache/http/cookie/CookieOrigin;)Ljava/util/List;
move-result-object p1
return-object p1
.line 9
:cond_5
invoke-direct {p0}, Lorg/apache/http/impl/cookie/BestMatchSpec;->getCompat()Lorg/apache/http/impl/cookie/BrowserCompatSpec;
move-result-object p1
invoke-virtual {p1, v0, p2}, Lorg/apache/http/impl/cookie/CookieSpecBase;->parse([Lorg/apache/http/HeaderElement;Lorg/apache/http/cookie/CookieOrigin;)Ljava/util/List;
move-result-object p1
return-object p1
.line 10
:cond_6
new-instance p1, Ljava/lang/IllegalArgumentException;
const-string p2, "Cookie origin may not be null"
invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
.line 11
:cond_7
new-instance p1, Ljava/lang/IllegalArgumentException;
const-string p2, "Header may not be null"
invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
.end method
.method public toString()Ljava/lang/String;
.locals 1
const-string v0, "best-match"
return-object v0
.end method
.method public validate(Lorg/apache/http/cookie/Cookie;Lorg/apache/http/cookie/CookieOrigin;)V
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Lorg/apache/http/cookie/MalformedCookieException;
}
.end annotation
if-eqz p1, :cond_3
if-eqz p2, :cond_2
.line 1
invoke-interface {p1}, Lorg/apache/http/cookie/Cookie;->getVersion()I
move-result v0
if-lez v0, :cond_1
.line 2
instance-of v0, p1, Lorg/apache/http/cookie/SetCookie2;
if-eqz v0, :cond_0
.line 3
invoke-direct {p0}, Lorg/apache/http/impl/cookie/BestMatchSpec;->getStrict()Lorg/apache/http/impl/cookie/RFC2965Spec;
move-result-object v0
invoke-virtual {v0, p1, p2}, Lorg/apache/http/impl/cookie/RFC2965Spec;->validate(Lorg/apache/http/cookie/Cookie;Lorg/apache/http/cookie/CookieOrigin;)V
goto :goto_0
.line 4
:cond_0
invoke-direct {p0}, Lorg/apache/http/impl/cookie/BestMatchSpec;->getObsoleteStrict()Lorg/apache/http/impl/cookie/RFC2109Spec;
move-result-object v0
invoke-virtual {v0, p1, p2}, Lorg/apache/http/impl/cookie/RFC2109Spec;->validate(Lorg/apache/http/cookie/Cookie;Lorg/apache/http/cookie/CookieOrigin;)V
goto :goto_0
.line 5
:cond_1
invoke-direct {p0}, Lorg/apache/http/impl/cookie/BestMatchSpec;->getCompat()Lorg/apache/http/impl/cookie/BrowserCompatSpec;
move-result-object v0
invoke-virtual {v0, p1, p2}, Lorg/apache/http/impl/cookie/CookieSpecBase;->validate(Lorg/apache/http/cookie/Cookie;Lorg/apache/http/cookie/CookieOrigin;)V
:goto_0
return-void
.line 6
:cond_2
new-instance p1, Ljava/lang/IllegalArgumentException;
const-string p2, "Cookie origin may not be null"
invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
.line 7
:cond_3
new-instance p1, Ljava/lang/IllegalArgumentException;
const-string p2, "Cookie may not be null"
invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw p1
.end method