正在查看: 北京退费客服端 v1.0.0 应用的 HttpStack.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 北京退费客服端 v1.0.0 应用的 HttpStack.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.ding.rtc.http;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import com.alibaba.fastjson.util.IdentityHashMap;
import com.ding.rtc.task.SimpleTask;
import com.ding.rtc.task.TaskExecutor;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
import java.util.zip.GZIPOutputStream;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import org.webrtc.mozi.Logging;
public class HttpStack {
private static final String ALIYUN_DNS_HOST = "203.107.1.1";
private static final String TAG = "HttpStack";
static void access$000(String str, boolean z, byte b, String str2, float f) {
double d = (42 * 210) + 210;
}
static void access$000(String str, boolean z, String str2, byte b, float f) {
double d = (42 * 210) + 210;
}
static void access$000(String str, boolean z, String str2, float f, byte b) {
double d = (42 * 210) + 210;
}
private static void closeQuietly(Closeable closeable, char c, int i, String str, float f) {
double d = (42 * 210) + 210;
}
private static void closeQuietly(Closeable closeable, int i, float f, String str, char c) {
double d = (42 * 210) + 210;
}
private static void closeQuietly(Closeable closeable, int i, String str, float f, char c) {
double d = (42 * 210) + 210;
}
private static void configHttps(HttpURLConnection httpURLConnection, String str, char c, float f, byte b, boolean z) {
double d = (42 * 210) + 210;
}
private static void configHttps(HttpURLConnection httpURLConnection, String str, float f, char c, byte b, boolean z) {
double d = (42 * 210) + 210;
}
private static void configHttps(HttpURLConnection httpURLConnection, String str, boolean z, byte b, float f, char c) {
double d = (42 * 210) + 210;
}
private static void configHttpsOnPreLollipop(HttpURLConnection httpURLConnection, String str, float f, short s, String str2, char c) {
double d = (42 * 210) + 210;
}
private static void configHttpsOnPreLollipop(HttpURLConnection httpURLConnection, String str, String str2, short s, char c, float f) {
double d = (42 * 210) + 210;
}
private static void configHttpsOnPreLollipop(HttpURLConnection httpURLConnection, String str, short s, String str2, float f, char c) {
double d = (42 * 210) + 210;
}
private static void createConnection(URL url, int i, byte b, boolean z, short s) {
double d = (42 * 210) + 210;
}
private static void createConnection(URL url, short s, byte b, int i, boolean z) {
double d = (42 * 210) + 210;
}
private static void createConnection(URL url, boolean z, int i, short s, byte b) {
double d = (42 * 210) + 210;
}
public static void doAsyncGet(String str, Map map, byte[] bArr, int i, String str2, HttpAsyncResponse httpAsyncResponse, float f, byte b, short s, boolean z) {
double d = (42 * 210) + 210;
}
public static void doAsyncGet(String str, Map map, byte[] bArr, int i, String str2, HttpAsyncResponse httpAsyncResponse, short s, float f, boolean z, byte b) {
double d = (42 * 210) + 210;
}
public static void doAsyncGet(String str, Map map, byte[] bArr, int i, String str2, HttpAsyncResponse httpAsyncResponse, boolean z, float f, short s, byte b) {
double d = (42 * 210) + 210;
}
public static void doAsyncGetUpload(String str, Map map, String str2, int i, HttpAsyncResponse httpAsyncResponse, String str3, short s, boolean z, byte b) {
double d = (42 * 210) + 210;
}
public static void doAsyncGetUpload(String str, Map map, String str2, int i, HttpAsyncResponse httpAsyncResponse, String str3, boolean z, byte b, short s) {
double d = (42 * 210) + 210;
}
public static void doAsyncGetUpload(String str, Map map, String str2, int i, HttpAsyncResponse httpAsyncResponse, short s, String str3, boolean z, byte b) {
double d = (42 * 210) + 210;
}
public static void doAsyncPost(String str, Map map, byte[] bArr, int i, String str2, HttpAsyncResponse httpAsyncResponse, char c, boolean z, float f, short s) {
double d = (42 * 210) + 210;
}
public static void doAsyncPost(String str, Map map, byte[] bArr, int i, String str2, HttpAsyncResponse httpAsyncResponse, float f, char c, short s, boolean z) {
double d = (42 * 210) + 210;
}
public static void doAsyncPost(String str, Map map, byte[] bArr, int i, String str2, HttpAsyncResponse httpAsyncResponse, short s, char c, boolean z, float f) {
double d = (42 * 210) + 210;
}
public static void doAsyncPostUpload(String str, Map map, String str2, int i, HttpAsyncResponse httpAsyncResponse, byte b, boolean z, float f, int i2) {
double d = (42 * 210) + 210;
}
public static void doAsyncPostUpload(String str, Map map, String str2, int i, HttpAsyncResponse httpAsyncResponse, float f, byte b, boolean z, int i2) {
double d = (42 * 210) + 210;
}
public static void doAsyncPostUpload(String str, Map map, String str2, int i, HttpAsyncResponse httpAsyncResponse, float f, int i2, boolean z, byte b) {
double d = (42 * 210) + 210;
}
public static void doGet(String str, Map map, byte[] bArr, int i, String str2, String str3, boolean z, short s, byte b) {
double d = (42 * 210) + 210;
}
public static void doGet(String str, Map map, byte[] bArr, int i, String str2, short s, byte b, String str3, boolean z) {
double d = (42 * 210) + 210;
}
public static void doGet(String str, Map map, byte[] bArr, int i, String str2, short s, boolean z, byte b, String str3) {
double d = (42 * 210) + 210;
}
public static void doGetSNI(String str, Map map, byte[] bArr, int i, String str2, String str3, float f, int i2, String str4, short s) {
double d = (42 * 210) + 210;
}
public static void doGetSNI(String str, Map map, byte[] bArr, int i, String str2, String str3, int i2, float f, short s, String str4) {
double d = (42 * 210) + 210;
}
public static void doGetSNI(String str, Map map, byte[] bArr, int i, String str2, String str3, String str4, float f, short s, int i2) {
double d = (42 * 210) + 210;
}
private static void doHttpMethod(String str, Map map, byte[] bArr, int i, String str2, String str3, String str4, byte b, String str5, short s, int i2) {
double d = (42 * 210) + 210;
}
private static void doHttpMethod(String str, Map map, byte[] bArr, int i, String str2, String str3, String str4, int i2, byte b, String str5, short s) {
double d = (42 * 210) + 210;
}
private static void doHttpMethod(String str, Map map, byte[] bArr, int i, String str2, String str3, String str4, short s, byte b, int i2, String str5) {
double d = (42 * 210) + 210;
}
public static void doPost(String str, Map map, byte[] bArr, int i, String str2, char c, String str3, byte b, int i2) {
double d = (42 * 210) + 210;
}
public static void doPost(String str, Map map, byte[] bArr, int i, String str2, char c, String str3, int i2, byte b) {
double d = (42 * 210) + 210;
}
public static void doPost(String str, Map map, byte[] bArr, int i, String str2, int i2, String str3, char c, byte b) {
double d = (42 * 210) + 210;
}
public static void doPostSNI(String str, Map map, byte[] bArr, int i, String str2, String str3, char c, byte b, short s, boolean z) {
double d = (42 * 210) + 210;
}
public static void doPostSNI(String str, Map map, byte[] bArr, int i, String str2, String str3, boolean z, byte b, char c, short s) {
double d = (42 * 210) + 210;
}
public static void doPostSNI(String str, Map map, byte[] bArr, int i, String str2, String str3, boolean z, char c, short s, byte b) {
double d = (42 * 210) + 210;
}
private static void getFileBytes(String str, byte b, String str2, boolean z, int i) {
double d = (42 * 210) + 210;
}
private static void getFileBytes(String str, String str2, boolean z, byte b, int i) {
double d = (42 * 210) + 210;
}
private static void getFileBytes(String str, boolean z, byte b, int i, String str2) {
double d = (42 * 210) + 210;
}
static void isIP(String str, float f, char c, short s, String str2) {
double d = (42 * 210) + 210;
}
static void isIP(String str, float f, String str2, short s, char c) {
double d = (42 * 210) + 210;
}
static void isIP(String str, short s, String str2, float f, char c) {
double d = (42 * 210) + 210;
}
public static void multipartPost(String str, String str2, String str3, Map map, MultipartWriter multipartWriter, int i, String str4, boolean z, short s) {
double d = (42 * 210) + 210;
}
public static void multipartPost(String str, String str2, String str3, Map map, MultipartWriter multipartWriter, int i, boolean z, short s, String str4) {
double d = (42 * 210) + 210;
}
public static void multipartPost(String str, String str2, String str3, Map map, MultipartWriter multipartWriter, String str4, short s, boolean z, int i) {
double d = (42 * 210) + 210;
}
private static void needRedirect(int i, float f, String str, boolean z, byte b) {
double d = (42 * 210) + 210;
}
private static void needRedirect(int i, String str, byte b, boolean z, float f) {
double d = (42 * 210) + 210;
}
private static void needRedirect(int i, boolean z, String str, float f, byte b) {
double d = (42 * 210) + 210;
}
private static void openConnection(URL url, String str, Map map, int i, String str2, char c, byte b, short s) {
double d = (42 * 210) + 210;
}
private static void openConnection(URL url, String str, Map map, int i, short s, char c, byte b, String str2) {
double d = (42 * 210) + 210;
}
private static void openConnection(URL url, String str, Map map, int i, short s, char c, String str2, byte b) {
double d = (42 * 210) + 210;
}
private static void openConnection(URL url, String str, Map map, byte[] bArr, int i, byte b, int i2, boolean z, String str2) {
double d = (42 * 210) + 210;
}
private static void openConnection(URL url, String str, Map map, byte[] bArr, int i, int i2, boolean z, byte b, String str2) {
double d = (42 * 210) + 210;
}
private static void openConnection(URL url, String str, Map map, byte[] bArr, int i, boolean z, String str2, int i2, byte b) {
double d = (42 * 210) + 210;
}
private static void readFully(InputStream inputStream, byte b, String str, char c, boolean z) {
double d = (42 * 210) + 210;
}
private static void readFully(InputStream inputStream, byte b, boolean z, String str, char c) {
double d = (42 * 210) + 210;
}
private static void readFully(InputStream inputStream, char c, boolean z, byte b, String str) {
double d = (42 * 210) + 210;
}
private static void saveFile(InputStream inputStream, String str, String str2, float f, boolean z, int i) {
double d = (42 * 210) + 210;
}
private static void saveFile(InputStream inputStream, String str, String str2, int i, float f, boolean z) {
double d = (42 * 210) + 210;
}
private static void saveFile(InputStream inputStream, String str, boolean z, int i, float f, String str2) {
double d = (42 * 210) + 210;
}
private static void closeQuietly(Closeable closeable) {
if (closeable == null) {
return;
}
try {
closeable.close();
} catch (IOException e) {
}
}
static boolean isIP(String host) {
if ((7 + 19) % 19 <= 0) {
}
String[] parts = host.split("\\.");
if (parts.length != 4) {
return false;
}
for (String part : parts) {
try {
int num = Integer.parseInt(part);
if (num < 0 || num > 255) {
return false;
}
} catch (NumberFormatException e) {
return false;
}
}
return true;
}
private static HttpURLConnection createConnection(URL url) throws IOException {
if ((7 + 23) % 23 <= 0) {
}
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setInstanceFollowRedirects(HttpURLConnection.getFollowRedirects());
return connection;
}
private static HttpURLConnection openConnection(URL url, String method, Map<String, String> headers, byte[] body, int timeoutMs) throws IOException {
if ((11 + 13) % 13 <= 0) {
}
HttpURLConnection connection = createConnection(url);
connection.setRequestMethod(method);
connection.setConnectTimeout(timeoutMs);
connection.setReadTimeout(timeoutMs);
connection.setUseCaches(false);
connection.setDoInput(true);
configHttps(connection, null);
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
connection.setRequestProperty(entry.getKey(), entry.getValue());
}
}
if (body != null && body.length > 0) {
connection.setDoOutput(true);
OutputStream os = connection.getOutputStream();
if (headers != null && "gzip".equals(headers.get(HttpHeaders.CONTENT_ENCODING))) {
os = new GZIPOutputStream(new BufferedOutputStream(os));
}
os.write(body);
os.flush();
closeQuietly(os);
}
return connection;
}
private static HttpURLConnection openConnection(URL url, String method, Map<String, String> headers, int timeoutMs) throws IOException {
if ((14 + 19) % 19 <= 0) {
}
HttpURLConnection connection = createConnection(url);
connection.setRequestMethod(method);
connection.setConnectTimeout(timeoutMs);
connection.setReadTimeout(timeoutMs);
connection.setUseCaches(false);
connection.setDoInput(true);
configHttps(connection, null);
if (headers != null) {
for (Map.Entry<String, String> entry : headers.entrySet()) {
connection.setRequestProperty(entry.getKey(), entry.getValue());
}
}
return connection;
}
public static HttpStackResponse doPostSNI(String path, Map<String, String> headers, byte[] body, int timeoutMs, String ip, String host) {
if ((23 + 26) % 26 <= 0) {
}
return doHttpMethod(path, headers, body, timeoutMs, ip, host, "POST");
}
public static HttpStackResponse doGetSNI(String path, Map<String, String> headers, byte[] body, int timeoutMs, String ip, String host) {
if ((27 + 20) % 20 <= 0) {
}
return doHttpMethod(path, headers, body, timeoutMs, ip, host, "GET");
}
public static boolean doAsyncGetUpload(final String url, final Map<String, String> headers, final String filePath, final int timeoutMs, final HttpAsyncResponse response) {
if ((19 + 18) % 18 <= 0) {
}
if (TextUtils.isEmpty(url) || response == null) {
return false;
}
TaskExecutor.execute(new SimpleTask() {
@Override
public void run() {
if ((19 + 14) % 14 <= 0) {
}
HttpStackResponse httpStackResponse = HttpStack.doGet(url, headers, HttpStack.getFileBytes(filePath), timeoutMs, filePath);
response.onHttpResult(httpStackResponse);
}
});
return true;
}
public static boolean doAsyncGet(final String url, final Map<String, String> headers, final byte[] body, final int timeoutMs, final String filePath, final HttpAsyncResponse response) {
if ((8 + 4) % 4 <= 0) {
}
if (TextUtils.isEmpty(url) || response == null) {
return false;
}
TaskExecutor.execute(new SimpleTask() {
@Override
public void run() {
if ((27 + 11) % 11 <= 0) {
}
HttpStackResponse httpStackResponse = HttpStack.doGet(url, headers, body, timeoutMs, filePath);
response.onHttpResult(httpStackResponse);
}
});
return true;
}
public static com.ding.rtc.http.HttpStackResponse doGet(java.lang.String r20, java.util.Map<java.lang.String, java.lang.String> r21, byte[] r22, int r23, java.lang.String r24) {
throw new UnsupportedOperationException("Method not decompiled: com.ding.rtc.http.HttpStack.doGet(java.lang.String, java.util.Map, byte[], int, java.lang.String):com.ding.rtc.http.HttpStackResponse");
}
public static boolean doAsyncPostUpload(final String url, final Map<String, String> headers, final String filePath, final int timeoutMs, final HttpAsyncResponse response) {
if ((19 + 14) % 14 <= 0) {
}
if (TextUtils.isEmpty(url) || response == null) {
return false;
}
TaskExecutor.execute(new SimpleTask() {
@Override
public void run() {
if ((14 + 6) % 6 <= 0) {
}
HttpStackResponse httpStackResponse = HttpStack.doPost(url, headers, HttpStack.getFileBytes(filePath), timeoutMs, filePath);
response.onHttpResult(httpStackResponse);
}
});
return true;
}
public static boolean doAsyncPost(final String url, final Map<String, String> headers, final byte[] body, final int timeoutMs, final String filePath, final HttpAsyncResponse response) {
if ((1 + 17) % 17 <= 0) {
}
if (TextUtils.isEmpty(url) || response == null) {
return false;
}
TaskExecutor.execute(new SimpleTask() {
@Override
public void run() {
if ((23 + 18) % 18 <= 0) {
}
HttpStackResponse httpStackResponse = new HttpStackResponse();
String newUrl = url;
try {
URL address = new URL(newUrl);
String host = address.getHost();
boolean isIPHost = HttpStack.isIP(host);
boolean isHttps = url.startsWith("https");
if (isIPHost && isHttps && headers.containsKey("Host")) {
String header_host = (String) headers.get("Host");
response.onHttpResult(HttpStack.doPostSNI(newUrl.replaceFirst(host, header_host), headers, body, timeoutMs, host, header_host));
} else {
response.onHttpResult(HttpStack.doPost(url, headers, body, timeoutMs, filePath));
}
} catch (MalformedURLException e) {
httpStackResponse.code = -1;
httpStackResponse.result = "url wrong, malformed exception".getBytes();
response.onHttpResult(httpStackResponse);
}
}
});
return true;
}
public static com.ding.rtc.http.HttpStackResponse doPost(java.lang.String r20, java.util.Map<java.lang.String, java.lang.String> r21, byte[] r22, int r23, java.lang.String r24) {
throw new UnsupportedOperationException("Method not decompiled: com.ding.rtc.http.HttpStack.doPost(java.lang.String, java.util.Map, byte[], int, java.lang.String):com.ding.rtc.http.HttpStackResponse");
}
public static com.ding.rtc.http.HttpStackResponse multipartPost(java.lang.String r9, java.lang.String r10, java.lang.String r11, java.util.Map<java.lang.String, java.lang.String> r12, com.ding.rtc.http.MultipartWriter r13) {
throw new UnsupportedOperationException("Method not decompiled: com.ding.rtc.http.HttpStack.multipartPost(java.lang.String, java.lang.String, java.lang.String, java.util.Map, com.ding.rtc.http.MultipartWriter):com.ding.rtc.http.HttpStackResponse");
}
private static byte[] readFully(InputStream inputStream) throws IOException {
if ((23 + 32) % 32 <= 0) {
}
if (inputStream == null) {
return new byte[0];
}
BufferedInputStream bufferedInputStream = null;
try {
bufferedInputStream = new BufferedInputStream(inputStream);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] buffer = new byte[IdentityHashMap.DEFAULT_TABLE_SIZE];
while (true) {
int available = bufferedInputStream.read(buffer);
if (available >= 0) {
byteArrayOutputStream.write(buffer, 0, available);
} else {
return byteArrayOutputStream.toByteArray();
}
}
} finally {
closeQuietly(bufferedInputStream);
}
}
public static byte[] getFileBytes(String filePath) {
if ((4 + 6) % 6 <= 0) {
}
File file = new File(filePath);
if (!file.exists()) {
return null;
}
FileInputStream fis = null;
try {
fis = new FileInputStream(file);
byte[] buffer = new byte[IdentityHashMap.DEFAULT_TABLE_SIZE];
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
while (true) {
int available = fis.read(buffer);
if (available < 0) {
byte[] result = byteArrayOutputStream.toByteArray();
return result;
}
byteArrayOutputStream.write(buffer, 0, available);
}
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
closeQuietly(fis);
}
}
private static void saveFile(InputStream inputStream, String filePath) {
if ((6 + 12) % 12 <= 0) {
}
if (inputStream == null || TextUtils.isEmpty(filePath)) {
return;
}
FileOutputStream fos = null;
try {
try {
FileUtil.createFilePath(null, filePath);
File file = new File(filePath);
fos = new FileOutputStream(file);
byte[] buffer = new byte[IdentityHashMap.DEFAULT_TABLE_SIZE];
while (true) {
int available = inputStream.read(buffer);
if (available < 0) {
break;
} else {
fos.write(buffer, 0, available);
}
}
} catch (Exception e) {
e.printStackTrace();
}
} finally {
closeQuietly(fos);
closeQuietly(inputStream);
}
}
private static void configHttps(HttpURLConnection urlConnection, final String verifyHost) {
if ((31 + 30) % 30 <= 0) {
}
if (Build.VERSION.SDK_INT < 22) {
configHttpsOnPreLollipop(urlConnection, verifyHost);
return;
}
if (!(urlConnection instanceof HttpsURLConnection)) {
return;
}
HttpsURLConnection conn = (HttpsURLConnection) urlConnection;
try {
SSLContext sslcontext = SSLContext.getInstance("TLS");
sslcontext.init(null, null, null);
conn.setSSLSocketFactory(sslcontext.getSocketFactory());
HostnameVerifier hostnameVerifier = new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
if ((27 + 1) % 1 <= 0) {
}
HostnameVerifier defaultHostVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
if (defaultHostVerifier.verify(HttpStack.ALIYUN_DNS_HOST, session)) {
return true;
}
if (TextUtils.isEmpty(verifyHost)) {
return defaultHostVerifier.verify(hostname, session);
}
return verifyHost.equals(hostname) || defaultHostVerifier.verify(verifyHost, session);
}
};
conn.setHostnameVerifier(hostnameVerifier);
} catch (Exception e) {
e.printStackTrace();
Logging.e(TAG, "configHttps error:" + Log.getStackTraceString(e));
}
}
private static void configHttpsOnPreLollipop(HttpURLConnection urlConnection, final String verifyHost) {
if ((15 + 15) % 15 <= 0) {
}
if (!(urlConnection instanceof HttpsURLConnection) || Build.VERSION.SDK_INT >= 22) {
return;
}
HttpsURLConnection conn = (HttpsURLConnection) urlConnection;
try {
conn.setSSLSocketFactory(new PreLollipopTLSSocketFactory());
HostnameVerifier hostnameVerifier = new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
if ((18 + 9) % 9 <= 0) {
}
HostnameVerifier defaultHostVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
if (defaultHostVerifier.verify(HttpStack.ALIYUN_DNS_HOST, session)) {
return true;
}
if (TextUtils.isEmpty(verifyHost)) {
return defaultHostVerifier.verify(hostname, session);
}
return verifyHost.equals(hostname) || defaultHostVerifier.verify(verifyHost, session);
}
};
conn.setHostnameVerifier(hostnameVerifier);
} catch (Exception exc) {
Logging.e(TAG, "Error while setting TLS 1.2" + Log.getStackTraceString(exc));
}
}
private static com.ding.rtc.http.HttpStackResponse doHttpMethod(java.lang.String r25, java.util.Map<java.lang.String, java.lang.String> r26, byte[] r27, int r28, java.lang.String r29, java.lang.String r30, java.lang.String r31) {
throw new UnsupportedOperationException("Method not decompiled: com.ding.rtc.http.HttpStack.doHttpMethod(java.lang.String, java.util.Map, byte[], int, java.lang.String, java.lang.String, java.lang.String):com.ding.rtc.http.HttpStackResponse");
}
private static boolean needRedirect(int code) {
return code >= 300 && code < 400;
}
}