- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
35 lines
1.0 KiB
Java
35 lines
1.0 KiB
Java
package okhttp3.internal.http;
|
|
|
|
import java.net.Proxy;
|
|
import okhttp3.HttpUrl;
|
|
import okhttp3.Request;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public abstract class RequestLine {
|
|
public static String get(Request request, Proxy.Type type) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(request.method());
|
|
sb.append(' ');
|
|
if (includeAuthorityInRequestLine(request, type)) {
|
|
sb.append(request.url());
|
|
} else {
|
|
sb.append(requestPath(request.url()));
|
|
}
|
|
sb.append(" HTTP/1.1");
|
|
return sb.toString();
|
|
}
|
|
|
|
public static boolean includeAuthorityInRequestLine(Request request, Proxy.Type type) {
|
|
return !request.isHttps() && type == Proxy.Type.HTTP;
|
|
}
|
|
|
|
public static String requestPath(HttpUrl httpUrl) {
|
|
String encodedPath = httpUrl.encodedPath();
|
|
String encodedQuery = httpUrl.encodedQuery();
|
|
if (encodedQuery == null) {
|
|
return encodedPath;
|
|
}
|
|
return encodedPath + '?' + encodedQuery;
|
|
}
|
|
}
|