import org.cacert.gigi.GigiApiException;
import org.cacert.gigi.dbObjects.Domain;
import org.cacert.gigi.dbObjects.DomainPingConfiguration;
-import org.cacert.gigi.dbObjects.DomainPingConfiguration.PingType;
+import org.cacert.gigi.dbObjects.DomainPingType;
import org.cacert.gigi.localisation.Language;
import org.cacert.gigi.output.template.Form;
import org.cacert.gigi.output.template.IterableDataset;
case SSL: {
doSSL = true;
String[] parts = dpc.getInfo().split(":");
- ports[portpos] = Integer.parseInt(parts[0]);
- if (parts.length == 2) {
- sslTypes[portpos] = SSLType.valueOf(parts[1].toUpperCase());
+ tokenName = parts[0];
+ tokenValue = parts[1];
+ ports[portpos] = Integer.parseInt(parts[2]);
+ if (parts.length == 4) {
+ sslTypes[portpos] = SSLType.valueOf(parts[3].toUpperCase());
} else {
sslTypes[portpos] = SSLType.DIRECT;
}
@Override
public boolean submit(PrintWriter out, HttpServletRequest req) throws GigiApiException {
- if (req.getParameter("emailType") != null) {
- String mail = AUTHORATIVE_EMAILS[Integer.parseInt(req.getParameter("email"))];
- target.addPing(PingType.EMAIL, mail);
+ target.clearPings();
+ if (req.getParameter("emailType") != null && req.getParameter("email") != null) {
+ try {
+ String mail = AUTHORATIVE_EMAILS[Integer.parseInt(req.getParameter("email"))];
+ target.addPing(DomainPingType.EMAIL, mail);
+ } catch (NumberFormatException e) {
+ throw new GigiApiException("A email address is required");
+ }
}
if (req.getParameter("DNSType") != null) {
- target.addPing(PingType.DNS, tokenName + ":" + tokenValue);
+ target.addPing(DomainPingType.DNS, tokenName + ":" + tokenValue);
}
if (req.getParameter("HTTPType") != null) {
- target.addPing(PingType.HTTP, tokenName + ":" + tokenValue);
+ target.addPing(DomainPingType.HTTP, tokenName + ":" + tokenValue);
}
if (req.getParameter("SSLType") != null) {
List<String> types = Arrays.asList(SSLPinger.TYPES);
}
int portInt = Integer.parseInt(port);
if ("direct".equals(type)) {
- target.addPing(PingType.SSL, port);
+ target.addPing(DomainPingType.SSL, tokenName + ":" + tokenValue + ":" + port);
} else if (types.contains(type)) {
- target.addPing(PingType.SSL, portInt + ":" + type);
+ target.addPing(DomainPingType.SSL, tokenName + ":" + tokenValue + ":" + portInt + ":" + type);
}
}