I2PTunnelHTTPClient: Test for "http://:/" and output error page.

This avoids an ArrayIndexOutOfBoundsException, which can eventually
cause the eepproxy to stop functioning.
This commit is contained in:
sponge
2010-04-15 06:38:35 +00:00
parent 27587e83c8
commit 2fcee6e87a
4 changed files with 22 additions and 4 deletions

View File

@ -1,4 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
<file>file:/usblv/NetBeansProjects/i2p.i2p/apps/BOB/src/net/i2p/BOB/TCPtoI2P.java</file>
</open-files>
</project-private>

View File

@ -366,7 +366,17 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
int port = 80;
if(posPort != -1) {
String[] parts = host.split(":");
try {
host = parts[0];
} catch (ArrayIndexOutOfBoundsException ex) {
if (out != null) {
out.write(getErrorPage("denied", ERR_REQUEST_DENIED));
writeFooter(out);
}
s.close();
return;
}
try {
port = Integer.parseInt(parts[1]);
} catch(Exception exc) {
@ -437,9 +447,9 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
// Silently bypass correct keys, otherwise alert
String destB64 = null;
try {
Destination dest = I2PTunnel.destFromName(host);
if (dest != null)
destB64 = dest.toBase64();
Destination _dest = I2PTunnel.destFromName(host);
if (_dest != null)
destB64 = _dest.toBase64();
} catch (DataFormatException dfe) {}
if (destB64 != null && !destB64.equals(ahelperKey))
{

View File

@ -1,3 +1,8 @@
2010-04-15 sponge
* I2PTunnelHTTPClient: Test for "http://:/" and output error page.
This avoids an ArrayIndexOutOfBoundsException, which can eventually
cause the eepproxy to stop functioning.
2010-04-12 zzz
* configstats.jsp: Fix full stats checkbox default
* i2psnark:

View File

@ -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 = 9;
public final static long BUILD = 10;
/** for example "-test" */
public final static String EXTRA = "";