1307 lines
47 KiB
Java
1307 lines
47 KiB
Java
package okhttp3.repackaged;
|
|
|
|
import com.google.common.primitives.UnsignedBytes;
|
|
import io.grpc.internal.GrpcUtil;
|
|
import java.net.InetAddress;
|
|
import java.net.MalformedURLException;
|
|
import java.net.URI;
|
|
import java.net.URISyntaxException;
|
|
import java.net.URL;
|
|
import java.net.UnknownHostException;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashSet;
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
import o.giM;
|
|
import okhttp3.repackaged.internal.Util;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public final class HttpUrl {
|
|
static final String FORM_ENCODE_SET = " \"':;<=>@[]^`{}|/\\?#&!$(),~";
|
|
static final String FRAGMENT_ENCODE_SET = "";
|
|
static final String FRAGMENT_ENCODE_SET_URI = " \"#<>\\^`{|}";
|
|
private static final char[] HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
|
static final String PASSWORD_ENCODE_SET = " \"':;<=>@[]^`{}|/\\?#";
|
|
static final String PATH_SEGMENT_ENCODE_SET = " \"<>^`{}|/\\?#";
|
|
static final String PATH_SEGMENT_ENCODE_SET_URI = "[]";
|
|
static final String QUERY_COMPONENT_ENCODE_SET = " \"'<>#&=";
|
|
static final String QUERY_COMPONENT_ENCODE_SET_URI = "\\^`{|}";
|
|
static final String QUERY_ENCODE_SET = " \"'<>#";
|
|
static final String USERNAME_ENCODE_SET = " \"':;<=>@[]^`{}|/\\?#";
|
|
private final List<String> ahL;
|
|
private final List<String> ahM;
|
|
private final String fragment;
|
|
private final String host;
|
|
private final String password;
|
|
private final int port;
|
|
private final String scheme;
|
|
private final String url;
|
|
private final String username;
|
|
|
|
static int decodeHexDigit(char c) {
|
|
if (c >= '0' && c <= '9') {
|
|
return c - '0';
|
|
}
|
|
if (c >= 'a' && c <= 'f') {
|
|
return c - 'W';
|
|
}
|
|
if (c < 'A' || c > 'F') {
|
|
return -1;
|
|
}
|
|
return c - '7';
|
|
}
|
|
|
|
/* synthetic */ HttpUrl(Builder builder, AnonymousClass1 anonymousClass1) {
|
|
this(builder);
|
|
}
|
|
|
|
private HttpUrl(Builder builder) {
|
|
this.scheme = builder.scheme;
|
|
this.username = percentDecode(builder.encodedUsername, false);
|
|
this.password = percentDecode(builder.encodedPassword, false);
|
|
this.host = builder.host;
|
|
this.port = builder.effectivePort();
|
|
this.ahL = a(builder.encodedPathSegments, false);
|
|
this.ahM = builder.encodedQueryNamesAndValues != null ? a(builder.encodedQueryNamesAndValues, true) : null;
|
|
this.fragment = builder.encodedFragment != null ? percentDecode(builder.encodedFragment, false) : null;
|
|
this.url = builder.toString();
|
|
}
|
|
|
|
public final URL url() {
|
|
try {
|
|
return new URL(this.url);
|
|
} catch (MalformedURLException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
|
|
public final URI uri() {
|
|
String obj = newBuilder().uo().toString();
|
|
try {
|
|
return new URI(obj);
|
|
} catch (URISyntaxException e) {
|
|
try {
|
|
return URI.create(obj.replaceAll("[\\u0000-\\u001F\\u007F-\\u009F\\p{javaWhitespace}]", ""));
|
|
} catch (Exception unused) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
}
|
|
|
|
public final boolean isHttps() {
|
|
return this.scheme.equals("https");
|
|
}
|
|
|
|
public final String encodedUsername() {
|
|
if (this.username.isEmpty()) {
|
|
return "";
|
|
}
|
|
int length = this.scheme.length() + 3;
|
|
String str = this.url;
|
|
return this.url.substring(length, Util.delimiterOffset(str, length, str.length(), ":@"));
|
|
}
|
|
|
|
public final String encodedPassword() {
|
|
if (this.password.isEmpty()) {
|
|
return "";
|
|
}
|
|
int indexOf = this.url.indexOf(58, this.scheme.length() + 3);
|
|
return this.url.substring(indexOf + 1, this.url.indexOf(64));
|
|
}
|
|
|
|
public static int defaultPort(String str) {
|
|
if (str.equals("http")) {
|
|
return 80;
|
|
}
|
|
if (str.equals("https")) {
|
|
return GrpcUtil.DEFAULT_PORT_SSL;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
public final int pathSize() {
|
|
return this.ahL.size();
|
|
}
|
|
|
|
public final String encodedPath() {
|
|
int indexOf = this.url.indexOf(47, this.scheme.length() + 3);
|
|
String str = this.url;
|
|
return this.url.substring(indexOf, Util.delimiterOffset(str, indexOf, str.length(), "?#"));
|
|
}
|
|
|
|
static void pathSegmentsToString(StringBuilder sb, List<String> list) {
|
|
int size = list.size();
|
|
for (int i = 0; i < size; i++) {
|
|
sb.append('/');
|
|
sb.append(list.get(i));
|
|
}
|
|
}
|
|
|
|
public final List<String> encodedPathSegments() {
|
|
int indexOf = this.url.indexOf(47, this.scheme.length() + 3);
|
|
String str = this.url;
|
|
int delimiterOffset = Util.delimiterOffset(str, indexOf, str.length(), "?#");
|
|
ArrayList arrayList = new ArrayList();
|
|
while (indexOf < delimiterOffset) {
|
|
int i = indexOf + 1;
|
|
int delimiterOffset2 = Util.delimiterOffset(this.url, i, delimiterOffset, '/');
|
|
arrayList.add(this.url.substring(i, delimiterOffset2));
|
|
indexOf = delimiterOffset2;
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public final String encodedQuery() {
|
|
if (this.ahM == null) {
|
|
return null;
|
|
}
|
|
int indexOf = this.url.indexOf(63);
|
|
String str = this.url;
|
|
return this.url.substring(indexOf + 1, Util.delimiterOffset(str, indexOf + 2, str.length(), '#'));
|
|
}
|
|
|
|
static void namesAndValuesToQueryString(StringBuilder sb, List<String> list) {
|
|
int size = list.size();
|
|
for (int i = 0; i < size; i += 2) {
|
|
String str = list.get(i);
|
|
String str2 = list.get(i + 1);
|
|
if (i > 0) {
|
|
sb.append('&');
|
|
}
|
|
sb.append(str);
|
|
if (str2 != null) {
|
|
sb.append('=');
|
|
sb.append(str2);
|
|
}
|
|
}
|
|
}
|
|
|
|
static List<String> queryStringToNamesAndValues(String str) {
|
|
ArrayList arrayList = new ArrayList();
|
|
int i = 0;
|
|
while (i <= str.length()) {
|
|
int indexOf = str.indexOf(38, i);
|
|
if (indexOf == -1) {
|
|
indexOf = str.length();
|
|
}
|
|
int indexOf2 = str.indexOf(61, i);
|
|
if (indexOf2 == -1 || indexOf2 > indexOf) {
|
|
arrayList.add(str.substring(i, indexOf));
|
|
arrayList.add(null);
|
|
} else {
|
|
arrayList.add(str.substring(i, indexOf2));
|
|
arrayList.add(str.substring(indexOf2 + 1, indexOf));
|
|
}
|
|
i = indexOf + 1;
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
public final String query() {
|
|
if (this.ahM == null) {
|
|
return null;
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
namesAndValuesToQueryString(sb, this.ahM);
|
|
return sb.toString();
|
|
}
|
|
|
|
public final int querySize() {
|
|
List<String> list = this.ahM;
|
|
if (list != null) {
|
|
return list.size() / 2;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public final String queryParameter(String str) {
|
|
List<String> list = this.ahM;
|
|
if (list == null) {
|
|
return null;
|
|
}
|
|
int size = list.size();
|
|
for (int i = 0; i < size; i += 2) {
|
|
if (str.equals(this.ahM.get(i))) {
|
|
return this.ahM.get(i + 1);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public final Set<String> queryParameterNames() {
|
|
if (this.ahM == null) {
|
|
return Collections.emptySet();
|
|
}
|
|
LinkedHashSet linkedHashSet = new LinkedHashSet();
|
|
int size = this.ahM.size();
|
|
for (int i = 0; i < size; i += 2) {
|
|
linkedHashSet.add(this.ahM.get(i));
|
|
}
|
|
return Collections.unmodifiableSet(linkedHashSet);
|
|
}
|
|
|
|
public final List<String> queryParameterValues(String str) {
|
|
if (this.ahM == null) {
|
|
return Collections.emptyList();
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
int size = this.ahM.size();
|
|
for (int i = 0; i < size; i += 2) {
|
|
if (str.equals(this.ahM.get(i))) {
|
|
arrayList.add(this.ahM.get(i + 1));
|
|
}
|
|
}
|
|
return Collections.unmodifiableList(arrayList);
|
|
}
|
|
|
|
public final String queryParameterName(int i) {
|
|
return this.ahM.get(i << 1);
|
|
}
|
|
|
|
public final String queryParameterValue(int i) {
|
|
return this.ahM.get((i << 1) + 1);
|
|
}
|
|
|
|
public final String encodedFragment() {
|
|
if (this.fragment == null) {
|
|
return null;
|
|
}
|
|
return this.url.substring(this.url.indexOf(35) + 1);
|
|
}
|
|
|
|
public final HttpUrl resolve(String str) {
|
|
Builder newBuilder = newBuilder(str);
|
|
if (newBuilder != null) {
|
|
return newBuilder.build();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public final Builder newBuilder() {
|
|
Builder builder = new Builder();
|
|
builder.scheme = this.scheme;
|
|
builder.encodedUsername = encodedUsername();
|
|
builder.encodedPassword = encodedPassword();
|
|
builder.host = this.host;
|
|
builder.port = this.port != defaultPort(this.scheme) ? this.port : -1;
|
|
builder.encodedPathSegments.clear();
|
|
builder.encodedPathSegments.addAll(encodedPathSegments());
|
|
builder.encodedQuery(encodedQuery());
|
|
builder.encodedFragment = encodedFragment();
|
|
return builder;
|
|
}
|
|
|
|
public final Builder newBuilder(String str) {
|
|
Builder builder = new Builder();
|
|
if (builder.c(this, str) == Builder.a.SUCCESS) {
|
|
return builder;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static HttpUrl parse(String str) {
|
|
Builder builder = new Builder();
|
|
if (builder.c(null, str) == Builder.a.SUCCESS) {
|
|
return builder.build();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static HttpUrl get(URL url) {
|
|
return parse(url.toString());
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static HttpUrl aU(String str) throws MalformedURLException, UnknownHostException {
|
|
Builder builder = new Builder();
|
|
Builder.a c = builder.c(null, str);
|
|
int i = AnonymousClass1.$SwitchMap$okhttp3$HttpUrl$Builder$ParseResult[c.ordinal()];
|
|
if (i == 1) {
|
|
return builder.build();
|
|
}
|
|
if (i == 2) {
|
|
throw new UnknownHostException("Invalid host: ".concat(String.valueOf(str)));
|
|
}
|
|
StringBuilder sb = new StringBuilder("Invalid URL: ");
|
|
sb.append(c);
|
|
sb.append(" for ");
|
|
sb.append(str);
|
|
throw new MalformedURLException(sb.toString());
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* renamed from: okhttp3.repackaged.HttpUrl$1, reason: invalid class name */
|
|
/* loaded from: classes6.dex */
|
|
public static /* synthetic */ class AnonymousClass1 {
|
|
static final int[] $SwitchMap$okhttp3$HttpUrl$Builder$ParseResult;
|
|
|
|
static {
|
|
int[] iArr = new int[Builder.a.values().length];
|
|
$SwitchMap$okhttp3$HttpUrl$Builder$ParseResult = iArr;
|
|
try {
|
|
iArr[Builder.a.SUCCESS.ordinal()] = 1;
|
|
} catch (NoSuchFieldError unused) {
|
|
}
|
|
try {
|
|
$SwitchMap$okhttp3$HttpUrl$Builder$ParseResult[Builder.a.INVALID_HOST.ordinal()] = 2;
|
|
} catch (NoSuchFieldError unused2) {
|
|
}
|
|
try {
|
|
$SwitchMap$okhttp3$HttpUrl$Builder$ParseResult[Builder.a.UNSUPPORTED_SCHEME.ordinal()] = 3;
|
|
} catch (NoSuchFieldError unused3) {
|
|
}
|
|
try {
|
|
$SwitchMap$okhttp3$HttpUrl$Builder$ParseResult[Builder.a.MISSING_SCHEME.ordinal()] = 4;
|
|
} catch (NoSuchFieldError unused4) {
|
|
}
|
|
try {
|
|
$SwitchMap$okhttp3$HttpUrl$Builder$ParseResult[Builder.a.INVALID_PORT.ordinal()] = 5;
|
|
} catch (NoSuchFieldError unused5) {
|
|
}
|
|
}
|
|
}
|
|
|
|
public static HttpUrl get(URI uri) {
|
|
return parse(uri.toString());
|
|
}
|
|
|
|
public final boolean equals(Object obj) {
|
|
return (obj instanceof HttpUrl) && ((HttpUrl) obj).url.equals(this.url);
|
|
}
|
|
|
|
public final int hashCode() {
|
|
return this.url.hashCode();
|
|
}
|
|
|
|
/* loaded from: classes6.dex */
|
|
public static final class Builder {
|
|
String encodedFragment;
|
|
final List<String> encodedPathSegments;
|
|
List<String> encodedQueryNamesAndValues;
|
|
String host;
|
|
String scheme;
|
|
String encodedUsername = "";
|
|
String encodedPassword = "";
|
|
int port = -1;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes6.dex */
|
|
public enum a {
|
|
SUCCESS,
|
|
MISSING_SCHEME,
|
|
UNSUPPORTED_SCHEME,
|
|
INVALID_PORT,
|
|
INVALID_HOST
|
|
}
|
|
|
|
public Builder() {
|
|
ArrayList arrayList = new ArrayList();
|
|
this.encodedPathSegments = arrayList;
|
|
arrayList.add("");
|
|
}
|
|
|
|
public final Builder scheme(String str) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("scheme == null");
|
|
}
|
|
if (str.equalsIgnoreCase("http")) {
|
|
this.scheme = "http";
|
|
} else if (str.equalsIgnoreCase("https")) {
|
|
this.scheme = "https";
|
|
} else {
|
|
throw new IllegalArgumentException("unexpected scheme: ".concat(String.valueOf(str)));
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public final Builder username(String str) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("username == null");
|
|
}
|
|
this.encodedUsername = HttpUrl.canonicalize(str, " \"':;<=>@[]^`{}|/\\?#", false, false, false, true);
|
|
return this;
|
|
}
|
|
|
|
public final Builder encodedUsername(String str) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("encodedUsername == null");
|
|
}
|
|
this.encodedUsername = HttpUrl.canonicalize(str, " \"':;<=>@[]^`{}|/\\?#", true, false, false, true);
|
|
return this;
|
|
}
|
|
|
|
public final Builder password(String str) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("password == null");
|
|
}
|
|
this.encodedPassword = HttpUrl.canonicalize(str, " \"':;<=>@[]^`{}|/\\?#", false, false, false, true);
|
|
return this;
|
|
}
|
|
|
|
public final Builder encodedPassword(String str) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("encodedPassword == null");
|
|
}
|
|
this.encodedPassword = HttpUrl.canonicalize(str, " \"':;<=>@[]^`{}|/\\?#", true, false, false, true);
|
|
return this;
|
|
}
|
|
|
|
public final Builder host(String str) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("host == null");
|
|
}
|
|
String f = f(str, 0, str.length());
|
|
if (f == null) {
|
|
throw new IllegalArgumentException("unexpected host: ".concat(String.valueOf(str)));
|
|
}
|
|
this.host = f;
|
|
return this;
|
|
}
|
|
|
|
public final Builder port(int i) {
|
|
if (i <= 0 || i > 65535) {
|
|
throw new IllegalArgumentException("unexpected port: ".concat(String.valueOf(i)));
|
|
}
|
|
this.port = i;
|
|
return this;
|
|
}
|
|
|
|
final int effectivePort() {
|
|
int i = this.port;
|
|
return i == -1 ? HttpUrl.defaultPort(this.scheme) : i;
|
|
}
|
|
|
|
public final Builder addPathSegment(String str) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("pathSegment == null");
|
|
}
|
|
a(str, 0, str.length(), false, false);
|
|
return this;
|
|
}
|
|
|
|
public final Builder addPathSegments(String str) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("pathSegments == null");
|
|
}
|
|
return e(str, false);
|
|
}
|
|
|
|
public final Builder addEncodedPathSegment(String str) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("encodedPathSegment == null");
|
|
}
|
|
a(str, 0, str.length(), false, true);
|
|
return this;
|
|
}
|
|
|
|
public final Builder addEncodedPathSegments(String str) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("encodedPathSegments == null");
|
|
}
|
|
return e(str, true);
|
|
}
|
|
|
|
private Builder e(String str, boolean z) {
|
|
int i = 0;
|
|
do {
|
|
int delimiterOffset = Util.delimiterOffset(str, i, str.length(), "/\\");
|
|
a(str, i, delimiterOffset, delimiterOffset < str.length(), z);
|
|
i = delimiterOffset + 1;
|
|
} while (i <= str.length());
|
|
return this;
|
|
}
|
|
|
|
public final Builder setPathSegment(int i, String str) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("pathSegment == null");
|
|
}
|
|
String a2 = HttpUrl.a(str, 0, str.length(), " \"<>^`{}|/\\?#", false, false, false, true);
|
|
if (aW(a2) || aX(a2)) {
|
|
throw new IllegalArgumentException("unexpected path segment: ".concat(String.valueOf(str)));
|
|
}
|
|
this.encodedPathSegments.set(i, a2);
|
|
return this;
|
|
}
|
|
|
|
public final Builder setEncodedPathSegment(int i, String str) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("encodedPathSegment == null");
|
|
}
|
|
String a2 = HttpUrl.a(str, 0, str.length(), " \"<>^`{}|/\\?#", true, false, false, true);
|
|
this.encodedPathSegments.set(i, a2);
|
|
if (aW(a2) || aX(a2)) {
|
|
throw new IllegalArgumentException("unexpected path segment: ".concat(String.valueOf(str)));
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public final Builder removePathSegment(int i) {
|
|
this.encodedPathSegments.remove(i);
|
|
if (this.encodedPathSegments.isEmpty()) {
|
|
this.encodedPathSegments.add("");
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public final Builder encodedPath(String str) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("encodedPath == null");
|
|
}
|
|
if (!str.startsWith("/")) {
|
|
throw new IllegalArgumentException("unexpected encodedPath: ".concat(String.valueOf(str)));
|
|
}
|
|
b(str, 0, str.length());
|
|
return this;
|
|
}
|
|
|
|
public final Builder query(String str) {
|
|
this.encodedQueryNamesAndValues = str != null ? HttpUrl.queryStringToNamesAndValues(HttpUrl.canonicalize(str, " \"'<>#", false, false, true, true)) : null;
|
|
return this;
|
|
}
|
|
|
|
public final Builder encodedQuery(String str) {
|
|
this.encodedQueryNamesAndValues = str != null ? HttpUrl.queryStringToNamesAndValues(HttpUrl.canonicalize(str, " \"'<>#", true, false, true, true)) : null;
|
|
return this;
|
|
}
|
|
|
|
public final Builder addQueryParameter(String str, String str2) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("name == null");
|
|
}
|
|
if (this.encodedQueryNamesAndValues == null) {
|
|
this.encodedQueryNamesAndValues = new ArrayList();
|
|
}
|
|
this.encodedQueryNamesAndValues.add(HttpUrl.canonicalize(str, " \"'<>#&=", false, false, true, true));
|
|
this.encodedQueryNamesAndValues.add(str2 != null ? HttpUrl.canonicalize(str2, " \"'<>#&=", false, false, true, true) : null);
|
|
return this;
|
|
}
|
|
|
|
public final Builder addEncodedQueryParameter(String str, String str2) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("encodedName == null");
|
|
}
|
|
if (this.encodedQueryNamesAndValues == null) {
|
|
this.encodedQueryNamesAndValues = new ArrayList();
|
|
}
|
|
this.encodedQueryNamesAndValues.add(HttpUrl.canonicalize(str, " \"'<>#&=", true, false, true, true));
|
|
this.encodedQueryNamesAndValues.add(str2 != null ? HttpUrl.canonicalize(str2, " \"'<>#&=", true, false, true, true) : null);
|
|
return this;
|
|
}
|
|
|
|
public final Builder setQueryParameter(String str, String str2) {
|
|
removeAllQueryParameters(str);
|
|
addQueryParameter(str, str2);
|
|
return this;
|
|
}
|
|
|
|
public final Builder setEncodedQueryParameter(String str, String str2) {
|
|
removeAllEncodedQueryParameters(str);
|
|
addEncodedQueryParameter(str, str2);
|
|
return this;
|
|
}
|
|
|
|
public final Builder removeAllQueryParameters(String str) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("name == null");
|
|
}
|
|
if (this.encodedQueryNamesAndValues == null) {
|
|
return this;
|
|
}
|
|
aV(HttpUrl.canonicalize(str, " \"'<>#&=", false, false, true, true));
|
|
return this;
|
|
}
|
|
|
|
public final Builder removeAllEncodedQueryParameters(String str) {
|
|
if (str == null) {
|
|
throw new IllegalArgumentException("encodedName == null");
|
|
}
|
|
if (this.encodedQueryNamesAndValues == null) {
|
|
return this;
|
|
}
|
|
aV(HttpUrl.canonicalize(str, " \"'<>#&=", true, false, true, true));
|
|
return this;
|
|
}
|
|
|
|
private void aV(String str) {
|
|
for (int size = this.encodedQueryNamesAndValues.size() - 2; size >= 0; size -= 2) {
|
|
if (str.equals(this.encodedQueryNamesAndValues.get(size))) {
|
|
this.encodedQueryNamesAndValues.remove(size + 1);
|
|
this.encodedQueryNamesAndValues.remove(size);
|
|
if (this.encodedQueryNamesAndValues.isEmpty()) {
|
|
this.encodedQueryNamesAndValues = null;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public final Builder fragment(String str) {
|
|
this.encodedFragment = str != null ? HttpUrl.canonicalize(str, "", false, false, false, false) : null;
|
|
return this;
|
|
}
|
|
|
|
public final Builder encodedFragment(String str) {
|
|
this.encodedFragment = str != null ? HttpUrl.canonicalize(str, "", true, false, false, false) : null;
|
|
return this;
|
|
}
|
|
|
|
final Builder uo() {
|
|
int size = this.encodedPathSegments.size();
|
|
for (int i = 0; i < size; i++) {
|
|
this.encodedPathSegments.set(i, HttpUrl.canonicalize(this.encodedPathSegments.get(i), "[]", true, true, false, true));
|
|
}
|
|
List<String> list = this.encodedQueryNamesAndValues;
|
|
if (list != null) {
|
|
int size2 = list.size();
|
|
for (int i2 = 0; i2 < size2; i2++) {
|
|
String str = this.encodedQueryNamesAndValues.get(i2);
|
|
if (str != null) {
|
|
this.encodedQueryNamesAndValues.set(i2, HttpUrl.canonicalize(str, "\\^`{|}", true, true, true, true));
|
|
}
|
|
}
|
|
}
|
|
String str2 = this.encodedFragment;
|
|
if (str2 != null) {
|
|
this.encodedFragment = HttpUrl.canonicalize(str2, " \"#<>\\^`{|}", true, true, false, false);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public final HttpUrl build() {
|
|
if (this.scheme == null) {
|
|
throw new IllegalStateException("scheme == null");
|
|
}
|
|
if (this.host == null) {
|
|
throw new IllegalStateException("host == null");
|
|
}
|
|
return new HttpUrl(this, null);
|
|
}
|
|
|
|
public final String toString() {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(this.scheme);
|
|
sb.append("://");
|
|
if (!this.encodedUsername.isEmpty() || !this.encodedPassword.isEmpty()) {
|
|
sb.append(this.encodedUsername);
|
|
if (!this.encodedPassword.isEmpty()) {
|
|
sb.append(':');
|
|
sb.append(this.encodedPassword);
|
|
}
|
|
sb.append('@');
|
|
}
|
|
if (this.host.indexOf(58) != -1) {
|
|
sb.append('[');
|
|
sb.append(this.host);
|
|
sb.append(']');
|
|
} else {
|
|
sb.append(this.host);
|
|
}
|
|
int effectivePort = effectivePort();
|
|
if (effectivePort != HttpUrl.defaultPort(this.scheme)) {
|
|
sb.append(':');
|
|
sb.append(effectivePort);
|
|
}
|
|
HttpUrl.pathSegmentsToString(sb, this.encodedPathSegments);
|
|
if (this.encodedQueryNamesAndValues != null) {
|
|
sb.append('?');
|
|
HttpUrl.namesAndValuesToQueryString(sb, this.encodedQueryNamesAndValues);
|
|
}
|
|
if (this.encodedFragment != null) {
|
|
sb.append('#');
|
|
sb.append(this.encodedFragment);
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
final a c(HttpUrl httpUrl, String str) {
|
|
int delimiterOffset;
|
|
int i;
|
|
int skipLeadingAsciiWhitespace = Util.skipLeadingAsciiWhitespace(str, 0, str.length());
|
|
int skipTrailingAsciiWhitespace = Util.skipTrailingAsciiWhitespace(str, skipLeadingAsciiWhitespace, str.length());
|
|
if (c(str, skipLeadingAsciiWhitespace, skipTrailingAsciiWhitespace) != -1) {
|
|
if (str.regionMatches(true, skipLeadingAsciiWhitespace, "https:", 0, 6)) {
|
|
this.scheme = "https";
|
|
skipLeadingAsciiWhitespace += 6;
|
|
} else {
|
|
if (!str.regionMatches(true, skipLeadingAsciiWhitespace, "http:", 0, 5)) {
|
|
return a.UNSUPPORTED_SCHEME;
|
|
}
|
|
this.scheme = "http";
|
|
skipLeadingAsciiWhitespace += 5;
|
|
}
|
|
} else if (httpUrl != null) {
|
|
this.scheme = httpUrl.scheme;
|
|
} else {
|
|
return a.MISSING_SCHEME;
|
|
}
|
|
int d = d(str, skipLeadingAsciiWhitespace, skipTrailingAsciiWhitespace);
|
|
char c = '?';
|
|
char c2 = '#';
|
|
if (d >= 2 || httpUrl == null || !httpUrl.scheme.equals(this.scheme)) {
|
|
boolean z = false;
|
|
boolean z2 = false;
|
|
int i2 = skipLeadingAsciiWhitespace + d;
|
|
while (true) {
|
|
delimiterOffset = Util.delimiterOffset(str, i2, skipTrailingAsciiWhitespace, "@/\\?#");
|
|
char charAt = delimiterOffset != skipTrailingAsciiWhitespace ? str.charAt(delimiterOffset) : (char) 65535;
|
|
if (charAt == 65535 || charAt == c2 || charAt == '/' || charAt == '\\' || charAt == c) {
|
|
break;
|
|
}
|
|
if (charAt == '@') {
|
|
if (!z) {
|
|
int delimiterOffset2 = Util.delimiterOffset(str, i2, delimiterOffset, ':');
|
|
i = delimiterOffset;
|
|
String a2 = HttpUrl.a(str, i2, delimiterOffset2, " \"':;<=>@[]^`{}|/\\?#", true, false, false, true);
|
|
if (z2) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(this.encodedUsername);
|
|
sb.append("%40");
|
|
sb.append(a2);
|
|
a2 = sb.toString();
|
|
}
|
|
this.encodedUsername = a2;
|
|
if (delimiterOffset2 != i) {
|
|
this.encodedPassword = HttpUrl.a(str, delimiterOffset2 + 1, i, " \"':;<=>@[]^`{}|/\\?#", true, false, false, true);
|
|
z = true;
|
|
}
|
|
z2 = true;
|
|
} else {
|
|
i = delimiterOffset;
|
|
StringBuilder sb2 = new StringBuilder();
|
|
sb2.append(this.encodedPassword);
|
|
sb2.append("%40");
|
|
sb2.append(HttpUrl.a(str, i2, i, " \"':;<=>@[]^`{}|/\\?#", true, false, false, true));
|
|
this.encodedPassword = sb2.toString();
|
|
}
|
|
i2 = i + 1;
|
|
}
|
|
c = '?';
|
|
c2 = '#';
|
|
}
|
|
int e = e(str, i2, delimiterOffset);
|
|
int i3 = e + 1;
|
|
if (i3 < delimiterOffset) {
|
|
this.host = f(str, i2, e);
|
|
int h = h(str, i3, delimiterOffset);
|
|
this.port = h;
|
|
if (h == -1) {
|
|
return a.INVALID_PORT;
|
|
}
|
|
} else {
|
|
this.host = f(str, i2, e);
|
|
this.port = HttpUrl.defaultPort(this.scheme);
|
|
}
|
|
if (this.host == null) {
|
|
return a.INVALID_HOST;
|
|
}
|
|
skipLeadingAsciiWhitespace = delimiterOffset;
|
|
} else {
|
|
this.encodedUsername = httpUrl.encodedUsername();
|
|
this.encodedPassword = httpUrl.encodedPassword();
|
|
this.host = httpUrl.host;
|
|
this.port = httpUrl.port;
|
|
this.encodedPathSegments.clear();
|
|
this.encodedPathSegments.addAll(httpUrl.encodedPathSegments());
|
|
if (skipLeadingAsciiWhitespace == skipTrailingAsciiWhitespace || str.charAt(skipLeadingAsciiWhitespace) == '#') {
|
|
encodedQuery(httpUrl.encodedQuery());
|
|
}
|
|
}
|
|
int delimiterOffset3 = Util.delimiterOffset(str, skipLeadingAsciiWhitespace, skipTrailingAsciiWhitespace, "?#");
|
|
b(str, skipLeadingAsciiWhitespace, delimiterOffset3);
|
|
if (delimiterOffset3 < skipTrailingAsciiWhitespace && str.charAt(delimiterOffset3) == '?') {
|
|
int delimiterOffset4 = Util.delimiterOffset(str, delimiterOffset3, skipTrailingAsciiWhitespace, '#');
|
|
this.encodedQueryNamesAndValues = HttpUrl.queryStringToNamesAndValues(HttpUrl.a(str, delimiterOffset3 + 1, delimiterOffset4, " \"'<>#", true, false, true, true));
|
|
delimiterOffset3 = delimiterOffset4;
|
|
}
|
|
if (delimiterOffset3 < skipTrailingAsciiWhitespace && str.charAt(delimiterOffset3) == '#') {
|
|
this.encodedFragment = HttpUrl.a(str, 1 + delimiterOffset3, skipTrailingAsciiWhitespace, "", true, false, false, false);
|
|
}
|
|
return a.SUCCESS;
|
|
}
|
|
|
|
private void b(String str, int i, int i2) {
|
|
if (i == i2) {
|
|
return;
|
|
}
|
|
char charAt = str.charAt(i);
|
|
if (charAt == '/' || charAt == '\\') {
|
|
this.encodedPathSegments.clear();
|
|
this.encodedPathSegments.add("");
|
|
i++;
|
|
} else {
|
|
List<String> list = this.encodedPathSegments;
|
|
list.set(list.size() - 1, "");
|
|
}
|
|
while (true) {
|
|
int i3 = i;
|
|
if (i3 >= i2) {
|
|
return;
|
|
}
|
|
i = Util.delimiterOffset(str, i3, i2, "/\\");
|
|
boolean z = i < i2;
|
|
a(str, i3, i, z, true);
|
|
if (z) {
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void a(String str, int i, int i2, boolean z, boolean z2) {
|
|
String a2 = HttpUrl.a(str, i, i2, " \"<>^`{}|/\\?#", z2, false, false, true);
|
|
if (aW(a2)) {
|
|
return;
|
|
}
|
|
if (aX(a2)) {
|
|
up();
|
|
return;
|
|
}
|
|
if (this.encodedPathSegments.get(r10.size() - 1).isEmpty()) {
|
|
this.encodedPathSegments.set(r10.size() - 1, a2);
|
|
} else {
|
|
this.encodedPathSegments.add(a2);
|
|
}
|
|
if (z) {
|
|
this.encodedPathSegments.add("");
|
|
}
|
|
}
|
|
|
|
private boolean aW(String str) {
|
|
return str.equals(".") || str.equalsIgnoreCase("%2e");
|
|
}
|
|
|
|
private boolean aX(String str) {
|
|
return str.equals("..") || str.equalsIgnoreCase("%2e.") || str.equalsIgnoreCase(".%2e") || str.equalsIgnoreCase("%2e%2e");
|
|
}
|
|
|
|
private void up() {
|
|
if (this.encodedPathSegments.remove(r0.size() - 1).isEmpty() && !this.encodedPathSegments.isEmpty()) {
|
|
this.encodedPathSegments.set(r0.size() - 1, "");
|
|
} else {
|
|
this.encodedPathSegments.add("");
|
|
}
|
|
}
|
|
|
|
private static int c(String str, int i, int i2) {
|
|
if (i2 - i < 2) {
|
|
return -1;
|
|
}
|
|
char charAt = str.charAt(i);
|
|
if ((charAt >= 'a' && charAt <= 'z') || (charAt >= 'A' && charAt <= 'Z')) {
|
|
while (true) {
|
|
i++;
|
|
if (i >= i2) {
|
|
break;
|
|
}
|
|
char charAt2 = str.charAt(i);
|
|
if (charAt2 < 'a' || charAt2 > 'z') {
|
|
if (charAt2 < 'A' || charAt2 > 'Z') {
|
|
if (charAt2 < '0' || charAt2 > '9') {
|
|
if (charAt2 != '+' && charAt2 != '-' && charAt2 != '.') {
|
|
if (charAt2 == ':') {
|
|
return i;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
private static int d(String str, int i, int i2) {
|
|
int i3 = 0;
|
|
while (i < i2) {
|
|
char charAt = str.charAt(i);
|
|
if (charAt != '\\' && charAt != '/') {
|
|
break;
|
|
}
|
|
i3++;
|
|
i++;
|
|
}
|
|
return i3;
|
|
}
|
|
|
|
private static int e(String str, int i, int i2) {
|
|
while (i < i2) {
|
|
char charAt = str.charAt(i);
|
|
if (charAt == ':') {
|
|
return i;
|
|
}
|
|
if (charAt != '[') {
|
|
i++;
|
|
}
|
|
do {
|
|
i++;
|
|
if (i < i2) {
|
|
}
|
|
i++;
|
|
} while (str.charAt(i) != ']');
|
|
i++;
|
|
}
|
|
return i2;
|
|
}
|
|
|
|
private static String f(String str, int i, int i2) {
|
|
InetAddress g;
|
|
String percentDecode = HttpUrl.percentDecode(str, i, i2, false);
|
|
if (percentDecode.contains(":")) {
|
|
if (percentDecode.startsWith("[") && percentDecode.endsWith("]")) {
|
|
g = g(percentDecode, 1, percentDecode.length() - 1);
|
|
} else {
|
|
g = g(percentDecode, 0, percentDecode.length());
|
|
}
|
|
if (g == null) {
|
|
return null;
|
|
}
|
|
byte[] address = g.getAddress();
|
|
if (address.length == 16) {
|
|
return k(address);
|
|
}
|
|
throw new AssertionError();
|
|
}
|
|
return Util.domainToAscii(percentDecode);
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:25:0x0073, code lost:
|
|
|
|
return null;
|
|
*/
|
|
/* JADX WARN: Removed duplicated region for block: B:15:0x004f */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private static java.net.InetAddress g(java.lang.String r12, int r13, int r14) {
|
|
/*
|
|
r0 = 16
|
|
byte[] r1 = new byte[r0]
|
|
r2 = 0
|
|
r3 = -1
|
|
r4 = r2
|
|
r5 = r3
|
|
r6 = r5
|
|
L9:
|
|
r7 = 0
|
|
if (r13 >= r14) goto L74
|
|
if (r4 != r0) goto Lf
|
|
return r7
|
|
Lf:
|
|
int r8 = r13 + 2
|
|
r9 = 1
|
|
if (r8 > r14) goto L28
|
|
java.lang.String r10 = "::"
|
|
r11 = 2
|
|
boolean r10 = r12.regionMatches(r13, r10, r2, r11)
|
|
if (r10 == 0) goto L28
|
|
if (r5 == r3) goto L20
|
|
return r7
|
|
L20:
|
|
int r4 = r4 + 2
|
|
r5 = r4
|
|
if (r8 != r14) goto L26
|
|
goto L74
|
|
L26:
|
|
r6 = r8
|
|
goto L4b
|
|
L28:
|
|
if (r4 == 0) goto L4a
|
|
java.lang.String r8 = ":"
|
|
boolean r8 = r12.regionMatches(r13, r8, r2, r9)
|
|
if (r8 == 0) goto L35
|
|
int r13 = r13 + 1
|
|
goto L4a
|
|
L35:
|
|
java.lang.String r8 = "."
|
|
boolean r13 = r12.regionMatches(r13, r8, r2, r9)
|
|
if (r13 == 0) goto L49
|
|
int r13 = r4 + (-2)
|
|
boolean r12 = a(r12, r6, r14, r1, r13)
|
|
if (r12 != 0) goto L46
|
|
return r7
|
|
L46:
|
|
int r4 = r4 + 2
|
|
goto L74
|
|
L49:
|
|
return r7
|
|
L4a:
|
|
r6 = r13
|
|
L4b:
|
|
r8 = r2
|
|
r13 = r6
|
|
L4d:
|
|
if (r13 >= r14) goto L5f
|
|
char r10 = r12.charAt(r13)
|
|
int r10 = okhttp3.repackaged.HttpUrl.decodeHexDigit(r10)
|
|
if (r10 == r3) goto L5f
|
|
int r8 = r8 << 4
|
|
int r8 = r8 + r10
|
|
int r13 = r13 + 1
|
|
goto L4d
|
|
L5f:
|
|
int r10 = r13 - r6
|
|
if (r10 == 0) goto L73
|
|
r11 = 4
|
|
if (r10 > r11) goto L73
|
|
int r7 = r8 >>> 8
|
|
byte r7 = (byte) r7
|
|
r1[r4] = r7
|
|
int r7 = r4 + 2
|
|
byte r8 = (byte) r8
|
|
int r4 = r4 + r9
|
|
r1[r4] = r8
|
|
r4 = r7
|
|
goto L9
|
|
L73:
|
|
return r7
|
|
L74:
|
|
if (r4 == r0) goto L85
|
|
if (r5 != r3) goto L79
|
|
return r7
|
|
L79:
|
|
int r12 = r4 - r5
|
|
int r13 = 16 - r12
|
|
java.lang.System.arraycopy(r1, r5, r1, r13, r12)
|
|
int r0 = r0 - r4
|
|
int r0 = r0 + r5
|
|
java.util.Arrays.fill(r1, r5, r0, r2)
|
|
L85:
|
|
java.net.InetAddress r12 = java.net.InetAddress.getByAddress(r1) // Catch: java.net.UnknownHostException -> L8a
|
|
return r12
|
|
L8a:
|
|
java.lang.AssertionError r12 = new java.lang.AssertionError
|
|
r12.<init>()
|
|
throw r12
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: okhttp3.repackaged.HttpUrl.Builder.g(java.lang.String, int, int):java.net.InetAddress");
|
|
}
|
|
|
|
private static boolean a(String str, int i, int i2, byte[] bArr, int i3) {
|
|
int i4 = i3;
|
|
while (i < i2) {
|
|
if (i4 == bArr.length) {
|
|
return false;
|
|
}
|
|
if (i4 != i3) {
|
|
if (str.charAt(i) != '.') {
|
|
return false;
|
|
}
|
|
i++;
|
|
}
|
|
int i5 = i;
|
|
int i6 = 0;
|
|
while (i5 < i2) {
|
|
char charAt = str.charAt(i5);
|
|
if (charAt < '0' || charAt > '9') {
|
|
break;
|
|
}
|
|
if ((i6 == 0 && i != i5) || (i6 = ((i6 * 10) + charAt) - 48) > 255) {
|
|
return false;
|
|
}
|
|
i5++;
|
|
}
|
|
if (i5 - i == 0) {
|
|
return false;
|
|
}
|
|
bArr[i4] = (byte) i6;
|
|
i4++;
|
|
i = i5;
|
|
}
|
|
return i4 == i3 + 4;
|
|
}
|
|
|
|
private static String k(byte[] bArr) {
|
|
int i = -1;
|
|
int i2 = 0;
|
|
int i3 = 0;
|
|
int i4 = 0;
|
|
while (i3 < bArr.length) {
|
|
int i5 = i3;
|
|
while (i5 < 16 && bArr[i5] == 0 && bArr[i5 + 1] == 0) {
|
|
i5 += 2;
|
|
}
|
|
int i6 = i5 - i3;
|
|
if (i6 > i4) {
|
|
i = i3;
|
|
i4 = i6;
|
|
}
|
|
i3 = i5 + 2;
|
|
}
|
|
giM gim = new giM();
|
|
while (i2 < bArr.length) {
|
|
if (i2 == i) {
|
|
gim.b(58);
|
|
i2 += i4;
|
|
if (i2 == 16) {
|
|
gim.b(58);
|
|
}
|
|
} else {
|
|
if (i2 > 0) {
|
|
gim.b(58);
|
|
}
|
|
gim.k(((bArr[i2] & UnsignedBytes.MAX_VALUE) << 8) | (bArr[i2 + 1] & UnsignedBytes.MAX_VALUE));
|
|
i2 += 2;
|
|
}
|
|
}
|
|
return gim.q();
|
|
}
|
|
|
|
private static int h(String str, int i, int i2) {
|
|
try {
|
|
int parseInt = Integer.parseInt(HttpUrl.a(str, i, i2, "", false, false, false, true));
|
|
if (parseInt <= 0 || parseInt > 65535) {
|
|
return -1;
|
|
}
|
|
return parseInt;
|
|
} catch (NumberFormatException unused) {
|
|
return -1;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static String percentDecode(String str, boolean z) {
|
|
return percentDecode(str, 0, str.length(), z);
|
|
}
|
|
|
|
private List<String> a(List<String> list, boolean z) {
|
|
ArrayList arrayList = new ArrayList(list.size());
|
|
Iterator<String> it = list.iterator();
|
|
while (it.hasNext()) {
|
|
String next = it.next();
|
|
arrayList.add(next != null ? percentDecode(next, z) : null);
|
|
}
|
|
return Collections.unmodifiableList(arrayList);
|
|
}
|
|
|
|
static String percentDecode(String str, int i, int i2, boolean z) {
|
|
for (int i3 = i; i3 < i2; i3++) {
|
|
char charAt = str.charAt(i3);
|
|
if (charAt == '%' || (charAt == '+' && z)) {
|
|
giM gim = new giM();
|
|
gim.b(str, i, i3);
|
|
a(gim, str, i3, i2, z);
|
|
return gim.q();
|
|
}
|
|
}
|
|
return str.substring(i, i2);
|
|
}
|
|
|
|
static void a(giM gim, String str, int i, int i2, boolean z) {
|
|
int i3;
|
|
while (i < i2) {
|
|
int codePointAt = str.codePointAt(i);
|
|
if (codePointAt == 37 && (i3 = i + 2) < i2) {
|
|
int decodeHexDigit = decodeHexDigit(str.charAt(i + 1));
|
|
int decodeHexDigit2 = decodeHexDigit(str.charAt(i3));
|
|
if (decodeHexDigit != -1 && decodeHexDigit2 != -1) {
|
|
gim.b((decodeHexDigit << 4) + decodeHexDigit2);
|
|
i = i3;
|
|
}
|
|
gim.i(codePointAt);
|
|
} else {
|
|
if (codePointAt == 43 && z) {
|
|
gim.b(32);
|
|
}
|
|
gim.i(codePointAt);
|
|
}
|
|
i += Character.charCount(codePointAt);
|
|
}
|
|
}
|
|
|
|
static boolean percentEncoded(String str, int i, int i2) {
|
|
int i3 = i + 2;
|
|
return i3 < i2 && str.charAt(i) == '%' && decodeHexDigit(str.charAt(i + 1)) != -1 && decodeHexDigit(str.charAt(i3)) != -1;
|
|
}
|
|
|
|
static String a(String str, int i, int i2, String str2, boolean z, boolean z2, boolean z3, boolean z4) {
|
|
int i3 = i;
|
|
while (i3 < i2) {
|
|
int codePointAt = str.codePointAt(i3);
|
|
if (codePointAt >= 32 && codePointAt != 127 && (codePointAt < 128 || !z4)) {
|
|
if (str2.indexOf(codePointAt) == -1 && ((codePointAt != 37 || (z && (!z2 || percentEncoded(str, i3, i2)))) && (codePointAt != 43 || !z3))) {
|
|
i3 += Character.charCount(codePointAt);
|
|
}
|
|
}
|
|
giM gim = new giM();
|
|
gim.b(str, i, i3);
|
|
a(gim, str, i3, i2, str2, z, z2, z3, z4);
|
|
return gim.q();
|
|
}
|
|
return str.substring(i, i2);
|
|
}
|
|
|
|
static void a(giM gim, String str, int i, int i2, String str2, boolean z, boolean z2, boolean z3, boolean z4) {
|
|
giM gim2 = null;
|
|
int i3 = i;
|
|
while (i3 < i2) {
|
|
int codePointAt = str.codePointAt(i3);
|
|
if (!z || (codePointAt != 9 && codePointAt != 10 && codePointAt != 12 && codePointAt != 13)) {
|
|
if (codePointAt != 43 || !z3) {
|
|
if (codePointAt >= 32 && codePointAt != 127 && (codePointAt < 128 || !z4)) {
|
|
if (str2.indexOf(codePointAt) == -1 && (codePointAt != 37 || (z && (!z2 || percentEncoded(str, i3, i2))))) {
|
|
gim.i(codePointAt);
|
|
i3 += Character.charCount(codePointAt);
|
|
}
|
|
}
|
|
if (gim2 == null) {
|
|
gim2 = new giM();
|
|
}
|
|
gim2.i(codePointAt);
|
|
while (gim2.a != 0) {
|
|
byte i4 = gim2.i();
|
|
gim.b(37);
|
|
char[] cArr = HEX_DIGITS;
|
|
gim.b((int) cArr[((i4 & UnsignedBytes.MAX_VALUE) >> 4) & 15]);
|
|
gim.b((int) cArr[i4 & 15]);
|
|
}
|
|
i3 += Character.charCount(codePointAt);
|
|
} else {
|
|
String str3 = z ? "+" : "%2B";
|
|
gim.b(str3, 0, str3.length());
|
|
}
|
|
}
|
|
i3 += Character.charCount(codePointAt);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static String canonicalize(String str, String str2, boolean z, boolean z2, boolean z3, boolean z4) {
|
|
return a(str, 0, str.length(), str2, z, z2, z3, z4);
|
|
}
|
|
|
|
public final String username() {
|
|
return this.username;
|
|
}
|
|
|
|
public final String toString() {
|
|
return this.url;
|
|
}
|
|
|
|
public final String scheme() {
|
|
return this.scheme;
|
|
}
|
|
|
|
public final int port() {
|
|
return this.port;
|
|
}
|
|
|
|
public final List<String> pathSegments() {
|
|
return this.ahL;
|
|
}
|
|
|
|
public final String password() {
|
|
return this.password;
|
|
}
|
|
|
|
public final String host() {
|
|
return this.host;
|
|
}
|
|
|
|
public final String fragment() {
|
|
return this.fragment;
|
|
}
|
|
}
|