Files
rr3-apk/decompiled-community/sources/com/fyber/inneractive/sdk/util/s.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

84 lines
3.4 KiB
Java

package com.fyber.inneractive.sdk.util;
import android.annotation.TargetApi;
import android.security.NetworkSecurityPolicy;
import android.text.TextUtils;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import java.io.BufferedInputStream;
import java.io.FilterInputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.zip.GZIPInputStream;
/* loaded from: classes2.dex */
public final class s {
public static String b(HttpURLConnection httpURLConnection) throws Exception {
int responseCode = httpURLConnection.getResponseCode();
if (responseCode != 302 && responseCode != 303 && responseCode != 307) {
return null;
}
IAlog.a("getRedirectUrl: received redirect code %s", Integer.toString(responseCode));
String headerField = httpURLConnection.getHeaderField(com.fyber.inneractive.sdk.network.m.LOCATION.e());
if (!TextUtils.isEmpty(headerField)) {
IAlog.a("getRedirectUrl: redirecting target url: %s", headerField);
return headerField;
}
throw new Exception("Server returned HTTP " + Integer.toString(responseCode) + " with empty location header!");
}
public static boolean c(HttpURLConnection httpURLConnection) throws Exception {
int responseCode = httpURLConnection.getResponseCode();
if (responseCode == 200) {
return true;
}
IAlog.a("isResponseValid: found invalid response status: %s", Integer.toString(responseCode));
return false;
}
@TargetApi(23)
public static boolean a() {
return NetworkSecurityPolicy.getInstance().isCleartextTrafficPermitted();
}
public static String a(String str, int i, int i2) throws Exception {
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(new URL(str).openConnection()));
httpURLConnection.setConnectTimeout(i);
httpURLConnection.setReadTimeout(i2);
httpURLConnection.connect();
FilterInputStream a = a(httpURLConnection);
String b = b(httpURLConnection);
if (!TextUtils.isEmpty(b)) {
httpURLConnection.disconnect();
return a(b, i2, i);
}
String stringBuffer = c(httpURLConnection) ? t.a((InputStream) a).toString() : null;
httpURLConnection.disconnect();
return stringBuffer;
} catch (Exception e) {
IAlog.a("getBodyFromUrl failed with exception", e, new Object[0]);
throw e;
} catch (Throwable th) {
IAlog.a("getBodyFromUrl failed with error", th, new Object[0]);
return null;
}
}
public static FilterInputStream a(HttpURLConnection httpURLConnection) {
FilterInputStream bufferedInputStream;
try {
InputStream inputStream = httpURLConnection.getInputStream();
if (TextUtils.equals("gzip", httpURLConnection.getContentEncoding())) {
bufferedInputStream = new GZIPInputStream(inputStream);
} else {
bufferedInputStream = new BufferedInputStream(inputStream);
}
return bufferedInputStream;
} catch (Exception unused) {
return null;
}
}
}