Files
rr3-apk/decompiled-reference/com/firemonkeys/cloudcellapi/HttpRequest.java
Daniel Elliott d144aec853 Add decompiled reference source files
- Key Java files showing custom server implementation
- Original AndroidManifest.xml for reference
- SynergyEnvironmentImpl.java - Custom server configuration
- HttpRequest.java - HTTP implementation details
- Documentation explaining each file's purpose

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-17 22:06:36 -08:00

117 lines
3.6 KiB
Java

package com.firemonkeys.cloudcellapi;
import com.mbridge.msdk.newreward.function.common.MBridgeCommon;
import java.security.SecureRandom;
import java.util.List;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import org.apache.http.conn.ssl.SSLSocketFactory;
/* loaded from: classes2.dex */
public class HttpRequest {
private static final String CLASSNAME = "HttpRequest";
private static boolean s_sslContextInit = false;
public static String s_userAgent;
HttpThread m_thread = null;
private double m_serverTime = 0.0d;
private boolean m_bSSLCheck = false;
private int m_TimeoutMilliseconds = MBridgeCommon.DEFAULT_LOAD_TIMEOUT;
public native void completeCallback(long j, int i);
public native void dataCallback(long j, byte[] bArr, int i);
public native void errorCallback(long j, int i);
public boolean getSSLCheck() {
return this.m_bSSLCheck;
}
public double getServerTime() {
return this.m_serverTime;
}
public int getTimeoutMilliseconds() {
return this.m_TimeoutMilliseconds;
}
public native void headerCallback(long j, int i, Map<String, List<String>> map);
public boolean isClosed() {
return this.m_thread == null;
}
public HttpRequest() {
System.setProperty("http.keepAlive", "false");
}
public void init(String str, String str2, String str3, byte[] bArr, int i, long j, boolean z, double d, boolean z2, boolean z3, int i2) {
this.m_serverTime = d;
this.m_bSSLCheck = z2;
if (i2 > 0) {
this.m_TimeoutMilliseconds = i2 * 1000;
}
initSSLContext();
initUserAgent(str);
this.m_thread = new HttpThread(this, str2, str3, bArr, i, j, z, z3);
}
public void setClosedBySSLCheck(boolean z) {
this.m_thread.setClosedBySSLCheck(z);
}
public void shutdown() {
HttpThread httpThread = this.m_thread;
if (httpThread != null) {
httpThread.shutdown();
}
}
public void addHeader(String str, String str2) {
this.m_thread.addHeader(str, str2);
}
public void post() {
HttpThread httpThread = this.m_thread;
if (httpThread == null) {
Logging.CC_ERROR(CLASSNAME, "post() called but thread is already closed");
} else if (httpThread.isAlive()) {
Logging.CC_ERROR(CLASSNAME, "post() called but thread is already running");
} else {
this.m_thread.start();
}
}
public void close() {
HttpThread httpThread = this.m_thread;
if (httpThread != null) {
httpThread.interrupt();
}
this.m_thread = null;
}
private static void initUserAgent(String str) {
if (s_userAgent != null) {
return;
}
s_userAgent = str + " " + System.getProperty("http.agent");
StringBuilder sb = new StringBuilder();
sb.append("User Agent: ");
sb.append(s_userAgent);
Logging.CC_INFO(CLASSNAME, sb.toString());
}
private void initSSLContext() {
try {
SSLContext sSLContext = SSLContext.getInstance("TLS");
sSLContext.init(null, new TrustManager[]{new CloudcellTrustManager(this)}, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(new TLSSocketFactory(sSLContext.getSocketFactory()));
HttpsURLConnection.setDefaultHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
} catch (Exception unused) {
Logging.CC_ERROR(CLASSNAME, "Exception when trying to init SSLContext!");
}
}
}