discord-jadx/app/src/main/java/i0/v.java

178 lines
6 KiB
Java
Raw Normal View History

2021-08-03 07:33:18 +00:00
package i0;
import com.discord.models.domain.ModelAuditLogEntry;
2021-08-03 07:33:18 +00:00
import d0.z.d.m;
import f0.u;
import f0.w;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.regex.Pattern;
import okhttp3.Headers;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
2021-08-10 21:19:22 +00:00
import okhttp3.Request;
2021-08-03 07:33:18 +00:00
import okhttp3.RequestBody;
import okio.BufferedSink;
/* compiled from: RequestBuilder */
public final class v {
public static final char[] a = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
public static final Pattern b = Pattern.compile("(.*/)?(\\.|%2e|%2E){1,2}(/.*)?");
/* renamed from: c reason: collision with root package name */
2021-09-07 06:52:02 +00:00
public final String f2912c;
2021-08-03 07:33:18 +00:00
public final w d;
public String e;
public w.a f;
2021-08-10 21:19:22 +00:00
public final Request.a g = new Request.a();
2021-08-03 07:33:18 +00:00
public final Headers.a h;
public MediaType i;
public final boolean j;
public MultipartBody.a k;
public u.a l;
public RequestBody m;
/* compiled from: RequestBuilder */
public static class a extends RequestBody {
public final RequestBody a;
public final MediaType b;
public a(RequestBody requestBody, MediaType mediaType) {
this.a = requestBody;
this.b = mediaType;
}
@Override // okhttp3.RequestBody
public long contentLength() throws IOException {
return this.a.contentLength();
}
@Override // okhttp3.RequestBody
public MediaType contentType() {
return this.b;
}
@Override // okhttp3.RequestBody
public void writeTo(BufferedSink bufferedSink) throws IOException {
this.a.writeTo(bufferedSink);
}
}
public v(String str, w wVar, String str2, Headers headers, MediaType mediaType, boolean z2, boolean z3, boolean z4) {
2021-09-07 06:52:02 +00:00
this.f2912c = str;
2021-08-03 07:33:18 +00:00
this.d = wVar;
this.e = str2;
this.i = mediaType;
this.j = z2;
if (headers != null) {
this.h = headers.e();
} else {
this.h = new Headers.a();
}
if (z3) {
this.l = new u.a();
} else if (z4) {
MultipartBody.a aVar = new MultipartBody.a();
this.k = aVar;
aVar.c(MultipartBody.b);
}
}
public void a(String str, String str2, boolean z2) {
if (z2) {
u.a aVar = this.l;
Objects.requireNonNull(aVar);
m.checkParameterIsNotNull(str, ModelAuditLogEntry.CHANGE_KEY_NAME);
2021-08-03 07:33:18 +00:00
m.checkParameterIsNotNull(str2, "value");
List<String> list = aVar.a;
w.b bVar = w.b;
2021-09-07 06:52:02 +00:00
list.add(w.b.a(bVar, str, 0, 0, " \"':;<=>@[]^`{}|/\\?#&!$(),~", true, false, true, false, aVar.f2850c, 83));
aVar.b.add(w.b.a(bVar, str2, 0, 0, " \"':;<=>@[]^`{}|/\\?#&!$(),~", true, false, true, false, aVar.f2850c, 83));
2021-08-03 07:33:18 +00:00
return;
}
u.a aVar2 = this.l;
Objects.requireNonNull(aVar2);
m.checkParameterIsNotNull(str, ModelAuditLogEntry.CHANGE_KEY_NAME);
2021-08-03 07:33:18 +00:00
m.checkParameterIsNotNull(str2, "value");
List<String> list2 = aVar2.a;
w.b bVar2 = w.b;
2021-09-07 06:52:02 +00:00
list2.add(w.b.a(bVar2, str, 0, 0, " \"':;<=>@[]^`{}|/\\?#&!$(),~", false, false, true, false, aVar2.f2850c, 91));
aVar2.b.add(w.b.a(bVar2, str2, 0, 0, " \"':;<=>@[]^`{}|/\\?#&!$(),~", false, false, true, false, aVar2.f2850c, 91));
2021-08-03 07:33:18 +00:00
}
public void b(String str, String str2) {
if ("Content-Type".equalsIgnoreCase(str)) {
try {
2021-09-07 06:52:02 +00:00
MediaType.a aVar = MediaType.f2944c;
2021-08-03 07:33:18 +00:00
this.i = MediaType.a.a(str2);
} catch (IllegalArgumentException e) {
2021-08-28 06:29:07 +00:00
throw new IllegalArgumentException(c.d.b.a.a.u("Malformed content type: ", str2), e);
2021-08-03 07:33:18 +00:00
}
} else {
this.h.a(str, str2);
}
}
public void c(Headers headers, RequestBody requestBody) {
MultipartBody.a aVar = this.k;
Objects.requireNonNull(aVar);
m.checkParameterIsNotNull(requestBody, "body");
m.checkParameterIsNotNull(requestBody, "body");
boolean z2 = false;
if ((headers != null ? headers.c("Content-Type") : null) == null) {
if ((headers != null ? headers.c("Content-Length") : null) == null) {
z2 = true;
}
if (z2) {
aVar.a(new MultipartBody.Part(headers, requestBody, null));
return;
}
throw new IllegalArgumentException("Unexpected header: Content-Length".toString());
}
throw new IllegalArgumentException("Unexpected header: Content-Type".toString());
}
public void d(String str, String str2, boolean z2) {
String str3 = this.e;
String str4 = null;
if (str3 != null) {
w.a g = this.d.g(str3);
this.f = g;
if (g != null) {
this.e = null;
} else {
2021-08-28 06:29:07 +00:00
StringBuilder P = c.d.b.a.a.P("Malformed URL. Base: ");
P.append(this.d);
P.append(", Relative: ");
P.append(this.e);
throw new IllegalArgumentException(P.toString());
2021-08-03 07:33:18 +00:00
}
}
if (z2) {
this.f.a(str, str2);
return;
}
w.a aVar = this.f;
Objects.requireNonNull(aVar);
m.checkParameterIsNotNull(str, ModelAuditLogEntry.CHANGE_KEY_NAME);
2021-08-03 07:33:18 +00:00
if (aVar.h == null) {
aVar.h = new ArrayList();
}
List<String> list = aVar.h;
if (list == null) {
m.throwNpe();
}
w.b bVar = w.b;
list.add(w.b.a(bVar, str, 0, 0, " !\"#$&'(),/:;<=>?@[]\\^`{|}~", false, false, true, false, null, 219));
List<String> list2 = aVar.h;
if (list2 == null) {
m.throwNpe();
}
if (str2 != null) {
str4 = w.b.a(bVar, str2, 0, 0, " !\"#$&'(),/:;<=>?@[]\\^`{|}~", false, false, true, false, null, 219);
}
list2.add(str4);
}
}