360手机助手 v3.3.0版本的 MD5 值为:127c345ad16bbebee6e347381328afd0
以下内容为反编译后的 c.java 源代码,内容仅作参考
package com.qihoo.appstore.http;
import android.os.SystemClock;
import android.text.TextUtils;
import com.qihoo.appstore.newsearch.bf;
import com.qihoo.appstore.utils.bk;
import com.qihoo.appstore.utils.db;
import com.qihoo.appstore.utils.dc;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
public class c {
private final com.qihoo.appstore.http.netconfig.b f1686a = com.qihoo.appstore.http.netconfig.c.b();
private HttpURLConnection a(String str, String str2, boolean z, boolean z2, HashMap hashMap, long[] jArr) {
CharSequence charSequence;
String str3;
boolean z3;
boolean z4;
boolean z5;
String str4;
boolean z6;
boolean z7;
HttpURLConnection a2;
String str5;
boolean z8 = false;
String str6 = null;
CharSequence charSequence2 = null;
try {
str6 = URI.create(str).getHost();
} catch (Exception e) {
}
try {
String g = com.qihoo.appstore.utils.f.g(str6);
if (TextUtils.isEmpty(g)) {
z8 = false;
str5 = str;
} else {
z8 = true;
str5 = str.replace(str6, g);
}
charSequence = str6;
str3 = str6;
z3 = z8;
z5 = false;
str4 = str5;
z4 = false;
} catch (Exception e2) {
charSequence2 = str6;
charSequence = charSequence2;
str3 = str6;
z3 = z8;
z4 = false;
z5 = false;
str4 = str;
while (true) {
if (!z3) {
}
try {
if (z2) {
}
if (!com.qihoo360.mobilesafe.a.a.f5313a) {
}
} catch (IOException e3) {
if (com.qihoo360.mobilesafe.a.a.f5313a) {
bk.b("HttpConnectionFactory", "newHttpConnection: " + str4 + " , connect failed");
}
if (z6 && z7) {
throw e3;
}
if (z3) {
z4 = z6;
z5 = z7;
z3 = false;
str4 = str;
} else {
if (z3) {
throw e3;
}
String str7 = dc.s.equals(str3) ? dc.t : str3;
String g2 = com.qihoo.appstore.utils.f.g(str7);
if (TextUtils.isEmpty(g2)) {
throw e3;
}
str4 = str.replace(charSequence, g2);
str3 = str7;
z3 = true;
z5 = z7;
z4 = z6;
}
}
}
return a2;
}
while (true) {
if (!z3) {
z6 = z4;
z7 = true;
} else {
z6 = true;
z7 = z5;
}
if (z2) {
a2 = a(str4, str2, z, z3 ? str3 : null, hashMap, jArr);
} else {
a2 = a(str4, str2, z3 ? str3 : null, hashMap, jArr);
}
if (!com.qihoo360.mobilesafe.a.a.f5313a) {
bk.b("HttpConnectionFactory", "newHttpConnection: " + str4 + " , connectted");
break;
}
break;
}
return a2;
}
private HttpURLConnection b(String str) {
com.qihoo.appstore.http.netconfig.a a2 = this.f1686a.a();
if (com.qihoo360.mobilesafe.a.a.f5313a) {
bk.b("HttpConnectionFactory", "Connection url..." + str);
}
String a3 = db.a(str);
if (com.qihoo360.mobilesafe.a.a.f5313a) {
bk.b("HttpConnectionFactory", "Connection urlEncode..." + a3);
}
if (com.qihoo360.mobilesafe.a.a.f5313a) {
bk.b("HttpConnectionFactory", "getNetType=" + a2.a());
}
switch (a2.a()) {
case -1:
throw new IOException("has no Connectivity");
case 0:
default:
return null;
case 1:
case 3:
case 5:
case 6:
return (HttpURLConnection) new URL(a3).openConnection();
case 2:
case 4:
return (HttpURLConnection) new URL(a3).openConnection();
}
}
public HttpURLConnection a(String str) {
return a(str, (String) null);
}
public HttpURLConnection a(String str, String str2) {
return a(str, str2, false, true, (HashMap) null, (long[]) null);
}
public HttpURLConnection a(String str, String str2, String str3, HashMap hashMap, long[] jArr) {
SSLContext sSLContext;
NoSuchAlgorithmException e;
KeyManagementException e2;
SSLContext sSLContext2;
HttpURLConnection b2;
try {
sSLContext = SSLContext.getInstance("TLS");
try {
sSLContext.init(null, new TrustManager[]{new d(this)}, null);
sSLContext2 = sSLContext;
} catch (KeyManagementException e3) {
e2 = e3;
e2.printStackTrace();
sSLContext2 = sSLContext;
b2 = b(str);
if (b2 instanceof HttpsURLConnection) {
((HttpsURLConnection) b2).setSSLSocketFactory(sSLContext2.getSocketFactory());
}
b2.setDoInput(true);
b2.setRequestMethod("GET");
b2.setRequestProperty("Charset", "UTF-8");
b2.setRequestProperty("accept", "*/*");
b2.addRequestProperty("Accept-Encoding", "gzip,deflate");
if (bf.f(str)) {
}
if (str3 != null) {
}
if (str2 != null) {
}
b2.setConnectTimeout(45000);
b2.setReadTimeout(45000);
b2.setRequestProperty("http.useragent", "Mozilla/5.0 (Linux; Android 4.1.1; Nexus S 4G Build/JRO03C) AppleWebKit/537.9 (KHTML, like Gecko) Chrome/23.0.1260.0 Mobile Safari/537.9, 360appstore");
if (hashMap != null) {
while (r3.hasNext()) {
}
}
if (jArr != null) {
jArr[0] = SystemClock.elapsedRealtime();
}
b2.connect();
if (jArr != null) {
jArr[1] = SystemClock.elapsedRealtime();
}
return b2;
} catch (NoSuchAlgorithmException e4) {
e = e4;
e.printStackTrace();
sSLContext2 = sSLContext;
b2 = b(str);
if (b2 instanceof HttpsURLConnection) {
}
b2.setDoInput(true);
b2.setRequestMethod("GET");
b2.setRequestProperty("Charset", "UTF-8");
b2.setRequestProperty("accept", "*/*");
b2.addRequestProperty("Accept-Encoding", "gzip,deflate");
if (bf.f(str)) {
}
if (str3 != null) {
}
if (str2 != null) {
}
b2.setConnectTimeout(45000);
b2.setReadTimeout(45000);
b2.setRequestProperty("http.useragent", "Mozilla/5.0 (Linux; Android 4.1.1; Nexus S 4G Build/JRO03C) AppleWebKit/537.9 (KHTML, like Gecko) Chrome/23.0.1260.0 Mobile Safari/537.9, 360appstore");
if (hashMap != null) {
}
if (jArr != null) {
}
b2.connect();
if (jArr != null) {
}
return b2;
}
} catch (KeyManagementException e5) {
sSLContext = null;
e2 = e5;
} catch (NoSuchAlgorithmException e6) {
sSLContext = null;
e = e6;
}
b2 = b(str);
if ((b2 instanceof HttpsURLConnection) && sSLContext2 != null) {
((HttpsURLConnection) b2).setSSLSocketFactory(sSLContext2.getSocketFactory());
}
b2.setDoInput(true);
b2.setRequestMethod("GET");
b2.setRequestProperty("Charset", "UTF-8");
b2.setRequestProperty("accept", "*/*");
b2.addRequestProperty("Accept-Encoding", "gzip,deflate");
if (bf.f(str)) {
b2.setRequestProperty("Referer", "http://www.so.com");
}
if (str3 != null) {
b2.setRequestProperty("host", str3);
}
if (str2 != null) {
b2.addRequestProperty("Cookie", str2);
}
b2.setConnectTimeout(45000);
b2.setReadTimeout(45000);
b2.setRequestProperty("http.useragent", "Mozilla/5.0 (Linux; Android 4.1.1; Nexus S 4G Build/JRO03C) AppleWebKit/537.9 (KHTML, like Gecko) Chrome/23.0.1260.0 Mobile Safari/537.9, 360appstore");
if (hashMap != null && hashMap.size() > 0) {
for (String str4 : hashMap.keySet()) {
b2.setRequestProperty(str4, (String) hashMap.get(str4));
}
}
if (jArr != null && jArr.length == 2) {
jArr[0] = SystemClock.elapsedRealtime();
}
b2.connect();
if (jArr != null && jArr.length == 2) {
jArr[1] = SystemClock.elapsedRealtime();
}
return b2;
}
public HttpURLConnection a(String str, String str2, boolean z) {
return a(str, str2, z, false, (HashMap) null, (long[]) null);
}
public HttpURLConnection a(String str, String str2, boolean z, String str3, HashMap hashMap, long[] jArr) {
HttpURLConnection b2 = b(str);
b2.setRequestMethod("POST");
b2.setDoInput(true);
b2.setDoOutput(true);
if (str3 != null) {
b2.setRequestProperty("host", str3);
}
b2.setRequestProperty("Charset", "UTF-8");
b2.setRequestProperty("accept", "*/*");
b2.addRequestProperty("Accept-Encoding", "gzip,deflate");
b2.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
if (z) {
b2.setRequestProperty("Content-Encoding", "gzip");
}
if (str2 != null) {
b2.addRequestProperty("Cookie", str2);
}
b2.setConnectTimeout(45000);
b2.setReadTimeout(45000);
b2.setRequestProperty("http.useragent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.125 Safari/533.4, 360appstore");
if (hashMap != null && hashMap.size() > 0) {
for (String str4 : hashMap.keySet()) {
b2.setRequestProperty(str4, (String) hashMap.get(str4));
}
}
if (jArr != null && jArr.length == 2) {
jArr[0] = SystemClock.elapsedRealtime();
}
b2.connect();
if (jArr != null && jArr.length == 2) {
jArr[1] = SystemClock.elapsedRealtime();
}
return b2;
}
public HttpURLConnection a(String str, HashMap hashMap, long[] jArr) {
return a(str, (String) null, false, true, hashMap, jArr);
}
public HttpURLConnection a(String str, boolean z) {
return a(str, (String) null, z, false, (HashMap) null, (long[]) null);
}
}