2007-09-14 zzz

* eepget: Increase header timeout to 45s
    * HTTP proxy: Return a better error message for localhost requests
    * tunnels: Fix PooledTunnelCreatorConfig memory leak
This commit is contained in:
zzz
2007-09-15 01:58:30 +00:00
committed by zzz
parent d28a96ac7d
commit 9054a196ce
5 changed files with 34 additions and 9 deletions

View File

@ -122,6 +122,15 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
"The I2P HTTP Proxy supports http:// requests ONLY. Other protocols such as https:// and ftp:// are not allowed.<BR>")
.getBytes();
private final static byte[] ERR_LOCALHOST =
("HTTP/1.1 403 Access Denied\r\n"+
"Content-Type: text/html; charset=iso-8859-1\r\n"+
"Cache-control: no-cache\r\n"+
"\r\n"+
"<html><body><H1>I2P ERROR: REQUEST DENIED</H1>"+
"Your browser is misconfigured. Do not use the proxy to access the router console or other localhost destinations.<BR>")
.getBytes();
/** used to assign unique IDs to the threads / clients. no logic or functionality */
private static volatile long __clientId = 0;
@ -394,6 +403,16 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
usingWWWProxy = true;
if (_log.shouldLog(Log.DEBUG))
_log.debug(getPrefix(requestId) + "Host doesnt end with .i2p and it contains a period [" + host + "]: wwwProxy!");
} else if (host.toLowerCase().startsWith("localhost:")) {
if (out != null) {
out.write(ERR_LOCALHOST);
out.write("<p /><i>Generated on: ".getBytes());
out.write(new Date().toString().getBytes());
out.write("</i></body></html>\n".getBytes());
out.flush();
}
s.close();
return;
} else {
request = request.substring(pos + 1);
pos = request.indexOf("/");

View File

@ -119,7 +119,7 @@ public class EepGet {
_transferFailed = false;
_headersRead = false;
_aborted = false;
_fetchHeaderTimeout = 30*1000;
_fetchHeaderTimeout = 45*1000;
_listeners = new ArrayList(1);
_etag = etag;
_lastModified = lastModified;

View File

@ -1,4 +1,9 @@
$Id: history.txt,v 1.585 2007-09-08 15:21:16 zzz Exp $
$Id: history.txt,v 1.586 2007-09-09 12:38:54 zzz Exp $
2007-09-14 zzz
* eepget: Increase header timeout to 45s
* HTTP proxy: Return a better error message for localhost requests
* tunnels: Fix PooledTunnelCreatorConfig memory leak
2007-09-09 zzz
* eepget: Add support for Last-Modified and If-Modified-Since

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.521 $ $Date: 2007-09-08 15:21:15 $";
public final static String ID = "$Revision: 1.522 $ $Date: 2007-09-09 12:38:53 $";
public final static String VERSION = "0.6.1.29";
public final static long BUILD = 3;
public final static long BUILD = 4;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -14,8 +14,8 @@ import net.i2p.util.Log;
public class PooledTunnelCreatorConfig extends TunnelCreatorConfig {
private TunnelPool _pool;
private TestJob _testJob;
private Job _expireJob;
private TunnelInfo _pairedTunnel;
// private Job _expireJob;
// private TunnelInfo _pairedTunnel;
private boolean _live;
/** Creates a new instance of PooledTunnelCreatorConfig */
@ -68,8 +68,9 @@ public class PooledTunnelCreatorConfig extends TunnelCreatorConfig {
public TunnelPool getTunnelPool() { return _pool; }
public void setTestJob(TestJob job) { _testJob = job; }
public void setExpireJob(Job job) { _expireJob = job; }
public void setExpireJob(Job job) { /* _expireJob = job; */ }
public void setPairedTunnel(TunnelInfo tunnel) { _pairedTunnel = tunnel; }
public TunnelInfo getPairedTunnel() { return _pairedTunnel; }
// Fix memory leaks caused by references if you need to use pairedTunnel
public void setPairedTunnel(TunnelInfo tunnel) { /* _pairedTunnel = tunnel; */}
// public TunnelInfo getPairedTunnel() { return _pairedTunnel; }
}