don't send somehost.i2p:8080 requests to outproxy

This commit is contained in:
dev
2009-04-13 12:09:52 +00:00
parent d493addf95
commit 24b012a843

View File

@ -289,6 +289,19 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
} }
host = request.substring(0, pos); host = request.substring(0, pos);
// parse port
pos = host.indexOf(":");
int port = 80;
if(pos != -1) {
String[] parts = host.split(":");
host = parts[0];
try {
port = Integer.parseInt(parts[1]);
} catch(Exception exc) {
// TODO: log this
}
}
// Quick hack for foo.bar.i2p // Quick hack for foo.bar.i2p
if (host.toLowerCase().endsWith(".i2p")) { if (host.toLowerCase().endsWith(".i2p")) {
// Destination gets the host name // Destination gets the host name
@ -389,6 +402,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
line = method + " " + request.substring(pos); line = method + " " + request.substring(pos);
} else if (host.indexOf(".") != -1) { } else if (host.indexOf(".") != -1) {
// rebuild host
host = host + ":" + port;
// The request must be forwarded to a WWW proxy // The request must be forwarded to a WWW proxy
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Before selecting outproxy for " + host); _log.debug("Before selecting outproxy for " + host);