package io.fabric.sdk.android.services.common; import com.thoughtworks.xstream.XStream; import io.fabric.sdk.android.Kit; import io.fabric.sdk.android.services.network.HttpMethod; import io.fabric.sdk.android.services.network.HttpRequest; import io.fabric.sdk.android.services.network.HttpRequestFactory; import java.util.Collections; import java.util.Map; import java.util.regex.Pattern; /* loaded from: classes2.dex */ public abstract class AbstractSpiCall { private static final Pattern f = Pattern.compile("http(s?)://[^\\/]+", 2); private final String a; private final HttpRequestFactory b; private final HttpMethod c; private final String d; protected final Kit e; public AbstractSpiCall(Kit kit, String str, String str2, HttpRequestFactory httpRequestFactory, HttpMethod httpMethod) { if (str2 == null) { throw new IllegalArgumentException("url must not be null."); } if (httpRequestFactory == null) { throw new IllegalArgumentException("requestFactory must not be null."); } this.e = kit; this.d = str; this.a = a(str2); this.b = httpRequestFactory; this.c = httpMethod; } protected HttpRequest a() { return a(Collections.emptyMap()); } protected String b() { return this.a; } protected HttpRequest a(Map map) { HttpRequest a = this.b.a(this.c, b(), map); a.a(false); a.a(XStream.PRIORITY_VERY_HIGH); a.c("User-Agent", "Crashlytics Android SDK/" + this.e.i()); a.c("X-CRASHLYTICS-DEVELOPER-TOKEN", "470fa2b4ae81cd56ecbcda9735803434cec591fa"); return a; } private String a(String str) { return !CommonUtils.a(this.d) ? f.matcher(str).replaceFirst(this.d) : str; } }