Proxy Master v3.4.9版本的 MD5 值为:14d0aa2468d13530c8f6e96bcc114bf5

以下内容为反编译后的 cl.java 源代码,内容仅作参考


package com.flurry.sdk;

import android.net.TrafficStats;
import android.os.Build;
import android.text.TextUtils;
import com.flurry.sdk.cb;
import com.google.common.net.HttpHeaders;
import com.unity3d.services.UnityAdsConstants;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.util.HashMap;
import java.util.Locale;
import java.util.UUID;
import javax.net.ssl.HttpsURLConnection;
public final class cl extends co {
    private static String f5865i;
    private HttpsURLConnection f5866j;
    private String f5867k;
    private boolean f5868l;

    public cl(String str) {
        this.f5870a = str;
        StringBuilder sb2 = new StringBuilder("Flurry-Config/1.0 (Android ");
        sb2.append(Build.VERSION.RELEASE);
        sb2.append("/");
        f5865i = android.support.v4.media.b.q(sb2, Build.ID, ")");
    }

    private boolean b(String str) {
        String[] split;
        if (TextUtils.isEmpty(str)) {
            cx.b("HttpTransport", "Content-Signature is empty.");
            return false;
        }
        HashMap hashMap = new HashMap();
        for (String str2 : str.split(";")) {
            int indexOf = str2.indexOf("=");
            if (indexOf > 0) {
                hashMap.put(str2.substring(0, indexOf), str2.substring(indexOf + 1));
            }
        }
        String str3 = (String) hashMap.get("keyid");
        this.f5873d = str3;
        if (TextUtils.isEmpty(str3)) {
            cx.b("HttpTransport", "Error to get keyid from Signature.");
            return false;
        }
        this.f5874e = cr.f5879a.get(this.f5873d);
        cx.a(4, "HttpTransport", "Signature keyid: " + this.f5873d + ", key: " + this.f5874e);
        if (this.f5874e == null) {
            cx.b("HttpTransport", "Unknown keyid from Signature.");
            return false;
        }
        boolean containsKey = hashMap.containsKey("sha256ecdsa");
        this.f5868l = containsKey;
        String str4 = (String) hashMap.get(containsKey ? "sha256ecdsa" : "sha256rsa");
        this.f5875f = str4;
        if (TextUtils.isEmpty(str4)) {
            cx.b("HttpTransport", "Error to get rsa from Signature.");
            return false;
        }
        cx.a(4, "HttpTransport", "Signature rsa: " + this.f5875f);
        return true;
    }

    @Override
    public final InputStream a() {
        BufferedWriter bufferedWriter;
        Throwable th;
        OutputStream outputStream;
        HttpsURLConnection httpsURLConnection = (HttpsURLConnection) new URL(this.f5870a).openConnection();
        this.f5866j = httpsURLConnection;
        httpsURLConnection.setReadTimeout(10000);
        this.f5866j.setConnectTimeout(UnityAdsConstants.RequestPolicy.RETRY_MAX_DURATION);
        this.f5866j.setRequestMethod("POST");
        this.f5866j.setRequestProperty(HttpHeaders.USER_AGENT, f5865i);
        this.f5866j.setRequestProperty(HttpHeaders.CONTENT_TYPE, "application/json");
        this.f5866j.setDoInput(true);
        this.f5866j.setDoOutput(true);
        TrafficStats.setThreadStatsTag(1234);
        this.f5866j.connect();
        df.a(this.f5866j);
        this.f5872c = UUID.randomUUID().toString().toUpperCase(Locale.ENGLISH);
        try {
            outputStream = this.f5866j.getOutputStream();
            try {
                bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8"));
                try {
                    bufferedWriter.write(cn.a(this.f5872c));
                    bufferedWriter.close();
                    if (outputStream != null) {
                        outputStream.close();
                    }
                    int responseCode = this.f5866j.getResponseCode();
                    if (responseCode < 400) {
                        this.f5867k = this.f5866j.getHeaderField("Content-Signature");
                        this.f5876g = this.f5866j.getHeaderField(HttpHeaders.ETAG);
                        cx.a(4, "HttpTransport", "Content-Signature: " + this.f5867k + ", ETag: " + this.f5876g);
                        if (responseCode == 304) {
                            if (a(this.f5872c)) {
                                this.f5871b = cb.f5825b;
                                cx.a("HttpTransport", "Empty 304 payload; No Change.");
                            } else {
                                this.f5871b = new cb(cb.a.AUTHENTICATE, "GUID Signature Error.");
                                cx.b("HttpTransport", "Authentication error: " + this.f5871b);
                            }
                        }
                        return this.f5866j.getInputStream();
                    }
                    throw new IOException("Server response code is ".concat(String.valueOf(responseCode)));
                } catch (Throwable th2) {
                    th = th2;
                    if (bufferedWriter != null) {
                        bufferedWriter.close();
                    }
                    if (outputStream != null) {
                        outputStream.close();
                    }
                    throw th;
                }
            } catch (Throwable th3) {
                bufferedWriter = null;
                th = th3;
            }
        } catch (Throwable th4) {
            bufferedWriter = null;
            th = th4;
            outputStream = null;
        }
    }

    @Override
    public final boolean a(String str) {
        if (b(this.f5867k)) {
            if (this.f5868l ? cq.c(this.f5874e, str, this.f5875f) : cq.b(this.f5874e, str, this.f5875f)) {
                return true;
            }
            cx.b("HttpTransport", "Incorrect signature for response.");
            return false;
        }
        return false;
    }

    @Override
    public final void b() {
        HttpsURLConnection httpsURLConnection = this.f5866j;
        if (httpsURLConnection != null) {
            httpsURLConnection.disconnect();
        }
    }

    @Override
    public final boolean c() {
        return "https://cfg.flurry.com/sdk/v1/config".equals(this.f5870a);
    }
}