SSL wizard: Add missing file, fix form params

This commit is contained in:
zzz
2018-04-28 15:25:05 +00:00
parent 624a672213
commit 145730f5b8
2 changed files with 73 additions and 7 deletions

View File

@@ -0,0 +1,60 @@
package net.i2p.i2ptunnel.web;
import java.util.ArrayList;
import java.util.List;
/**
* Helper class for ssl.jsp
*
* @since 0.9.35
*/
public class SSLHelper {
/**
* Adapted from LoadClientAppsJob
* @return param args non-null
* @return non-null
*/
public static List<String> parseArgs(String args) {
List<String> argList = new ArrayList<String>(4);
StringBuilder buf = new StringBuilder(32);
boolean isQuoted = false;
for (int j = 0; j < args.length(); j++) {
char c = args.charAt(j);
switch (c) {
case '\'':
case '"':
if (isQuoted) {
String str = buf.toString().trim();
if (str.length() > 0)
argList.add(str);
buf.setLength(0);
}
isQuoted = !isQuoted;
break;
case ' ':
case '\t':
// whitespace - if we're in a quoted section, keep this as part of the quote,
// otherwise use it as a delim
if (isQuoted) {
buf.append(c);
} else {
String str = buf.toString().trim();
if (str.length() > 0)
argList.add(str);
buf.setLength(0);
}
break;
default:
buf.append(c);
break;
}
}
if (buf.length() > 0) {
String str = buf.toString().trim();
if (str.length() > 0)
argList.add(str);
}
return argList;
}
}

View File

@@ -99,16 +99,14 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
if (name == null || name.equals(""))
name = editBean.getTunnelName(curTunnel);
if (!"new".equals(tunnelType)) {
%>
<form method="post" action="ssl" accept-charset="UTF-8">
<input type="hidden" name="tunnel" value="<%=curTunnel%>" />
<input type="hidden" name="nonce" value="<%=net.i2p.i2ptunnel.web.IndexBean.getNextNonce()%>" />
<input type="hidden" name="type" value="<%=tunnelType%>" />
<input type="submit" class="default" name="action" value="Save changes" />
<%
if (!"new".equals(tunnelType)) {
%>
<form method="post" action="ssl?tunnel=<%=curTunnel%>" accept-charset="UTF-8">
<table>
<tr><td colspan="4" class="infohelp"><%=intl._t("Experts only!")%> Beta!</td></tr>
<tr><td colspan="4"><b><%=intl._t("Tunnel name")%>:</b> <%=editBean.getTunnelName(curTunnel)%></td></tr>
@@ -374,6 +372,14 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
<tr><td colspan="7">Jetty SSL cert passwords are not the default</td></tr>
<%
} // isPWDefault
%>
<tr><td colspan="7"><b><%=intl._t("Password")%>:</b>
<input type="password" name="nofilter_keyPassword" title="<%=intl._t("Set password required to access this service")%>" value="" class="freetext password" />
</td></tr>
<tr><td class="buttons" colspan="7">
<button id="controlSave" class="control" type="submit" name="action" value="Generate"><%=intl._t("Generate certificate")%></button>
</td></tr>
<%
} // canConfigure
} // for client
} catch (java.io.IOException ioe) { ioe.printStackTrace(); }