From df47587db0a6061756c3d3d3a047f3abccde927e Mon Sep 17 00:00:00 2001 From: zzz Date: Thu, 18 Jan 2007 01:42:13 +0000 Subject: [PATCH] * Add new HTTP Proxy error message for non-http protocols --- .../net/i2p/i2ptunnel/I2PTunnelHTTPClient.java | 15 ++++++++++++++- history.txt | 5 ++++- router/java/src/net/i2p/router/RouterVersion.java | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java index f4a24405fe..166ff38aa6 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java @@ -112,6 +112,16 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable "or naming one of them differently.

") .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"+ + "

I2P ERROR: NON-HTTP PROTOCOL

"+ + "The request uses a bad protocol. "+ + "The I2P HTTP Proxy supports http:// requests ONLY. Other protocols such as https:// and ftp:// are not allowed.
") + .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("

Generated on: ".getBytes()); out.write(new Date().toString().getBytes()); out.write("\n".getBytes()); diff --git a/history.txt b/history.txt index d77002d7f9..2883a389f1 100644 --- a/history.txt +++ b/history.txt @@ -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 diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index b968a10ba5..445eb5617e 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -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);