i2ptunnel: Fix multiple SSL outproxies in HTTP client

escape and truncate URL on error page
This commit is contained in:
zzz
2015-03-31 11:21:32 +00:00
parent 891408191e
commit c770c6bc6a
4 changed files with 16 additions and 7 deletions

View File

@ -1224,7 +1224,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
String s = getTunnel().getClientOptions().getProperty(PROP_SSL_OUTPROXIES); String s = getTunnel().getClientOptions().getProperty(PROP_SSL_OUTPROXIES);
if (s == null) if (s == null)
return null; return null;
String[] p = s.split(", "); String[] p = s.split("[,; \r\n\t]");
if (p.length == 0) if (p.length == 0)
return null; return null;
// todo doesn't check for "" // todo doesn't check for ""

View File

@ -215,11 +215,14 @@ public abstract class I2PTunnelHTTPClientBase extends I2PTunnelClientBase implem
// see TunnelController.setSessionOptions() // see TunnelController.setSessionOptions()
String proxies = props.getProperty("proxyList"); String proxies = props.getProperty("proxyList");
if (proxies != null) { if (proxies != null) {
StringTokenizer tok = new StringTokenizer(proxies, ", "); StringTokenizer tok = new StringTokenizer(proxies, ",; \r\n\t");
synchronized(_proxyList) { synchronized(_proxyList) {
_proxyList.clear(); _proxyList.clear();
while (tok.hasMoreTokens()) while (tok.hasMoreTokens()) {
_proxyList.add(tok.nextToken().trim()); String p = tok.nextToken().trim();
if (p.length() > 0)
_proxyList.add(tok.nextToken().trim());
}
} }
} else { } else {
synchronized(_proxyList) { synchronized(_proxyList) {
@ -664,11 +667,14 @@ public abstract class I2PTunnelHTTPClientBase extends I2PTunnelClientBase implem
Writer out = new BufferedWriter(new OutputStreamWriter(outs, "UTF-8")); Writer out = new BufferedWriter(new OutputStreamWriter(outs, "UTF-8"));
out.write(errMessage); out.write(errMessage);
if (targetRequest != null) { if (targetRequest != null) {
String uri = targetRequest.replace("&", "&"); String uri = DataHelper.escapeHTML(targetRequest);
out.write("<a href=\""); out.write("<a href=\"");
out.write(uri); out.write(uri);
out.write("\">"); out.write("\">");
out.write(uri); if (targetRequest.length() > 80)
out.write(DataHelper.escapeHTML(targetRequest.substring(0, 75)) + "&hellip;");
else
out.write(uri);
out.write("</a>"); out.write("</a>");
if (usingWWWProxy) { if (usingWWWProxy) {
out.write("<br><br><b>"); out.write("<br><br><b>");

View File

@ -1,3 +1,6 @@
2015-03-31 zzz
* i2ptunnel: Fix multiple SSL outproxies in HTTP client
2015-03-29 zzz 2015-03-29 zzz
* I2CP: Prevent NPE (ticket #1503) * I2CP: Prevent NPE (ticket #1503)

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 13; public final static long BUILD = 14;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = "-rc"; public final static String EXTRA = "-rc";