2004-10-10 cervantes

* Update the I2PTunnel HTTP proxy to strip out the i2paddresshelper from
      the request.
This commit is contained in:
jrandom
2004-10-10 14:57:15 +00:00
committed by zzz
parent 8dc261da79
commit 35e3bbb862
2 changed files with 21 additions and 4 deletions

View File

@ -199,10 +199,14 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
host = getHostName(destination); host = getHostName(destination);
if ( (host != null) && ("i2p".equals(host)) ) { if ( (host != null) && ("i2p".equals(host)) ) {
int pos2; int pos2;
if ((pos2 = line.indexOf("?")) != -1) { if ((pos2 = request.indexOf("?")) != -1) {
// Try to find an address helper in the fragments // Try to find an address helper in the fragments
String fragments = line.substring(pos2 + 1); // and split the request into it's component parts for rebuilding later
String fragments = request.substring(pos2 + 1);
String uriPath = request.substring(0, pos2);
pos2 = fragments.indexOf(" "); pos2 = fragments.indexOf(" ");
String protocolVersion = fragments.substring(pos2 + 1);
String urlEncoding = "";
fragments = fragments.substring(0, pos2); fragments = fragments.substring(0, pos2);
fragments = fragments + "&"; fragments = fragments + "&";
String fragment; String fragment;
@ -215,8 +219,17 @@ public class I2PTunnelHTTPClient extends I2PTunnelClientBase implements Runnable
if (pos2 >= 0) { if (pos2 >= 0) {
addressHelpers.put(destination,fragment.substring(pos2 + 1)); addressHelpers.put(destination,fragment.substring(pos2 + 1));
} }
} } else {
// append each fragment unless it's the address helper
if ("".equals(urlEncoding)) {
urlEncoding = "?" + fragment;
} else {
urlEncoding = urlEncoding + "&" + fragment;
}
}
} }
// reconstruct the request minus the i2paddresshelper GET var
request = uriPath + urlEncoding + " " + protocolVersion;
} }
String addressHelper = (String) addressHelpers.get(destination); String addressHelper = (String) addressHelpers.get(destination);

View File

@ -1,4 +1,8 @@
$Id: history.txt,v 1.41 2004/10/08 17:53:03 jrandom Exp $ $Id: history.txt,v 1.42 2004/10/09 19:03:27 jrandom Exp $
2004-10-10 cervantes
* Update the I2PTunnel HTTP proxy to strip out the i2paddresshelper from
the request.
2004-10-09 jrandom 2004-10-09 jrandom
* Added a watchdog timer to do some baseline liveliness checking to help * Added a watchdog timer to do some baseline liveliness checking to help