forked from I2P_Developers/i2p.i2p
i2ptunnel: Add Connection: close headers to errors and proxy.i2p responses
where it was missing (ticket #1531)
This commit is contained in:
@ -63,6 +63,8 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
|
||||
"HTTP/1.1 405 Bad Method\r\n"+
|
||||
"Content-Type: text/html; charset=iso-8859-1\r\n"+
|
||||
"Cache-control: no-cache\r\n"+
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n"+
|
||||
"<html><body><H1>I2P ERROR: METHOD NOT ALLOWED</H1>"+
|
||||
"The request uses a bad protocol. "+
|
||||
@ -72,6 +74,8 @@ public class I2PTunnelConnectClient extends I2PTunnelHTTPClientBase implements R
|
||||
"HTTP/1.1 403 Access Denied\r\n"+
|
||||
"Content-Type: text/html; charset=iso-8859-1\r\n"+
|
||||
"Cache-control: no-cache\r\n"+
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\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>";
|
||||
|
@ -91,6 +91,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
"HTTP/1.1 403 Access Denied\r\n" +
|
||||
"Content-Type: text/html; charset=iso-8859-1\r\n" +
|
||||
"Cache-control: no-cache\r\n" +
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n" +
|
||||
"<html><body><H1>I2P ERROR: REQUEST DENIED</H1>" +
|
||||
"You attempted to connect to a non-I2P website or location.<BR>";
|
||||
@ -112,6 +114,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
"HTTP/1.1 503 Service Unavailable\r\n" +
|
||||
"Content-Type: text/html; charset=iso-8859-1\r\n" +
|
||||
"Cache-control: no-cache\r\n" +
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n" +
|
||||
"<html><body><H1>I2P ERROR: No outproxy found</H1>" +
|
||||
"Your request was for a site outside of I2P, but you have no " +
|
||||
@ -121,6 +125,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
"HTTP/1.1 409 Conflict\r\n" +
|
||||
"Content-Type: text/html; charset=iso-8859-1\r\n" +
|
||||
"Cache-control: no-cache\r\n" +
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n" +
|
||||
"<html><body><H1>I2P ERROR: Destination key conflict</H1>" +
|
||||
"The addresshelper link you followed specifies a different destination key " +
|
||||
@ -136,6 +142,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
"HTTP/1.1 404 Not Found\r\n" +
|
||||
"Content-Type: text/html; charset=iso-8859-1\r\n" +
|
||||
"Cache-control: no-cache\r\n" +
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n" +
|
||||
"<html><body><H1>I2P ERROR: Helper key not resolvable.</H1>" +
|
||||
"The helper key you put for i2paddresshelper= is not resolvable. " +
|
||||
@ -146,6 +154,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
"HTTP/1.1 409 New Address\r\n" +
|
||||
"Content-Type: text/html; charset=iso-8859-1\r\n" +
|
||||
"Cache-control: no-cache\r\n" +
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n" +
|
||||
"<html><body><H1>New Host Name with Address Helper</H1>" +
|
||||
"The address helper link you followed is for a new host name that is not in your address book. " +
|
||||
@ -157,6 +167,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
"HTTP/1.1 403 Bad Protocol\r\n" +
|
||||
"Content-Type: text/html; charset=iso-8859-1\r\n" +
|
||||
"Cache-control: no-cache\r\n" +
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n" +
|
||||
"<html><body><H1>I2P ERROR: NON-HTTP PROTOCOL</H1>" +
|
||||
"The request uses a bad protocol. " +
|
||||
@ -166,6 +178,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
"HTTP/1.1 403 Bad URI\r\n" +
|
||||
"Content-Type: text/html; charset=iso-8859-1\r\n" +
|
||||
"Cache-control: no-cache\r\n" +
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n" +
|
||||
"<html><body><H1>I2P ERROR: INVALID REQUEST URI</H1>" +
|
||||
"The request URI is invalid, and probably contains illegal characters. " +
|
||||
@ -175,6 +189,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
"HTTP/1.1 403 Access Denied\r\n" +
|
||||
"Content-Type: text/html; charset=iso-8859-1\r\n" +
|
||||
"Cache-control: no-cache\r\n" +
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\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>";
|
||||
@ -183,6 +199,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
"HTTP/1.1 403 SSL Rejected\r\n" +
|
||||
"Content-Type: text/html; charset=iso-8859-1\r\n" +
|
||||
"Cache-control: no-cache\r\n" +
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n" +
|
||||
"<html><body><H1>I2P ERROR: SSL to I2P address rejected</H1>" +
|
||||
"SSL for to .i2p addresses denied by configuration." +
|
||||
@ -1159,6 +1177,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
try {
|
||||
out.write(("HTTP/1.1 301 Address Helper Accepted\r\n" +
|
||||
"Location: " + uri + "\r\n" +
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n").getBytes("UTF-8"));
|
||||
} catch (IOException ioe) {
|
||||
// ignore
|
||||
@ -1384,6 +1404,8 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
||||
private final static String ERR_HELPER_DISABLED =
|
||||
"HTTP/1.1 403 Disabled\r\n" +
|
||||
"Content-Type: text/plain\r\n" +
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n" +
|
||||
"Address helpers disabled";
|
||||
|
||||
|
@ -63,6 +63,8 @@ public abstract class I2PTunnelHTTPClientBase extends I2PTunnelClientBase implem
|
||||
"HTTP/1.1 407 Proxy Authentication Required\r\n" +
|
||||
"Content-Type: text/html; charset=UTF-8\r\n" +
|
||||
"Cache-control: no-cache\r\n" +
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.5\r\n" + // try to get a UTF-8-encoded response back for the password
|
||||
"Proxy-Authenticate: ";
|
||||
// put the auth type and realm in between
|
||||
@ -78,6 +80,8 @@ public abstract class I2PTunnelHTTPClientBase extends I2PTunnelClientBase implem
|
||||
"HTTP/1.1 503 Service Unavailable\r\n"+
|
||||
"Content-Type: text/html; charset=iso-8859-1\r\n"+
|
||||
"Cache-control: no-cache\r\n"+
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n"+
|
||||
"<html><body><H1>I2P ERROR: No outproxy found</H1>"+
|
||||
"Your request was for a site outside of I2P, but you have no "+
|
||||
@ -87,6 +91,8 @@ public abstract class I2PTunnelHTTPClientBase extends I2PTunnelClientBase implem
|
||||
"HTTP/1.1 503 Service Unavailable\r\n" +
|
||||
"Content-Type: text/html; charset=iso-8859-1\r\n" +
|
||||
"Cache-control: no-cache\r\n" +
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n" +
|
||||
"<html><body><H1>I2P ERROR: DESTINATION NOT FOUND</H1>" +
|
||||
"That I2P Destination was not found. Perhaps you pasted in the " +
|
||||
|
@ -36,15 +36,28 @@ public abstract class LocalHTTPServer {
|
||||
private final static String ERR_404 =
|
||||
"HTTP/1.1 404 Not Found\r\n"+
|
||||
"Content-Type: text/plain\r\n"+
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n"+
|
||||
"HTTP Proxy local file not found";
|
||||
|
||||
private final static String ERR_ADD =
|
||||
"HTTP/1.1 409 Bad\r\n"+
|
||||
"Content-Type: text/plain\r\n"+
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n"+
|
||||
"Add to addressbook failed - bad parameters";
|
||||
|
||||
private final static String OK =
|
||||
"HTTP/1.1 200 OK\r\n" +
|
||||
"Content-Type: text/plain\r\n" +
|
||||
"Cache-Control: max-age=86400\r\n" +
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n"+
|
||||
"I2P HTTP proxy OK";
|
||||
|
||||
/**
|
||||
* Very simple web server.
|
||||
*
|
||||
@ -72,7 +85,7 @@ public abstract class LocalHTTPServer {
|
||||
//System.err.println("targetRequest: \"" + targetRequest + "\"");
|
||||
// a home page message for the curious...
|
||||
if (targetRequest.equals("/")) {
|
||||
out.write(("HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nCache-Control: max-age=86400\r\n\r\nI2P HTTP proxy OK").getBytes("UTF-8"));
|
||||
out.write(OK.getBytes("UTF-8"));
|
||||
out.flush();
|
||||
return;
|
||||
}
|
||||
@ -103,7 +116,7 @@ public abstract class LocalHTTPServer {
|
||||
else type = "text/html";
|
||||
out.write("HTTP/1.1 200 OK\r\nContent-Type: ".getBytes("UTF-8"));
|
||||
out.write(type.getBytes("UTF-8"));
|
||||
out.write("\r\nCache-Control: max-age=86400\r\n\r\n".getBytes("UTF-8"));
|
||||
out.write("\r\nCache-Control: max-age=86400\r\nConnection: close\r\nProxy-Connection: close\r\n\r\n".getBytes("UTF-8"));
|
||||
FileUtil.readFile(filename, themesDir.getAbsolutePath(), out);
|
||||
return;
|
||||
}
|
||||
@ -181,6 +194,8 @@ public abstract class LocalHTTPServer {
|
||||
tbook = book;
|
||||
out.write(("HTTP/1.1 200 OK\r\n"+
|
||||
"Content-Type: text/html; charset=UTF-8\r\n"+
|
||||
"Connection: close\r\n"+
|
||||
"Proxy-Connection: close\r\n"+
|
||||
"\r\n"+
|
||||
"<html><head>"+
|
||||
"<title>" + _("Redirecting to {0}", host) + "</title>\n" +
|
||||
|
@ -1,4 +1,12 @@
|
||||
2015-05-04 zzz
|
||||
* i2ptunnel:
|
||||
- Close input stream when HTTP client decompressor
|
||||
terminates (ticket #1506)
|
||||
- Add Connection: close headers to errors and proxy.i2p responses
|
||||
where it was missing (ticket #1531)
|
||||
|
||||
2015-05-03 zzz
|
||||
* Console: Add floodfill configuration form to /configadvanced
|
||||
* Router: Allow class M to become floodfill;
|
||||
add bandwidth classes P and X (ticket #1447)
|
||||
* SusiDNS: Add export button
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 14;
|
||||
public final static long BUILD = 15;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
Reference in New Issue
Block a user