propagate from branch 'i2p.i2p.zzz.test' (head 4e891e40ee2919859df7b3ae04ecec6af4f47a35)

to branch 'i2p.i2p' (head 15f093fdaa28a510bd45965dc849c8d04e0d42f7)
This commit is contained in:
zzz
2009-03-16 19:33:14 +00:00
7 changed files with 151 additions and 10 deletions

View File

@ -185,7 +185,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
/**
* create the default options (using the default timeout, etc)
*
* unused?
*/
protected I2PSocketOptions getDefaultOptions() {
Properties defaultOpts = getTunnel().getClientOptions();
@ -210,6 +210,9 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
defaultOpts.setProperty(I2PSocketOptions.PROP_READ_TIMEOUT, ""+DEFAULT_READ_TIMEOUT);
if (!defaultOpts.contains("i2p.streaming.inactivityTimeout"))
defaultOpts.setProperty("i2p.streaming.inactivityTimeout", ""+DEFAULT_READ_TIMEOUT);
// delayed start
if (sockMgr == null)
sockMgr = getSocketManager();
I2PSocketOptions opts = sockMgr.buildOptions(defaultOpts);
if (!defaultOpts.containsKey(I2PSocketOptions.PROP_CONNECT_TIMEOUT))
opts.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT);

View File

@ -171,7 +171,24 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
sender.start();
browserout = _browser.getOutputStream();
serverin = _webserver.getInputStream();
// NPE seen here in 0.7-7, caused by addition of socket.close() in the
// catch (IOException ioe) block above in blockingHandle() ???
// CRIT [ad-130280.hc] net.i2p.util.I2PThread : Killing thread Thread-130280.hc
// java.lang.NullPointerException
// at java.io.FileInputStream.<init>(FileInputStream.java:131)
// at java.net.SocketInputStream.<init>(SocketInputStream.java:44)
// at java.net.PlainSocketImpl.getInputStream(PlainSocketImpl.java:401)
// at java.net.Socket$2.run(Socket.java:779)
// at java.security.AccessController.doPrivileged(Native Method)
// at java.net.Socket.getInputStream(Socket.java:776)
// at net.i2p.i2ptunnel.I2PTunnelHTTPServer$CompressedRequestor.run(I2PTunnelHTTPServer.java:174)
// at java.lang.Thread.run(Thread.java:619)
// at net.i2p.util.I2PThread.run(I2PThread.java:71)
try {
serverin = _webserver.getInputStream();
} catch (NullPointerException npe) {
throw new IOException("getInputStream NPE");
}
CompressedResponseOutputStream compressedOut = new CompressedResponseOutputStream(browserout);
Sender s = new Sender(compressedOut, serverin, "server: server to browser");
if (_log.shouldLog(Log.INFO))

View File

@ -198,7 +198,8 @@ public class SOCKS4aServer extends SOCKSServer {
I2PSocket destSock;
try {
if (connHostName.toLowerCase().endsWith(".i2p")) {
if (connHostName.toLowerCase().endsWith(".i2p") ||
connHostName.toLowerCase().endsWith(".onion")) {
_log.debug("connecting to " + connHostName + "...");
// Let's not due a new Dest for every request, huh?
//I2PSocketManager sm = I2PSocketManagerFactory.createManager();
@ -224,7 +225,7 @@ public class SOCKS4aServer extends SOCKSServer {
} else {
List<String> proxies = t.getProxies(connPort);
if (proxies == null || proxies.size() <= 0) {
String err = "No outproxy configured for port " + connPort + " and no default configured either";
String err = "No outproxy configured for port " + connPort + " and no default configured either - host: " + connHostName;
_log.error(err);
try {
sendRequestReply(Reply.CONNECTION_REFUSED, InetAddress.getByName("127.0.0.1"), 0, out);