* Add new HTTP Proxy error message for non-http protocols

This commit is contained in:
zzz
2007-01-18 01:42:13 +00:00
committed by zzz
parent d705e0ad04
commit df47587db0
3 changed files with 20 additions and 4 deletions

View File

@ -112,6 +112,16 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
"or naming one of them differently.<P/>")
.getBytes();
private final static byte[] ERR_BAD_PROTOCOL =
("HTTP/1.1 403 Bad Protocol\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: NON-HTTP PROTOCOL</H1>"+
"The request uses a bad protocol. "+
"The I2P HTTP Proxy supports http:// requests ONLY. Other protocols such as https:// and ftp:// are not allowed.<BR>")
.getBytes();
/** used to assign unique IDs to the threads / clients. no logic or functionality */
private static volatile long __clientId = 0;
@ -483,7 +493,10 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
if (method == null || destination == null) {
l.log("No HTTP method found in the request.");
if (out != null) {
out.write(ERR_REQUEST_DENIED);
if ("http://".equalsIgnoreCase(protocol))
out.write(ERR_REQUEST_DENIED);
else
out.write(ERR_BAD_PROTOCOL);
out.write("<p /><i>Generated on: ".getBytes());
out.write(new Date().toString().getBytes());
out.write("</i></body></html>\n".getBytes());

View File

@ -1,4 +1,7 @@
$Id: history.txt,v 1.539 2007-01-16 01:20:23 zzz Exp $
$Id: history.txt,v 1.540 2007-01-17 00:13:28 zzz Exp $
2007-01-17 zzz
* Add new HTTP Proxy error message for non-http protocols
2007-01-17 zzz
* Add note on Syndie index.html steering people to new Syndie

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.474 $ $Date: 2007-01-16 01:20:23 $";
public final static String ID = "$Revision: 1.475 $ $Date: 2007-01-17 00:13:27 $";
public final static String VERSION = "0.6.1.26";
public final static long BUILD = 8;
public final static long BUILD = 9;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
System.out.println("Router ID: " + RouterVersion.ID);