104 lines
3.0 KiB
Java
104 lines
3.0 KiB
Java
|
package o;
|
||
|
|
||
|
import android.net.NetworkInfo;
|
||
|
import android.os.Handler;
|
||
|
import com.squareup.picasso.Picasso;
|
||
|
import java.io.IOException;
|
||
|
import o.AbstractC12987fNZ;
|
||
|
import okhttp3.CacheControl;
|
||
|
import okhttp3.Request;
|
||
|
import okhttp3.Response;
|
||
|
import okhttp3.ResponseBody;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class fNN extends AbstractC12987fNZ {
|
||
|
private final C13022fOc a;
|
||
|
private final fNJ d;
|
||
|
|
||
|
@Override // o.AbstractC12987fNZ
|
||
|
final boolean c() {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC12987fNZ
|
||
|
final int e() {
|
||
|
return 2;
|
||
|
}
|
||
|
|
||
|
public fNN(fNJ fnj, C13022fOc c13022fOc) {
|
||
|
this.d = fnj;
|
||
|
this.a = c13022fOc;
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC12987fNZ
|
||
|
public final boolean d(fNW fnw) {
|
||
|
String scheme = fnw.r.getScheme();
|
||
|
return "http".equals(scheme) || "https".equals(scheme);
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC12987fNZ
|
||
|
final boolean aBy_(NetworkInfo networkInfo) {
|
||
|
return networkInfo == null || networkInfo.isConnected();
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
static class HBt extends IOException {
|
||
|
public HBt(String str) {
|
||
|
super(str);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
static final class LWm extends IOException {
|
||
|
final int b;
|
||
|
final int c;
|
||
|
|
||
|
LWm(int i, int i2) {
|
||
|
super("HTTP ".concat(String.valueOf(i)));
|
||
|
this.b = i;
|
||
|
this.c = i2;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC12987fNZ
|
||
|
public final AbstractC12987fNZ.Sts c(fNW fnw, int i) throws IOException {
|
||
|
CacheControl cacheControl;
|
||
|
if (i == 0) {
|
||
|
cacheControl = null;
|
||
|
} else if (fNO.e(i)) {
|
||
|
cacheControl = CacheControl.FORCE_CACHE;
|
||
|
} else {
|
||
|
CacheControl.Builder builder = new CacheControl.Builder();
|
||
|
if (!fNO.b(i)) {
|
||
|
builder.noCache();
|
||
|
}
|
||
|
if (!fNO.c(i)) {
|
||
|
builder.noStore();
|
||
|
}
|
||
|
cacheControl = builder.build();
|
||
|
}
|
||
|
Request.Builder url = new Request.Builder().url(fnw.r.toString());
|
||
|
if (cacheControl != null) {
|
||
|
url.cacheControl(cacheControl);
|
||
|
}
|
||
|
Response b = this.d.b(url.build());
|
||
|
ResponseBody body = b.body();
|
||
|
if (!b.isSuccessful()) {
|
||
|
body.close();
|
||
|
throw new LWm(b.code(), fnw.g);
|
||
|
}
|
||
|
Picasso.HBt hBt = b.cacheResponse() == null ? Picasso.HBt.NETWORK : Picasso.HBt.DISK;
|
||
|
if (hBt == Picasso.HBt.DISK && body.contentLength() == 0) {
|
||
|
body.close();
|
||
|
throw new HBt("Received response with 0 content-length header.");
|
||
|
}
|
||
|
if (hBt == Picasso.HBt.NETWORK && body.contentLength() > 0) {
|
||
|
C13022fOc c13022fOc = this.a;
|
||
|
long contentLength = body.contentLength();
|
||
|
Handler handler = c13022fOc.i;
|
||
|
handler.sendMessage(handler.obtainMessage(4, Long.valueOf(contentLength)));
|
||
|
}
|
||
|
return new AbstractC12987fNZ.Sts(body.source(), hBt);
|
||
|
}
|
||
|
}
|