* Add new HTTP Proxy error message for non-http protocols
This commit is contained in:
@ -112,6 +112,16 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
|
|||||||
"or naming one of them differently.<P/>")
|
"or naming one of them differently.<P/>")
|
||||||
.getBytes();
|
.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 */
|
/** used to assign unique IDs to the threads / clients. no logic or functionality */
|
||||||
private static volatile long __clientId = 0;
|
private static volatile long __clientId = 0;
|
||||||
|
|
||||||
@ -483,7 +493,10 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
|
|||||||
if (method == null || destination == null) {
|
if (method == null || destination == null) {
|
||||||
l.log("No HTTP method found in the request.");
|
l.log("No HTTP method found in the request.");
|
||||||
if (out != null) {
|
if (out != null) {
|
||||||
|
if ("http://".equalsIgnoreCase(protocol))
|
||||||
out.write(ERR_REQUEST_DENIED);
|
out.write(ERR_REQUEST_DENIED);
|
||||||
|
else
|
||||||
|
out.write(ERR_BAD_PROTOCOL);
|
||||||
out.write("<p /><i>Generated on: ".getBytes());
|
out.write("<p /><i>Generated on: ".getBytes());
|
||||||
out.write(new Date().toString().getBytes());
|
out.write(new Date().toString().getBytes());
|
||||||
out.write("</i></body></html>\n".getBytes());
|
out.write("</i></body></html>\n".getBytes());
|
||||||
|
@ -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
|
2007-01-17 zzz
|
||||||
* Add note on Syndie index.html steering people to new Syndie
|
* Add note on Syndie index.html steering people to new Syndie
|
||||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RouterVersion {
|
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 String VERSION = "0.6.1.26";
|
||||||
public final static long BUILD = 8;
|
public final static long BUILD = 9;
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||||
System.out.println("Router ID: " + RouterVersion.ID);
|
System.out.println("Router ID: " + RouterVersion.ID);
|
||||||
|
Reference in New Issue
Block a user