alexandroid/decompiled/jadx/sources/org/apache/http/HttpHost.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

178 lines
5.6 KiB
Java

package org.apache.http;
import java.io.Serializable;
import java.net.InetAddress;
import java.util.Locale;
import kotlinx.serialization.json.internal.AbstractJsonLexerKt;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.util.Args;
import org.apache.http.util.LangUtils;
import rx.Single$$ExternalSyntheticBUOutline0;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
@Contract(threading = ThreadingBehavior.IMMUTABLE)
/* loaded from: classes11.dex */
public final class HttpHost implements Cloneable, Serializable {
public static final String DEFAULT_SCHEME_NAME = "http";
private static final long serialVersionUID = -7529410654042457626L;
protected final InetAddress address;
protected final String hostname;
protected final String lcHostname;
protected final int port;
protected final String schemeName;
public HttpHost(InetAddress inetAddress, String str, int i, String str2) {
this.address = (InetAddress) Args.notNull(inetAddress, "Inet address");
String str3 = (String) Args.notNull(str, "Hostname");
this.hostname = str3;
Locale locale = Locale.ROOT;
this.lcHostname = str3.toLowerCase(locale);
if (str2 != null) {
this.schemeName = str2.toLowerCase(locale);
} else {
this.schemeName = "http";
}
this.port = i;
}
public static HttpHost create(String str) {
String str2;
int i;
Args.containsNoBlanks(str, "HTTP Host");
int indexOf = str.indexOf("://");
if (indexOf > 0) {
str2 = str.substring(0, indexOf);
str = str.substring(indexOf + 3);
} else {
str2 = null;
}
int lastIndexOf = str.lastIndexOf(":");
if (lastIndexOf > 0) {
try {
i = Integer.parseInt(str.substring(lastIndexOf + 1));
str = str.substring(0, lastIndexOf);
} catch (NumberFormatException unused) {
Single$$ExternalSyntheticBUOutline0.m$3("Invalid HTTP host: ".concat(str));
return null;
}
} else {
i = -1;
}
return new HttpHost(str, i, str2);
}
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof HttpHost) {
HttpHost httpHost = (HttpHost) obj;
if (this.lcHostname.equals(httpHost.lcHostname) && this.port == httpHost.port && this.schemeName.equals(httpHost.schemeName)) {
InetAddress inetAddress = this.address;
InetAddress inetAddress2 = httpHost.address;
if (inetAddress != null ? inetAddress.equals(inetAddress2) : inetAddress2 == null) {
return true;
}
}
}
return false;
}
public InetAddress getAddress() {
return this.address;
}
public String getHostName() {
return this.hostname;
}
public int getPort() {
return this.port;
}
public String getSchemeName() {
return this.schemeName;
}
public int hashCode() {
int hashCode = LangUtils.hashCode(LangUtils.hashCode(LangUtils.hashCode(17, this.lcHostname), this.port), this.schemeName);
InetAddress inetAddress = this.address;
return inetAddress != null ? LangUtils.hashCode(hashCode, inetAddress) : hashCode;
}
public String toHostString() {
int i = this.port;
String str = this.hostname;
if (i == -1) {
return str;
}
StringBuilder sb = new StringBuilder(str.length() + 6);
sb.append(this.hostname);
sb.append(":");
sb.append(Integer.toString(this.port));
return sb.toString();
}
public String toString() {
return toURI();
}
public String toURI() {
StringBuilder sb = new StringBuilder();
sb.append(this.schemeName);
sb.append("://");
sb.append(this.hostname);
if (this.port != -1) {
sb.append(AbstractJsonLexerKt.COLON);
sb.append(Integer.toString(this.port));
}
return sb.toString();
}
public HttpHost(String str, int i) {
this(str, i, (String) null);
}
public HttpHost(String str) {
this(str, -1, (String) null);
}
public HttpHost(InetAddress inetAddress, int i, String str) {
this((InetAddress) Args.notNull(inetAddress, "Inet address"), inetAddress.getHostName(), i, str);
}
public HttpHost(String str, int i, String str2) {
this.hostname = (String) Args.containsNoBlanks(str, "Host name");
Locale locale = Locale.ROOT;
this.lcHostname = str.toLowerCase(locale);
if (str2 != null) {
this.schemeName = str2.toLowerCase(locale);
} else {
this.schemeName = "http";
}
this.port = i;
this.address = null;
}
public HttpHost(InetAddress inetAddress, int i) {
this(inetAddress, i, (String) null);
}
public HttpHost(InetAddress inetAddress) {
this(inetAddress, -1, (String) null);
}
public HttpHost(HttpHost httpHost) {
Args.notNull(httpHost, "HTTP host");
this.hostname = httpHost.hostname;
this.lcHostname = httpHost.lcHostname;
this.schemeName = httpHost.schemeName;
this.port = httpHost.port;
this.address = httpHost.address;
}
}