From 64221fb3fb3862fa6dc8f09ba3fd110858fee2e6 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Thu, 14 Jun 2012 19:42:07 +0000
Subject: [PATCH]  * I2PSocketEepGet: Use specified port  * I2PTunnel:    -
 Don't strip port from an I2P URL

---
 .../java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java    | 4 +++-
 .../java/src/net/i2p/client/streaming/I2PSocketEepGet.java | 7 +++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java
index 4e7f0c257e..e80695dbce 100644
--- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java
+++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java
@@ -490,8 +490,9 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
                         int rPort = requestURI.getPort();
                         if (rPort > 0) {
                             // Save it to put in the I2PSocketOptions,
-                            // but strip it from the URL
                             remotePort = rPort;
+                         /********
+                            // but strip it from the URL
                             if(_log.shouldLog(Log.WARN)) {
                                 _log.warn(getPrefix(requestId) + "Removing port from [" + request + "]");
                             }
@@ -502,6 +503,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
                                 method = null;
                                 break;
                             }
+                          ******/
                         } else {
                             remotePort = 80;
                         }
diff --git a/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketEepGet.java b/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketEepGet.java
index cfc0675c09..e548055c3d 100644
--- a/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketEepGet.java
+++ b/apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketEepGet.java
@@ -111,8 +111,8 @@ public class I2PSocketEepGet extends EepGet {
             if ("http".equals(url.getProtocol())) {
                 String host = url.getHost();
                 int port = url.getPort();
-                if (port != -1)
-                    throw new IOException("Ports not supported in i2p: " + _actualURL);
+                if (port <= 0 || port >= 65535)
+                    port = 80;
 
                 // HTTP Proxy compatibility http://i2p/B64KEY/blah
                 // Rewrite the url to strip out the /i2p/,
@@ -143,8 +143,7 @@ public class I2PSocketEepGet extends EepGet {
                 // in the SYN packet, saving one RTT.
                 props.setProperty(PROP_CONNECT_DELAY, CONNECT_DELAY);
                 I2PSocketOptions opts = _socketManager.buildOptions(props);
-                // TODO pull port out of URL
-                opts.setPort(80);
+                opts.setPort(port);
                 _socket = _socketManager.connect(dest, opts);
             } else {
                 throw new IOException("Unsupported protocol: " + _actualURL);
-- 
GitLab