* I2PSocketEepGet: Use specified port

* I2PTunnel:
   - Don't strip port from an I2P URL
This commit is contained in:
zzz
2012-06-14 19:42:07 +00:00
parent c73044b6b4
commit 64221fb3fb
2 changed files with 6 additions and 5 deletions

View File

@ -490,8 +490,9 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
int rPort = requestURI.getPort(); int rPort = requestURI.getPort();
if (rPort > 0) { if (rPort > 0) {
// Save it to put in the I2PSocketOptions, // Save it to put in the I2PSocketOptions,
// but strip it from the URL
remotePort = rPort; remotePort = rPort;
/********
// but strip it from the URL
if(_log.shouldLog(Log.WARN)) { if(_log.shouldLog(Log.WARN)) {
_log.warn(getPrefix(requestId) + "Removing port from [" + request + "]"); _log.warn(getPrefix(requestId) + "Removing port from [" + request + "]");
} }
@ -502,6 +503,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
method = null; method = null;
break; break;
} }
******/
} else { } else {
remotePort = 80; remotePort = 80;
} }

View File

@ -111,8 +111,8 @@ public class I2PSocketEepGet extends EepGet {
if ("http".equals(url.getProtocol())) { if ("http".equals(url.getProtocol())) {
String host = url.getHost(); String host = url.getHost();
int port = url.getPort(); int port = url.getPort();
if (port != -1) if (port <= 0 || port >= 65535)
throw new IOException("Ports not supported in i2p: " + _actualURL); port = 80;
// HTTP Proxy compatibility http://i2p/B64KEY/blah // HTTP Proxy compatibility http://i2p/B64KEY/blah
// Rewrite the url to strip out the /i2p/, // Rewrite the url to strip out the /i2p/,
@ -143,8 +143,7 @@ public class I2PSocketEepGet extends EepGet {
// in the SYN packet, saving one RTT. // in the SYN packet, saving one RTT.
props.setProperty(PROP_CONNECT_DELAY, CONNECT_DELAY); props.setProperty(PROP_CONNECT_DELAY, CONNECT_DELAY);
I2PSocketOptions opts = _socketManager.buildOptions(props); I2PSocketOptions opts = _socketManager.buildOptions(props);
// TODO pull port out of URL opts.setPort(port);
opts.setPort(80);
_socket = _socketManager.connect(dest, opts); _socket = _socketManager.connect(dest, opts);
} else { } else {
throw new IOException("Unsupported protocol: " + _actualURL); throw new IOException("Unsupported protocol: " + _actualURL);