host = this.url.getHost();
if (Log.on) Log.log(this, "creating HTTP object for connection to " + host + ":" + port);
addHeader("Host", host); // host header is always sent verbatim
- if (!skipResolveCheck) host = resolveAndCheckIfFirewalled(host); // might have to use the strict IP if behind a proxy
+ if (!skipResolveCheck) resolveAndCheckIfFirewalled(host); // might have to use the strict IP if behind a proxy
ProxyInfo pi = Platform.detectProxy();
if (sock == null && pi != null && pi.proxyAutoConfigFunction != null) sock = attemptPAC(pi.proxyAutoConfigFunction);
* resolves the hostname and returns it as a string in the form "x.y.z.w", except for the special case "xmlrpc.xwt.org".
* @throws HTTPException if the host falls within a firewalled netblock
*/
- private String resolveAndCheckIfFirewalled(String host) throws HTTPException {
+ private void resolveAndCheckIfFirewalled(String host) throws HTTPException {
// special case
- if (host.equals("xmlrpc.xwt.org")) return host;
+ if (host.equals("xmlrpc.xwt.org")) return;
// cached
- if (resolvedHosts.get(host) != null) return (String)resolvedHosts.get(host);
+ if (resolvedHosts.get(host) != null) return;
if (Log.on) Log.log(this, " resolveAndCheckIfFirewalled: resolving " + host);
(quadbyte[0] == 192 && quadbyte[1] == 168) ||
(quadbyte[0] == 172 && (quadbyte[1] & 0xF0) == 16)) && !addr.equals(Main.originAddr))
throw new HTTPException("security violation: " + host + " [" + addr.getHostAddress() + "] is in a firewalled netblock");
- return addr.getHostAddress();
+ return;
} catch (UnknownHostException uhe) { }
// resolve using xmlrpc.xwt.org
Object ret = new XMLRPC("http://xmlrpc.xwt.org/RPC2/", "dns.resolve").call(new Object[] { host });
if (ret == null || !(ret instanceof String)) throw new Exception(" xmlrpc.xwt.org returned non-String: " + ret);
resolvedHosts.put(host, ret);
- return (String)ret;
+ return;
} catch (Throwable e) {
throw new HTTPException("exception while attempting to use xmlrpc.xwt.org to resolve " + host + ": " + e);
}