From 24b012a84360ff7c4be913c0fa3644fc8fd59822 Mon Sep 17 00:00:00 2001 From: dev Date: Mon, 13 Apr 2009 12:09:52 +0000 Subject: [PATCH] don't send somehost.i2p:8080 requests to outproxy --- .../net/i2p/i2ptunnel/I2PTunnelHTTPClient.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java index 93c8e8674..bc2d439fe 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java @@ -288,7 +288,20 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable break; } 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 if (host.toLowerCase().endsWith(".i2p")) { // Destination gets the host name @@ -389,6 +402,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable line = method + " " + request.substring(pos); } else if (host.indexOf(".") != -1) { + // rebuild host + host = host + ":" + port; // The request must be forwarded to a WWW proxy if (_log.shouldLog(Log.DEBUG)) _log.debug("Before selecting outproxy for " + host);