91快播 v3.3.0版本的 MD5 值为:094b9519ad2388a8147509cb8a126145

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


package anta.ᆁ;

import android.text.TextUtils;
import android.util.Log;
import android.webkit.MimeTypeMap;
import androidx.recyclerview.widget.RecyclerView;
import anta.ၦ.InterfaceC2305;
import anta.ᅤ.InterfaceC2616;
import anta.㮌.C9125;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Map;
import java.util.Objects;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
public class C2624 implements InterfaceC2627 {
    public final InterfaceC2616 f6297;
    public final HostnameVerifier f6298;
    public C2636 f6299;
    public final InterfaceC2305 f6300;
    public final TrustManager[] f6301;
    public HttpURLConnection f6302;
    public InputStream f6303;

    public C2624(String str, InterfaceC2616 interfaceC2616, InterfaceC2305 interfaceC2305, HostnameVerifier hostnameVerifier, TrustManager[] trustManagerArr) {
        Objects.requireNonNull(interfaceC2616);
        this.f6297 = interfaceC2616;
        Objects.requireNonNull(interfaceC2305);
        this.f6300 = interfaceC2305;
        this.f6298 = hostnameVerifier;
        this.f6301 = trustManagerArr;
        C2636 mo2651 = interfaceC2616.mo2651(str);
        if (mo2651 == null) {
            MimeTypeMap singleton = MimeTypeMap.getSingleton();
            String fileExtensionFromUrl = MimeTypeMap.getFileExtensionFromUrl(str);
            mo2651 = new C2636(str, -2147483648L, TextUtils.isEmpty(fileExtensionFromUrl) ? null : singleton.getMimeTypeFromExtension(fileExtensionFromUrl));
        }
        this.f6299 = mo2651;
    }

    @Override
    public void close() {
        HttpURLConnection httpURLConnection = this.f6302;
        if (httpURLConnection != null) {
            try {
                httpURLConnection.disconnect();
            } catch (ArrayIndexOutOfBoundsException e) {
                C2639.m2678("Error closing connection correctly. Should happen only on Android L. If anybody know how to fix it, please visit https://github.com/danikula/AndroidVideoCache/issues/88. Until good solution is not know, just ignore this issue :(", e);
            } catch (IllegalArgumentException e2) {
                e = e2;
                throw new RuntimeException("Wait... but why? WTF!? Really shouldn't happen any more after fixing https://github.com/danikula/AndroidVideoCache/issues/43. If you read it on your device log, please, notify me danikula@gmail.com or create issue here https://github.com/danikula/AndroidVideoCache/issues.", e);
            } catch (NullPointerException e3) {
                e = e3;
                throw new RuntimeException("Wait... but why? WTF!? Really shouldn't happen any more after fixing https://github.com/danikula/AndroidVideoCache/issues/43. If you read it on your device log, please, notify me danikula@gmail.com or create issue here https://github.com/danikula/AndroidVideoCache/issues.", e);
            }
        }
    }

    @Override
    public synchronized long length() {
        if (this.f6299.f6321 == -2147483648L) {
            m2664();
        }
        return this.f6299.f6321;
    }

    public String toString() {
        StringBuilder m8071 = C9125.m8071("HttpUrlSource{sourceInfo='");
        m8071.append(this.f6299);
        m8071.append("}");
        return m8071.toString();
    }

    @Override
    public int mo2663(byte[] bArr) {
        InputStream inputStream = this.f6303;
        if (inputStream != null) {
            try {
                return inputStream.read(bArr, 0, bArr.length);
            } catch (InterruptedIOException e) {
                throw new C2631(C9125.m8068(C9125.m8071("Reading source "), this.f6299.f6319, " is interrupted"), e);
            } catch (IOException e2) {
                StringBuilder m8071 = C9125.m8071("Error reading data from ");
                m8071.append(this.f6299.f6319);
                throw new C2628(m8071.toString(), e2);
            }
        }
        throw new C2628(C9125.m8068(C9125.m8071("Error reading data from "), this.f6299.f6319, ": connection is absent!"));
    }

