Rabbit-R1/original r1/java/sources/okhttp3/Cookie.java
2024-05-21 17:08:36 -04:00

527 lines
29 KiB
Java

package okhttp3;
import androidx.media3.exoplayer.upstream.CmcdHeadersFactory;
import com.google.common.net.HttpHeaders;
import io.sentry.protocol.OperatingSystem;
import io.sentry.protocol.Request;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Regex;
import kotlin.text.StringsKt;
import okhttp3.internal.HostnamesKt;
import okhttp3.internal.Util;
import okhttp3.internal.http.DatesKt;
/* compiled from: Cookie.kt */
@Metadata(bv = {1, 0, 3}, d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\t\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\f\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u000b\u0018\u0000 &2\u00020\u0001:\u0002%&BO\b\u0002\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003\u0012\u0006\u0010\u0005\u001a\u00020\u0006\u0012\u0006\u0010\u0007\u001a\u00020\u0003\u0012\u0006\u0010\b\u001a\u00020\u0003\u0012\u0006\u0010\t\u001a\u00020\n\u0012\u0006\u0010\u000b\u001a\u00020\n\u0012\u0006\u0010\f\u001a\u00020\n\u0012\u0006\u0010\r\u001a\u00020\\u0006\u0002\u0010\u000eJ\r\u0010\u0007\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u0012J\u0013\u0010\u0013\u001a\u00020\n2\b\u0010\u0014\u001a\u0004\u0018\u00010\u0001H\u0096\u0002J\r\u0010\u0005\u001a\u00020\u0006H\u0007¢\u0006\u0002\b\u0015J\b\u0010\u0016\u001a\u00020\u0017H\u0017J\r\u0010\r\u001a\u00020\nH\u0007¢\u0006\u0002\b\u0018J\r\u0010\u000b\u001a\u00020\nH\u0007¢\u0006\u0002\b\u0019J\u000e\u0010\u001a\u001a\u00020\n2\u0006\u0010\u001b\u001a\u00020\u001cJ\r\u0010\u0002\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u001dJ\r\u0010\b\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u001eJ\r\u0010\f\u001a\u00020\nH\u0007¢\u0006\u0002\b\u001fJ\r\u0010\t\u001a\u00020\nH\u0007¢\u0006\u0002\b J\b\u0010!\u001a\u00020\u0003H\u0016J\u0015\u0010!\u001a\u00020\u00032\u0006\u0010\"\u001a\u00020\nH\u0000¢\u0006\u0002\b#J\r\u0010\u0004\u001a\u00020\u0003H\u0007¢\u0006\u0002\b$R\u0013\u0010\u0007\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\u000fR\u0013\u0010\u0005\u001a\u00020\u00068\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0010R\u0013\u0010\r\u001a\u00020\n8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u0011R\u0013\u0010\u000b\u001a\u00020\n8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\u0011R\u0013\u0010\u0002\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\u000fR\u0013\u0010\b\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\u000fR\u0013\u0010\f\u001a\u00020\n8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\f\u0010\u0011R\u0013\u0010\t\u001a\u00020\n8\u0007¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\u0011R\u0013\u0010\u0004\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0004\u0010\u000f¨\u0006'"}, d2 = {"Lokhttp3/Cookie;", "", "name", "", "value", "expiresAt", "", "domain", "path", "secure", "", "httpOnly", "persistent", "hostOnly", "(Ljava/lang/String;Ljava/lang/String;JLjava/lang/String;Ljava/lang/String;ZZZZ)V", "()Ljava/lang/String;", "()J", "()Z", "-deprecated_domain", "equals", "other", "-deprecated_expiresAt", "hashCode", "", "-deprecated_hostOnly", "-deprecated_httpOnly", "matches", Request.JsonKeys.URL, "Lokhttp3/HttpUrl;", "-deprecated_name", "-deprecated_path", "-deprecated_persistent", "-deprecated_secure", "toString", "forObsoleteRfc2965", "toString$okhttp", "-deprecated_value", "Builder", "Companion", "okhttp"}, k = 1, mv = {1, 4, 0})
/* loaded from: classes3.dex */
public final class Cookie {
private final String domain;
private final long expiresAt;
private final boolean hostOnly;
private final boolean httpOnly;
private final String name;
private final String path;
private final boolean persistent;
private final boolean secure;
private final String value;
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private static final Pattern YEAR_PATTERN = Pattern.compile("(\\d{2,4})[^\\d]*");
private static final Pattern MONTH_PATTERN = Pattern.compile("(?i)(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec).*");
private static final Pattern DAY_OF_MONTH_PATTERN = Pattern.compile("(\\d{1,2})[^\\d]*");
private static final Pattern TIME_PATTERN = Pattern.compile("(\\d{1,2}):(\\d{1,2}):(\\d{1,2})[^\\d]*");
@JvmStatic
public static final Cookie parse(HttpUrl httpUrl, String str) {
return INSTANCE.parse(httpUrl, str);
}
@JvmStatic
public static final List<Cookie> parseAll(HttpUrl httpUrl, Headers headers) {
return INSTANCE.parseAll(httpUrl, headers);
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "domain", imports = {}))
/* renamed from: -deprecated_domain, reason: not valid java name and from getter */
public final String getDomain() {
return this.domain;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "expiresAt", imports = {}))
/* renamed from: -deprecated_expiresAt, reason: not valid java name and from getter */
public final long getExpiresAt() {
return this.expiresAt;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "hostOnly", imports = {}))
/* renamed from: -deprecated_hostOnly, reason: not valid java name and from getter */
public final boolean getHostOnly() {
return this.hostOnly;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "httpOnly", imports = {}))
/* renamed from: -deprecated_httpOnly, reason: not valid java name and from getter */
public final boolean getHttpOnly() {
return this.httpOnly;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "name", imports = {}))
/* renamed from: -deprecated_name, reason: not valid java name and from getter */
public final String getName() {
return this.name;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "path", imports = {}))
/* renamed from: -deprecated_path, reason: not valid java name and from getter */
public final String getPath() {
return this.path;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "persistent", imports = {}))
/* renamed from: -deprecated_persistent, reason: not valid java name and from getter */
public final boolean getPersistent() {
return this.persistent;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "secure", imports = {}))
/* renamed from: -deprecated_secure, reason: not valid java name and from getter */
public final boolean getSecure() {
return this.secure;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "value", imports = {}))
/* renamed from: -deprecated_value, reason: not valid java name and from getter */
public final String getValue() {
return this.value;
}
public final String domain() {
return this.domain;
}
public final long expiresAt() {
return this.expiresAt;
}
public final boolean hostOnly() {
return this.hostOnly;
}
public final boolean httpOnly() {
return this.httpOnly;
}
public final String name() {
return this.name;
}
public final String path() {
return this.path;
}
public final boolean persistent() {
return this.persistent;
}
public final boolean secure() {
return this.secure;
}
public final String value() {
return this.value;
}
private Cookie(String str, String str2, long j, String str3, String str4, boolean z, boolean z2, boolean z3, boolean z4) {
this.name = str;
this.value = str2;
this.expiresAt = j;
this.domain = str3;
this.path = str4;
this.secure = z;
this.httpOnly = z2;
this.persistent = z3;
this.hostOnly = z4;
}
public /* synthetic */ Cookie(String str, String str2, long j, String str3, String str4, boolean z, boolean z2, boolean z3, boolean z4, DefaultConstructorMarker defaultConstructorMarker) {
this(str, str2, j, str3, str4, z, z2, z3, z4);
}
public final boolean matches(HttpUrl url) {
boolean domainMatch;
Intrinsics.checkNotNullParameter(url, "url");
if (this.hostOnly) {
domainMatch = Intrinsics.areEqual(url.host(), this.domain);
} else {
domainMatch = INSTANCE.domainMatch(url.host(), this.domain);
}
if (domainMatch && INSTANCE.pathMatch(url, this.path)) {
return !this.secure || url.getIsHttps();
}
return false;
}
public boolean equals(Object other) {
if (other instanceof Cookie) {
Cookie cookie = (Cookie) other;
if (Intrinsics.areEqual(cookie.name, this.name) && Intrinsics.areEqual(cookie.value, this.value) && cookie.expiresAt == this.expiresAt && Intrinsics.areEqual(cookie.domain, this.domain) && Intrinsics.areEqual(cookie.path, this.path) && cookie.secure == this.secure && cookie.httpOnly == this.httpOnly && cookie.persistent == this.persistent && cookie.hostOnly == this.hostOnly) {
return true;
}
}
return false;
}
public int hashCode() {
return ((((((((((((((((527 + this.name.hashCode()) * 31) + this.value.hashCode()) * 31) + Long.hashCode(this.expiresAt)) * 31) + this.domain.hashCode()) * 31) + this.path.hashCode()) * 31) + Boolean.hashCode(this.secure)) * 31) + Boolean.hashCode(this.httpOnly)) * 31) + Boolean.hashCode(this.persistent)) * 31) + Boolean.hashCode(this.hostOnly);
}
public String toString() {
return toString$okhttp(false);
}
public final String toString$okhttp(boolean forObsoleteRfc2965) {
StringBuilder sb = new StringBuilder();
sb.append(this.name);
sb.append('=');
sb.append(this.value);
if (this.persistent) {
if (this.expiresAt == Long.MIN_VALUE) {
sb.append("; max-age=0");
} else {
sb.append("; expires=").append(DatesKt.toHttpDateString(new Date(this.expiresAt)));
}
}
if (!this.hostOnly) {
sb.append("; domain=");
if (forObsoleteRfc2965) {
sb.append(".");
}
sb.append(this.domain);
}
sb.append("; path=").append(this.path);
if (this.secure) {
sb.append("; secure");
}
if (this.httpOnly) {
sb.append("; httponly");
}
String sb2 = sb.toString();
Intrinsics.checkNotNullExpressionValue(sb2, "toString()");
return sb2;
}
/* compiled from: Cookie.kt */
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0002\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0006\u0010\u000f\u001a\u00020\u0010J\u000e\u0010\u0003\u001a\u00020\u00002\u0006\u0010\u0003\u001a\u00020\u0004J\u0018\u0010\u0003\u001a\u00020\u00002\u0006\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\bH\u0002J\u000e\u0010\u0005\u001a\u00020\u00002\u0006\u0010\u0005\u001a\u00020\u0006J\u000e\u0010\u0011\u001a\u00020\u00002\u0006\u0010\u0003\u001a\u00020\u0004J\u0006\u0010\t\u001a\u00020\u0000J\u000e\u0010\n\u001a\u00020\u00002\u0006\u0010\n\u001a\u00020\u0004J\u000e\u0010\u000b\u001a\u00020\u00002\u0006\u0010\u000b\u001a\u00020\u0004J\u0006\u0010\r\u001a\u00020\u0000J\u000e\u0010\u000e\u001a\u00020\u00002\u0006\u0010\u000e\u001a\u00020\u0004R\u0010\u0010\u0003\u001a\u0004\u0018\u00010\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\n\u001a\u0004\u0018\u00010\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\u000e\u001a\u0004\u0018\u00010\u0004X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0012"}, d2 = {"Lokhttp3/Cookie$Builder;", "", "()V", "domain", "", "expiresAt", "", "hostOnly", "", "httpOnly", "name", "path", "persistent", "secure", "value", OperatingSystem.JsonKeys.BUILD, "Lokhttp3/Cookie;", "hostOnlyDomain", "okhttp"}, k = 1, mv = {1, 4, 0})
/* loaded from: classes3.dex */
public static final class Builder {
private String domain;
private boolean hostOnly;
private boolean httpOnly;
private String name;
private boolean persistent;
private boolean secure;
private String value;
private long expiresAt = DatesKt.MAX_DATE;
private String path = "/";
public final Builder name(String name) {
Intrinsics.checkNotNullParameter(name, "name");
if (!Intrinsics.areEqual(StringsKt.trim((CharSequence) name).toString(), name)) {
throw new IllegalArgumentException("name is not trimmed".toString());
}
this.name = name;
return this;
}
public final Builder value(String value) {
Intrinsics.checkNotNullParameter(value, "value");
if (!Intrinsics.areEqual(StringsKt.trim((CharSequence) value).toString(), value)) {
throw new IllegalArgumentException("value is not trimmed".toString());
}
this.value = value;
return this;
}
public final Builder expiresAt(long expiresAt) {
if (expiresAt <= 0) {
expiresAt = Long.MIN_VALUE;
}
if (expiresAt > DatesKt.MAX_DATE) {
expiresAt = 253402300799999L;
}
this.expiresAt = expiresAt;
this.persistent = true;
return this;
}
public final Builder domain(String domain) {
Intrinsics.checkNotNullParameter(domain, "domain");
return domain(domain, false);
}
public final Builder hostOnlyDomain(String domain) {
Intrinsics.checkNotNullParameter(domain, "domain");
return domain(domain, true);
}
private final Builder domain(String domain, boolean hostOnly) {
String canonicalHost = HostnamesKt.toCanonicalHost(domain);
if (canonicalHost == null) {
throw new IllegalArgumentException("unexpected domain: " + domain);
}
this.domain = canonicalHost;
this.hostOnly = hostOnly;
return this;
}
public final Builder path(String path) {
Intrinsics.checkNotNullParameter(path, "path");
if (!StringsKt.startsWith$default(path, "/", false, 2, (Object) null)) {
throw new IllegalArgumentException("path must start with '/'".toString());
}
this.path = path;
return this;
}
public final Builder secure() {
this.secure = true;
return this;
}
public final Builder httpOnly() {
this.httpOnly = true;
return this;
}
public final Cookie build() {
String str = this.name;
if (str == null) {
throw new NullPointerException("builder.name == null");
}
String str2 = this.value;
if (str2 == null) {
throw new NullPointerException("builder.value == null");
}
long j = this.expiresAt;
String str3 = this.domain;
if (str3 != null) {
return new Cookie(str, str2, j, str3, this.path, this.secure, this.httpOnly, this.persistent, this.hostOnly, null);
}
throw new NullPointerException("builder.domain == null");
}
}
/* compiled from: Cookie.kt */
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000L\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010 \n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J(\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\n2\u0006\u0010\u000e\u001a\u00020\n2\u0006\u0010\u000f\u001a\u00020\u0010H\u0002J\u0018\u0010\u0011\u001a\u00020\u00102\u0006\u0010\u0012\u001a\u00020\f2\u0006\u0010\u0013\u001a\u00020\fH\u0002J'\u0010\u0014\u001a\u0004\u0018\u00010\u00152\u0006\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u0018\u001a\u00020\u00192\u0006\u0010\u001a\u001a\u00020\fH\u0000¢\u0006\u0002\b\u001bJ\u001a\u0010\u0014\u001a\u0004\u0018\u00010\u00152\u0006\u0010\u0018\u001a\u00020\u00192\u0006\u0010\u001a\u001a\u00020\fH\u0007J\u001e\u0010\u001c\u001a\b\u0012\u0004\u0012\u00020\u00150\u001d2\u0006\u0010\u0018\u001a\u00020\u00192\u0006\u0010\u001e\u001a\u00020\u001fH\u0007J\u0010\u0010 \u001a\u00020\f2\u0006\u0010!\u001a\u00020\fH\u0002J \u0010\"\u001a\u00020\u00172\u0006\u0010!\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\n2\u0006\u0010\u000e\u001a\u00020\nH\u0002J\u0010\u0010#\u001a\u00020\u00172\u0006\u0010!\u001a\u00020\fH\u0002J\u0018\u0010$\u001a\u00020\u00102\u0006\u0010\u0018\u001a\u00020\u00192\u0006\u0010%\u001a\u00020\fH\u0002R\u0016\u0010\u0003\u001a\n \u0005*\u0004\u0018\u00010\u00040\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0016\u0010\u0006\u001a\n \u0005*\u0004\u0018\u00010\u00040\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0016\u0010\u0007\u001a\n \u0005*\u0004\u0018\u00010\u00040\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0016\u0010\b\u001a\n \u0005*\u0004\u0018\u00010\u00040\u0004X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006&"}, d2 = {"Lokhttp3/Cookie$Companion;", "", "()V", "DAY_OF_MONTH_PATTERN", "Ljava/util/regex/Pattern;", "kotlin.jvm.PlatformType", "MONTH_PATTERN", "TIME_PATTERN", "YEAR_PATTERN", "dateCharacterOffset", "", "input", "", "pos", "limit", "invert", "", "domainMatch", "urlHost", "domain", "parse", "Lokhttp3/Cookie;", "currentTimeMillis", "", Request.JsonKeys.URL, "Lokhttp3/HttpUrl;", "setCookie", "parse$okhttp", "parseAll", "", "headers", "Lokhttp3/Headers;", "parseDomain", CmcdHeadersFactory.STREAMING_FORMAT_SS, "parseExpires", "parseMaxAge", "pathMatch", "path", "okhttp"}, k = 1, mv = {1, 4, 0})
/* loaded from: classes3.dex */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean domainMatch(String urlHost, String domain) {
if (Intrinsics.areEqual(urlHost, domain)) {
return true;
}
return StringsKt.endsWith$default(urlHost, domain, false, 2, (Object) null) && urlHost.charAt((urlHost.length() - domain.length()) - 1) == '.' && !Util.canParseAsIpAddress(urlHost);
}
/* JADX INFO: Access modifiers changed from: private */
public final boolean pathMatch(HttpUrl url, String path) {
String encodedPath = url.encodedPath();
if (Intrinsics.areEqual(encodedPath, path)) {
return true;
}
return StringsKt.startsWith$default(encodedPath, path, false, 2, (Object) null) && (StringsKt.endsWith$default(path, "/", false, 2, (Object) null) || encodedPath.charAt(path.length()) == '/');
}
@JvmStatic
public final Cookie parse(HttpUrl url, String setCookie) {
Intrinsics.checkNotNullParameter(url, "url");
Intrinsics.checkNotNullParameter(setCookie, "setCookie");
return parse$okhttp(System.currentTimeMillis(), url, setCookie);
}
/* JADX WARN: Code restructure failed: missing block: B:86:0x010c, code lost:
if (r1 > okhttp3.internal.http.DatesKt.MAX_DATE) goto L57;
*/
/* JADX WARN: Removed duplicated region for block: B:54:0x011e */
/* JADX WARN: Removed duplicated region for block: B:69:0x0169 */
/* JADX WARN: Removed duplicated region for block: B:74:0x0121 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final okhttp3.Cookie parse$okhttp(long r26, okhttp3.HttpUrl r28, java.lang.String r29) {
/*
Method dump skipped, instructions count: 392
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.Cookie.Companion.parse$okhttp(long, okhttp3.HttpUrl, java.lang.String):okhttp3.Cookie");
}
private final long parseExpires(String s, int pos, int limit) {
int dateCharacterOffset = dateCharacterOffset(s, pos, limit, false);
Matcher matcher = Cookie.TIME_PATTERN.matcher(s);
int i = -1;
int i2 = -1;
int i3 = -1;
int i4 = -1;
int i5 = -1;
int i6 = -1;
while (dateCharacterOffset < limit) {
int dateCharacterOffset2 = dateCharacterOffset(s, dateCharacterOffset + 1, limit, true);
matcher.region(dateCharacterOffset, dateCharacterOffset2);
if (i2 == -1 && matcher.usePattern(Cookie.TIME_PATTERN).matches()) {
String group = matcher.group(1);
Intrinsics.checkNotNullExpressionValue(group, "matcher.group(1)");
i2 = Integer.parseInt(group);
String group2 = matcher.group(2);
Intrinsics.checkNotNullExpressionValue(group2, "matcher.group(2)");
i5 = Integer.parseInt(group2);
String group3 = matcher.group(3);
Intrinsics.checkNotNullExpressionValue(group3, "matcher.group(3)");
i6 = Integer.parseInt(group3);
} else if (i3 == -1 && matcher.usePattern(Cookie.DAY_OF_MONTH_PATTERN).matches()) {
String group4 = matcher.group(1);
Intrinsics.checkNotNullExpressionValue(group4, "matcher.group(1)");
i3 = Integer.parseInt(group4);
} else if (i4 == -1 && matcher.usePattern(Cookie.MONTH_PATTERN).matches()) {
String group5 = matcher.group(1);
Intrinsics.checkNotNullExpressionValue(group5, "matcher.group(1)");
Locale locale = Locale.US;
Intrinsics.checkNotNullExpressionValue(locale, "Locale.US");
if (group5 == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
String lowerCase = group5.toLowerCase(locale);
Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase(locale)");
String pattern = Cookie.MONTH_PATTERN.pattern();
Intrinsics.checkNotNullExpressionValue(pattern, "MONTH_PATTERN.pattern()");
i4 = StringsKt.indexOf$default((CharSequence) pattern, lowerCase, 0, false, 6, (Object) null) / 4;
} else if (i == -1 && matcher.usePattern(Cookie.YEAR_PATTERN).matches()) {
String group6 = matcher.group(1);
Intrinsics.checkNotNullExpressionValue(group6, "matcher.group(1)");
i = Integer.parseInt(group6);
}
dateCharacterOffset = dateCharacterOffset(s, dateCharacterOffset2 + 1, limit, false);
}
if (70 <= i && 99 >= i) {
i += 1900;
}
if (i >= 0 && 69 >= i) {
i += 2000;
}
if (!(i >= 1601)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
if (!(i4 != -1)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
if (!(1 <= i3 && 31 >= i3)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
if (!(i2 >= 0 && 23 >= i2)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
if (!(i5 >= 0 && 59 >= i5)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
if (!(i6 >= 0 && 59 >= i6)) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
GregorianCalendar gregorianCalendar = new GregorianCalendar(Util.UTC);
gregorianCalendar.setLenient(false);
gregorianCalendar.set(1, i);
gregorianCalendar.set(2, i4 - 1);
gregorianCalendar.set(5, i3);
gregorianCalendar.set(11, i2);
gregorianCalendar.set(12, i5);
gregorianCalendar.set(13, i6);
gregorianCalendar.set(14, 0);
return gregorianCalendar.getTimeInMillis();
}
private final int dateCharacterOffset(String input, int pos, int limit, boolean invert) {
while (pos < limit) {
char charAt = input.charAt(pos);
if (((charAt < ' ' && charAt != '\t') || charAt >= 127 || ('0' <= charAt && '9' >= charAt) || (('a' <= charAt && 'z' >= charAt) || (('A' <= charAt && 'Z' >= charAt) || charAt == ':'))) == (!invert)) {
return pos;
}
pos++;
}
return limit;
}
private final long parseMaxAge(String s) {
try {
long parseLong = Long.parseLong(s);
if (parseLong <= 0) {
return Long.MIN_VALUE;
}
return parseLong;
} catch (NumberFormatException e) {
if (new Regex("-?\\d+").matches(s)) {
return StringsKt.startsWith$default(s, "-", false, 2, (Object) null) ? Long.MIN_VALUE : Long.MAX_VALUE;
}
throw e;
}
}
private final String parseDomain(String s) {
if (!(!StringsKt.endsWith$default(s, ".", false, 2, (Object) null))) {
throw new IllegalArgumentException("Failed requirement.".toString());
}
String canonicalHost = HostnamesKt.toCanonicalHost(StringsKt.removePrefix(s, (CharSequence) "."));
if (canonicalHost != null) {
return canonicalHost;
}
throw new IllegalArgumentException();
}
@JvmStatic
public final List<Cookie> parseAll(HttpUrl url, Headers headers) {
Intrinsics.checkNotNullParameter(url, "url");
Intrinsics.checkNotNullParameter(headers, "headers");
List<String> values = headers.values(HttpHeaders.SET_COOKIE);
ArrayList arrayList = null;
int size = values.size();
for (int i = 0; i < size; i++) {
Cookie parse = parse(url, values.get(i));
if (parse != null) {
if (arrayList == null) {
arrayList = new ArrayList();
}
arrayList.add(parse);
}
}
if (arrayList != null) {
List<Cookie> unmodifiableList = Collections.unmodifiableList(arrayList);
Intrinsics.checkNotNullExpressionValue(unmodifiableList, "Collections.unmodifiableList(cookies)");
return unmodifiableList;
}
return CollectionsKt.emptyList();
}
}
}