Files
rr3-apk/decompiled/sources/okhttp3/Cookie.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

255 lines
9.2 KiB
Java

package okhttp3;
import com.ironsource.mediationsdk.logger.IronSourceError;
import com.ironsource.nb;
import csdk.gluads.Consts;
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 okhttp3.internal.Util;
import okhttp3.internal.http.HttpDate;
import org.apache.http.cookie.SM;
/* loaded from: classes5.dex */
public final class Cookie {
public final String domain;
public final long expiresAt;
public final boolean hostOnly;
public final boolean httpOnly;
public final String name;
public final String path;
public final boolean persistent;
public final boolean secure;
public final String value;
public static final Pattern YEAR_PATTERN = Pattern.compile("(\\d{2,4})[^\\d]*");
public static final Pattern MONTH_PATTERN = Pattern.compile("(?i)(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec).*");
public static final Pattern DAY_OF_MONTH_PATTERN = Pattern.compile("(\\d{1,2})[^\\d]*");
public static final Pattern TIME_PATTERN = Pattern.compile("(\\d{1,2}):(\\d{1,2}):(\\d{1,2})[^\\d]*");
public String name() {
return this.name;
}
public String value() {
return this.value;
}
public 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.hostOnly = z3;
this.persistent = z4;
}
public static boolean domainMatch(String str, String str2) {
if (str.equals(str2)) {
return true;
}
return str.endsWith(str2) && str.charAt((str.length() - str2.length()) - 1) == '.' && !Util.verifyAsIpAddress(str);
}
public static Cookie parse(HttpUrl httpUrl, String str) {
return parse(System.currentTimeMillis(), httpUrl, str);
}
/* JADX WARN: Removed duplicated region for block: B:54:0x00ee */
/* JADX WARN: Removed duplicated region for block: B:69:0x0129 */
/* JADX WARN: Removed duplicated region for block: B:71:0x00f1 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static okhttp3.Cookie parse(long r23, okhttp3.HttpUrl r25, java.lang.String r26) {
/*
Method dump skipped, instructions count: 310
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.Cookie.parse(long, okhttp3.HttpUrl, java.lang.String):okhttp3.Cookie");
}
public static long parseExpires(String str, int i, int i2) {
int dateCharacterOffset = dateCharacterOffset(str, i, i2, false);
Matcher matcher = TIME_PATTERN.matcher(str);
int i3 = -1;
int i4 = -1;
int i5 = -1;
int i6 = -1;
int i7 = -1;
int i8 = -1;
while (dateCharacterOffset < i2) {
int dateCharacterOffset2 = dateCharacterOffset(str, dateCharacterOffset + 1, i2, true);
matcher.region(dateCharacterOffset, dateCharacterOffset2);
if (i4 == -1 && matcher.usePattern(TIME_PATTERN).matches()) {
i4 = Integer.parseInt(matcher.group(1));
i7 = Integer.parseInt(matcher.group(2));
i8 = Integer.parseInt(matcher.group(3));
} else if (i5 == -1 && matcher.usePattern(DAY_OF_MONTH_PATTERN).matches()) {
i5 = Integer.parseInt(matcher.group(1));
} else {
if (i6 == -1) {
Pattern pattern = MONTH_PATTERN;
if (matcher.usePattern(pattern).matches()) {
i6 = pattern.pattern().indexOf(matcher.group(1).toLowerCase(Locale.US)) / 4;
}
}
if (i3 == -1 && matcher.usePattern(YEAR_PATTERN).matches()) {
i3 = Integer.parseInt(matcher.group(1));
}
}
dateCharacterOffset = dateCharacterOffset(str, dateCharacterOffset2 + 1, i2, false);
}
if (i3 >= 70 && i3 <= 99) {
i3 += 1900;
}
if (i3 >= 0 && i3 <= 69) {
i3 += 2000;
}
if (i3 < 1601) {
throw new IllegalArgumentException();
}
if (i6 == -1) {
throw new IllegalArgumentException();
}
if (i5 < 1 || i5 > 31) {
throw new IllegalArgumentException();
}
if (i4 < 0 || i4 > 23) {
throw new IllegalArgumentException();
}
if (i7 < 0 || i7 > 59) {
throw new IllegalArgumentException();
}
if (i8 < 0 || i8 > 59) {
throw new IllegalArgumentException();
}
GregorianCalendar gregorianCalendar = new GregorianCalendar(Util.UTC);
gregorianCalendar.setLenient(false);
gregorianCalendar.set(1, i3);
gregorianCalendar.set(2, i6 - 1);
gregorianCalendar.set(5, i5);
gregorianCalendar.set(11, i4);
gregorianCalendar.set(12, i7);
gregorianCalendar.set(13, i8);
gregorianCalendar.set(14, 0);
return gregorianCalendar.getTimeInMillis();
}
public static int dateCharacterOffset(String str, int i, int i2, boolean z) {
while (i < i2) {
char charAt = str.charAt(i);
if (((charAt < ' ' && charAt != '\t') || charAt >= 127 || (charAt >= '0' && charAt <= '9') || ((charAt >= 'a' && charAt <= 'z') || ((charAt >= 'A' && charAt <= 'Z') || charAt == ':'))) == (!z)) {
return i;
}
i++;
}
return i2;
}
public static long parseMaxAge(String str) {
try {
long parseLong = Long.parseLong(str);
if (parseLong <= 0) {
return Long.MIN_VALUE;
}
return parseLong;
} catch (NumberFormatException e) {
if (str.matches("-?\\d+")) {
return str.startsWith("-") ? Long.MIN_VALUE : Long.MAX_VALUE;
}
throw e;
}
}
public static String parseDomain(String str) {
if (str.endsWith(Consts.STRING_PERIOD)) {
throw new IllegalArgumentException();
}
if (str.startsWith(Consts.STRING_PERIOD)) {
str = str.substring(1);
}
String canonicalizeHost = Util.canonicalizeHost(str);
if (canonicalizeHost != null) {
return canonicalizeHost;
}
throw new IllegalArgumentException();
}
public static List parseAll(HttpUrl httpUrl, Headers headers) {
List values = headers.values(SM.SET_COOKIE);
int size = values.size();
ArrayList arrayList = null;
for (int i = 0; i < size; i++) {
Cookie parse = parse(httpUrl, (String) values.get(i));
if (parse != null) {
if (arrayList == null) {
arrayList = new ArrayList();
}
arrayList.add(parse);
}
}
if (arrayList != null) {
return Collections.unmodifiableList(arrayList);
}
return Collections.emptyList();
}
public String toString() {
return toString(false);
}
public String toString(boolean z) {
StringBuilder sb = new StringBuilder();
sb.append(this.name);
sb.append(nb.T);
sb.append(this.value);
if (this.persistent) {
if (this.expiresAt == Long.MIN_VALUE) {
sb.append("; max-age=0");
} else {
sb.append("; expires=");
sb.append(HttpDate.format(new Date(this.expiresAt)));
}
}
if (!this.hostOnly) {
sb.append("; domain=");
if (z) {
sb.append(Consts.STRING_PERIOD);
}
sb.append(this.domain);
}
sb.append("; path=");
sb.append(this.path);
if (this.secure) {
sb.append("; secure");
}
if (this.httpOnly) {
sb.append("; httponly");
}
return sb.toString();
}
public boolean equals(Object obj) {
if (!(obj instanceof Cookie)) {
return false;
}
Cookie cookie = (Cookie) obj;
return cookie.name.equals(this.name) && cookie.value.equals(this.value) && cookie.domain.equals(this.domain) && cookie.path.equals(this.path) && cookie.expiresAt == this.expiresAt && cookie.secure == this.secure && cookie.httpOnly == this.httpOnly && cookie.persistent == this.persistent && cookie.hostOnly == this.hostOnly;
}
public int hashCode() {
int hashCode = (((((((IronSourceError.ERROR_NON_EXISTENT_INSTANCE + this.name.hashCode()) * 31) + this.value.hashCode()) * 31) + this.domain.hashCode()) * 31) + this.path.hashCode()) * 31;
long j = this.expiresAt;
return ((((((((hashCode + ((int) (j ^ (j >>> 32)))) * 31) + (!this.secure ? 1 : 0)) * 31) + (!this.httpOnly ? 1 : 0)) * 31) + (!this.persistent ? 1 : 0)) * 31) + (!this.hostOnly ? 1 : 0);
}
}