package j5; import h5.a0; import h5.d0; import h5.h0; import h5.i0; import h5.j0; import j5.b; /* loaded from: classes2.dex */ public final class a implements d0 { public a(c cVar) { } private static a0 b(a0 a0Var, a0 a0Var2) { a0.a aVar = new a0.a(); int e10 = a0Var.e(); for (int i10 = 0; i10 < e10; i10++) { String c10 = a0Var.c(i10); String f10 = a0Var.f(i10); if ((!"Warning".equalsIgnoreCase(c10) || !f10.startsWith("1")) && (d(c10) || !e(c10) || a0Var2.b(c10) == null)) { i5.a.f10869a.b(aVar, c10, f10); } } int e11 = a0Var2.e(); for (int i11 = 0; i11 < e11; i11++) { String c11 = a0Var2.c(i11); if (!d(c11) && e(c11)) { i5.a.f10869a.b(aVar, c11, a0Var2.f(i11)); } } return aVar.e(); } private static i0 c(i0 i0Var) { return (i0Var == null || i0Var.c() == null) ? i0Var : i0Var.a0().d(null).e(); } static boolean d(String str) { return "Content-Length".equalsIgnoreCase(str) || "Content-Encoding".equalsIgnoreCase(str) || "Content-Type".equalsIgnoreCase(str); } static boolean e(String str) { return ("Connection".equalsIgnoreCase(str) || "Keep-Alive".equalsIgnoreCase(str) || "Proxy-Authenticate".equalsIgnoreCase(str) || "Proxy-Authorization".equalsIgnoreCase(str) || "TE".equalsIgnoreCase(str) || "Trailers".equalsIgnoreCase(str) || "Transfer-Encoding".equalsIgnoreCase(str) || "Upgrade".equalsIgnoreCase(str)) ? false : true; } @Override // h5.d0 public i0 a(d0.a aVar) { i0.a f10; b f11 = new b.a(System.currentTimeMillis(), aVar.d(), null).f(); h0 h0Var = f11.f11058a; i0 i0Var = f11.f11059b; if (h0Var == null && i0Var == null) { f10 = new i0.a().o(aVar.d()).m(j0.HTTP_1_1).g(504).j("Unsatisfiable MobonRequest (only-if-cached)").d(i5.c.f10873c).p(-1L).n(System.currentTimeMillis()); } else { if (h0Var != null) { i0 e10 = aVar.e(h0Var); if (i0Var != null) { if (e10.G() == 304) { i0Var.a0().i(b(i0Var.R(), e10.R())).p(e10.m0()).n(e10.f0()).f(c(i0Var)).k(c(e10)).e(); e10.c().close(); throw null; } i5.c.j(i0Var.c()); } return e10.a0().f(c(i0Var)).k(c(e10)).e(); } f10 = i0Var.a0().f(c(i0Var)); } return f10.e(); } }