导航菜单

页面标题

页面副标题

爱心e站 v1.0.0 - b.java 源代码

正在查看: 爱心e站 v1.0.0 应用的 b.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.tencent.mid.a;

import com.bumptech.glide.load.Key;
import com.tencent.mid.util.Util;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;

public class b {

    private HttpHost f1367a;
    private DefaultHttpClient b;
    private String c;
    private Map<String, String> d;
    private com.tencent.mid.util.d e;
    private int f = 30000;

    public d a(String str, byte[] bArr, String str2, int i) {
        String a2 = a(str);
        this.e.b("[" + a2 + "]Send request(" + bArr.length + "bytes):" + bArr);
        HttpPost httpPost = new HttpPost(a2);
        httpPost.setHeader("Connection", "Keep-Alive");
        httpPost.removeHeaders("Cache-Control");
        httpPost.removeHeaders("User-Agent");
        if (this.f1367a != null) {
            httpPost.addHeader("X-Online-Host", this.c);
            httpPost.addHeader("Accept", "*/*");
            httpPost.addHeader("Content-Type", "json");
        } else {
            this.b.getParams().removeParameter("http.route.default-proxy");
        }
        if (this.f1367a == null) {
            httpPost.addHeader("Content-Encoding", str2);
        } else {
            httpPost.addHeader("X-Content-Encoding", str2);
        }
        httpPost.setEntity(new ByteArrayEntity(bArr));
        HttpResponse execute = this.b.execute(httpPost);
        HttpEntity entity = execute.getEntity();
        int statusCode = execute.getStatusLine().getStatusCode();
        this.e.b("recv response status code:" + statusCode + ", content length:" + entity.getContentLength());
        byte[] byteArray = EntityUtils.toByteArray(entity);
        String str3 = "";
        Header firstHeader = execute.getFirstHeader("Content-Encoding");
        if (firstHeader != null) {
            if (firstHeader.getValue().toUpperCase().contains("AES")) {
                str3 = new String(c.a(c.a()).a(i).b(byteArray), Key.STRING_CHARSET_NAME);
            }
            if (firstHeader.getValue().toUpperCase().contains("RSA")) {
                str3 = com.tencent.mid.util.f.b(byteArray);
            }
            if (firstHeader.getValue().toUpperCase().contains("IDENTITY")) {
                str3 = new String(byteArray, Key.STRING_CHARSET_NAME);
            }
        }
        this.e.b("recv response status code:" + statusCode + ", content :" + str3);
        return new d(statusCode, str3);
    }

    public b(String str, Map<String, String> map) {
        this.f1367a = null;
        this.b = null;
        this.c = null;
        this.d = null;
        this.e = null;
        this.e = Util.getLogger();
        this.f1367a = Util.getHttpProxy();
        BasicHttpParams basicHttpParams = new BasicHttpParams();
        HttpConnectionParams.setConnectionTimeout(basicHttpParams, this.f);
        HttpConnectionParams.setSoTimeout(basicHttpParams, this.f);
        this.b = new DefaultHttpClient(basicHttpParams);
        this.e.b("proxy==" + (this.f1367a == null ? "null" : this.f1367a.getHostName()));
        if (this.f1367a != null) {
            this.b.getParams().setParameter("http.route.default-proxy", this.f1367a);
        }
        if (this.f1367a != null && this.f1367a.getHostName().equals("10.0.0.200")) {
            this.b.getCredentialsProvider().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("[email protected]", "vnet.mobi"));
        }
        Logger.getLogger("org.apache.http.wire").setLevel(Level.FINEST);
        Logger.getLogger("org.apache.http.headers").setLevel(Level.FINEST);
        System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
        System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
        System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire", "debug");
        System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http", "debug");
        System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.headers", "debug");
        this.b.setKeepAliveStrategy(new DefaultConnectionKeepAliveStrategy() {
            @Override
            public long getKeepAliveDuration(HttpResponse httpResponse, HttpContext httpContext) {
                long keepAliveDuration = super.getKeepAliveDuration(httpResponse, httpContext);
                if (keepAliveDuration == -1) {
                    return 20000L;
                }
                return keepAliveDuration;
            }
        });
        this.c = str;
        this.d = map;
    }

    public void a() {
        if (this.b != null) {
            this.b.getConnectionManager().shutdown();
            this.b = null;
            this.c = null;
            this.d = null;
            this.f1367a = null;
        }
    }

    private String b() {
        StringBuilder sb = new StringBuilder();
        if (this.d != null && this.d.size() != 0) {
            int i = 0;
            for (Map.Entry<String, String> entry : this.d.entrySet()) {
                sb.append(i == 0 ? "?" : "&");
                sb.append(entry.getKey());
                sb.append("=");
                sb.append(entry.getValue());
                i++;
            }
        }
        return sb.toString();
    }

    public String a(String str) {
        return this.c + str + b();
    }
}