    public final void m2664() {
        HttpURLConnection httpURLConnection;
        HttpURLConnection httpURLConnection2;
        InputStream inputStream = null;
        try {
            httpURLConnection2 = m2666(0L, 10000);
            try {
                try {
                    String headerField = httpURLConnection2.getHeaderField("Content-Length");
                    long parseLong = headerField == null ? -1L : Long.parseLong(headerField);
                    String contentType = httpURLConnection2.getContentType();
                    inputStream = httpURLConnection2.getInputStream();
                    String str = this.f6299.f6319;
                    C2636 c2636 = new C2636(str, parseLong, contentType);
                    this.f6299 = c2636;
                    this.f6297.mo2650(str, c2636);
                    C2625.m2667(inputStream);
                } catch (IOException e) {
                    e = e;
                    C2639.m2678("Error fetching info from " + this.f6299.f6319, e);
                    C2625.m2667(inputStream);
                    if (httpURLConnection2 == null) {
                        return;
                    }
                    httpURLConnection2.disconnect();
                }
            } catch (Throwable th) {
                InputStream inputStream2 = inputStream;
                HttpURLConnection httpURLConnection3 = httpURLConnection2;
                inputStream = inputStream2;
                th = th;
                httpURLConnection = httpURLConnection3;
                C2625.m2667(inputStream);
                if (httpURLConnection != null) {
                    httpURLConnection.disconnect();
                }
                throw th;
            }
        } catch (IOException e2) {
            e = e2;
            httpURLConnection2 = null;
        } catch (Throwable th2) {
            th = th2;
            httpURLConnection = null;
            C2625.m2667(inputStream);
            if (httpURLConnection != null) {
            }
            throw th;
        }
        httpURLConnection2.disconnect();
    }

    @Override
    public void mo2665(long j) {
        try {
            HttpURLConnection m2666 = m2666(j, -1);
            this.f6302 = m2666;
            String contentType = m2666.getContentType();
            this.f6303 = new BufferedInputStream(this.f6302.getInputStream(), RecyclerView.AbstractC0157.FLAG_BOUNCED_FROM_HIDDEN_LIST);
            HttpURLConnection httpURLConnection = this.f6302;
            int responseCode = httpURLConnection.getResponseCode();
            String headerField = httpURLConnection.getHeaderField("Content-Length");
            long parseLong = headerField == null ? -1L : Long.parseLong(headerField);
            if (responseCode != 200) {
                parseLong = responseCode == 206 ? parseLong + j : this.f6299.f6321;
            }
            String str = this.f6299.f6319;
            C2636 c2636 = new C2636(str, parseLong, contentType);
            this.f6299 = c2636;
            this.f6297.mo2650(str, c2636);
        } catch (IOException e) {
            StringBuilder m8071 = C9125.m8071("Error opening connection for ");
            m8071.append(this.f6299.f6319);
            m8071.append(" with offset ");
            m8071.append(j);
            throw new C2628(m8071.toString(), e);
        }
    }

    public final HttpURLConnection m2666(long j, int i) {
        HttpURLConnection httpURLConnection;
        boolean z;
        String str = this.f6299.f6319;
        int i2 = 0;
        do {
            if (str.startsWith("https") && this.f6298 != null && this.f6301 != null) {
                httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
                ((HttpsURLConnection) httpURLConnection).setHostnameVerifier(this.f6298);
                try {
                    SSLContext sSLContext = SSLContext.getInstance("SSL");
                    sSLContext.init(null, this.f6301, new SecureRandom());
                    ((HttpsURLConnection) httpURLConnection).setSSLSocketFactory(sSLContext.getSocketFactory());
                    ((HttpsURLConnection) httpURLConnection).setHostnameVerifier(this.f6298);
                } catch (KeyManagementException | NoSuchAlgorithmException e) {
                    e.printStackTrace();
                }
            } else {
                httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
            }
            Map<String, String> mo2293 = this.f6300.mo2293(str);
            if (mo2293 != null) {
                StringBuilder m8071 = C9125.m8071("****** injectCustomHeaders ****** :");
                m8071.append(mo2293.size());
                String sb = m8071.toString();
                if (!TextUtils.isEmpty(sb)) {
                    Log.e("HttpProxyCacheDebuger", sb);
                }
                for (Map.Entry<String, String> entry : mo2293.entrySet()) {
                    httpURLConnection.setRequestProperty(entry.getKey(), entry.getValue());
                }
            }
            if (j > 0) {
                httpURLConnection.setRequestProperty("Range", "bytes=" + j + "-");
            }
            if (i > 0) {
                httpURLConnection.setConnectTimeout(i);
                httpURLConnection.setReadTimeout(i);
            }
            int responseCode = httpURLConnection.getResponseCode();
            z = responseCode == 301 || responseCode == 302 || responseCode == 303;
            if (z) {
                str = httpURLConnection.getHeaderField("Location");
                i2++;
                httpURLConnection.disconnect();
            }
            if (i2 > 5) {
                throw new C2628(C9125.m8086("Too many redirects: ", i2));
            }
        } while (z);
        return httpURLConnection;
    }

    public C2624(C2624 c2624) {
        this.f6299 = c2624.f6299;
        this.f6297 = c2624.f6297;
        this.f6300 = c2624.f6300;
        this.f6301 = c2624.f6301;
        this.f6298 = c2624.f6298;
    }
}