mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Reformat the httpProxy patch.
This commit is contained in:
parent
160d955a32
commit
387b3b4c2e
1 changed files with 11 additions and 5 deletions
|
@ -433,13 +433,19 @@ public class Main {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Proxy getProxy() {
|
private Proxy getProxy() {
|
||||||
String http_proxy = System.getenv("http_proxy");
|
String httpProxy = System.getenv("http_proxy");
|
||||||
try {
|
try {
|
||||||
String host = http_proxy == null || http_proxy.indexOf(':') == -1 ? "localhost" : http_proxy.substring(0, http_proxy.indexOf(':'));
|
String host = httpProxy == null || httpProxy.indexOf(':') == -1
|
||||||
int port = http_proxy == null || http_proxy.indexOf(':') == -1 ? 0 : Integer.parseInt(http_proxy.substring(http_proxy.indexOf(':') + 1));
|
? "localhost"
|
||||||
return http_proxy == null ? null : new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port));
|
: httpProxy.substring(0, httpProxy.indexOf(':'));
|
||||||
|
int port = httpProxy == null || httpProxy.indexOf(':') == -1
|
||||||
|
? 0
|
||||||
|
: Integer.parseInt(httpProxy.substring(httpProxy.indexOf(':') + 1));
|
||||||
|
return httpProxy == null
|
||||||
|
? null
|
||||||
|
: new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port));
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
log(1, "Warning: invalid proxy port: " + http_proxy);;
|
log(1, "Warning: invalid proxy port: " + httpProxy);;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue