package XnFJ5_9.Ft6VRog_36.Xgtqvk_8;

import XnFJ5_9.G83uNX_24;
import XnFJ5_9.JZJr_16;
import XnFJ5_9.NQvZgp_17;
import XnFJ5_9.SI64pbG_23;
import XnFJ5_9.WkDTNqU_32;
import java.util.List;
/* compiled from: HttpHeaders.java */
/* loaded from: classes.dex */
public final class X6FRs_4 {
    static {
        Nm6q_10.FSaI4_7.PGPF6hQ_2("\"\\");
        Nm6q_10.FSaI4_7.PGPF6hQ_2("\t ,=");
    }

    public static long KQgRr5e_0(WkDTNqU_32 wkDTNqU_32) {
        return KQgRr5e_0(wkDTNqU_32.m796KQgRr5e_0());
    }

    public static int QxJ9d_1(String str, int i) {
        char charAt;
        while (i < str.length() && ((charAt = str.charAt(i)) == ' ' || charAt == '\t')) {
            i++;
        }
        return i;
    }

    public static long KQgRr5e_0(SI64pbG_23 sI64pbG_23) {
        return KQgRr5e_0(sI64pbG_23.m769KQgRr5e_0("Content-Length"));
    }

    public static long KQgRr5e_0(String str) {
        if (str == null) {
            return -1L;
        }
        try {
            return Long.parseLong(str);
        } catch (NumberFormatException unused) {
            return -1L;
        }
    }

    public static void KQgRr5e_0(NQvZgp_17 nQvZgp_17, G83uNX_24 g83uNX_24, SI64pbG_23 sI64pbG_23) {
        if (nQvZgp_17 == NQvZgp_17.KQgRr5e_0) {
            return;
        }
        List<JZJr_16> KQgRr5e_0 = JZJr_16.KQgRr5e_0(g83uNX_24, sI64pbG_23);
        if (KQgRr5e_0.isEmpty()) {
            return;
        }
        nQvZgp_17.KQgRr5e_0(g83uNX_24, KQgRr5e_0);
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public static boolean m736KQgRr5e_0(WkDTNqU_32 wkDTNqU_32) {
        if (wkDTNqU_32.m794KQgRr5e_0().m664KQgRr5e_0().equals("HEAD")) {
            return false;
        }
        int KQgRr5e_0 = wkDTNqU_32.KQgRr5e_0();
        return (((KQgRr5e_0 >= 100 && KQgRr5e_0 < 200) || KQgRr5e_0 == 204 || KQgRr5e_0 == 304) && KQgRr5e_0(wkDTNqU_32) == -1 && !"chunked".equalsIgnoreCase(wkDTNqU_32.KQgRr5e_0("Transfer-Encoding"))) ? false : true;
    }

    public static int KQgRr5e_0(String str, int i, String str2) {
        while (i < str.length() && str2.indexOf(str.charAt(i)) == -1) {
            i++;
        }
        return i;
    }

    public static int KQgRr5e_0(String str, int i) {
        try {
            long parseLong = Long.parseLong(str);
            if (parseLong > 2147483647L) {
                return Integer.MAX_VALUE;
            }
            if (parseLong < 0) {
                return 0;
            }
            return (int) parseLong;
        } catch (NumberFormatException unused) {
            return i;
        }
    }
}
