43 lines
1.2 KiB
Java
43 lines
1.2 KiB
Java
package okhttp3.repackaged.internal.http;
|
|
|
|
import java.net.Proxy;
|
|
import okhttp3.repackaged.HttpUrl;
|
|
import okhttp3.repackaged.Request;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public final class RequestLine {
|
|
private RequestLine() {
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static String a(Request request, Proxy.Type type) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(request.method());
|
|
sb.append(' ');
|
|
if (b(request, type)) {
|
|
sb.append(request.url());
|
|
} else {
|
|
sb.append(requestPath(request.url()));
|
|
}
|
|
sb.append(" HTTP/1.1");
|
|
return sb.toString();
|
|
}
|
|
|
|
private static boolean b(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;
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(encodedPath);
|
|
sb.append('?');
|
|
sb.append(encodedQuery);
|
|
return sb.toString();
|
|
}
|
|
}
|