Rabbit-R1/original r1/java/sources/okhttp3/internal/http/RequestLine.java

48 lines
2.5 KiB
Java
Raw Normal View History

2024-05-21 16:08:36 -05:00
package okhttp3.internal.http;
import io.sentry.SentryBaseEvent;
import io.sentry.protocol.Request;
import java.net.Proxy;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import okhttp3.HttpUrl;
/* compiled from: RequestLine.kt */
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bJ\u0018\u0010\t\u001a\u00020\n2\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\bH\u0002J\u000e\u0010\u000b\u001a\u00020\u00042\u0006\u0010\f\u001a\u00020\\u0006\u000e"}, d2 = {"Lokhttp3/internal/http/RequestLine;", "", "()V", "get", "", SentryBaseEvent.JsonKeys.REQUEST, "Lokhttp3/Request;", "proxyType", "Ljava/net/Proxy$Type;", "includeAuthorityInRequestLine", "", "requestPath", Request.JsonKeys.URL, "Lokhttp3/HttpUrl;", "okhttp"}, k = 1, mv = {1, 4, 0})
/* loaded from: classes3.dex */
public final class RequestLine {
public static final RequestLine INSTANCE = new RequestLine();
private RequestLine() {
}
public final String get(okhttp3.Request request, Proxy.Type proxyType) {
Intrinsics.checkNotNullParameter(request, "request");
Intrinsics.checkNotNullParameter(proxyType, "proxyType");
StringBuilder sb = new StringBuilder();
sb.append(request.method());
sb.append(' ');
RequestLine requestLine = INSTANCE;
if (requestLine.includeAuthorityInRequestLine(request, proxyType)) {
sb.append(request.url());
} else {
sb.append(requestLine.requestPath(request.url()));
}
sb.append(" HTTP/1.1");
String sb2 = sb.toString();
Intrinsics.checkNotNullExpressionValue(sb2, "StringBuilder().apply(builderAction).toString()");
return sb2;
}
private final boolean includeAuthorityInRequestLine(okhttp3.Request request, Proxy.Type proxyType) {
return !request.isHttps() && proxyType == Proxy.Type.HTTP;
}
public final String requestPath(HttpUrl url) {
Intrinsics.checkNotNullParameter(url, "url");
String encodedPath = url.encodedPath();
String encodedQuery = url.encodedQuery();
return encodedQuery != null ? encodedPath + '?' + encodedQuery : encodedPath;
}
}