import static org.junit.Assert.*;
import java.io.IOException;
-import java.net.URL;
import org.cacert.gigi.testUtils.ManagedTest;
import org.junit.Test;
}
private void logout(String cookie) throws IOException {
- cookie(new URL("https://" + getServerName() + "/logout").openConnection(), cookie).getHeaderField("Location");
+ get(cookie, "/logout").getHeaderField("Location");
}
}
import static org.junit.Assert.*;
import java.io.IOException;
-import java.net.URL;
import java.util.Locale;
import org.cacert.gigi.dbObjects.User;
@Test
public void testSelectStandard() throws IOException {
- String content = IOUtils.readURL(new URL("https://" + getServerName() + "/").openConnection());
+ String content = IOUtils.readURL(get("cook", "/"));
assertThat(content, containsString("Translations"));
}
@Test
public void testSelectGerman() throws IOException {
- String content = IOUtils.readURL(new URL("https://" + getServerName() + "/?lang=de").openConnection());
+ String content = IOUtils.readURL(get("", "/?lang=de"));
assertThat(content, containsString(Language.getInstance(Locale.GERMAN).getTranslation("Translations")));
}
setAcceptLanguage("de,en");
User u = User.getById(createVerifiedUser("fname", "lname", createUniqueName() + "@example.org", TEST_PASSWORD));
String cookie = login(u.getEmail(), TEST_PASSWORD);
- String content = IOUtils.readURL(cookie(new URL("https://" + getServerName() + "/").openConnection(), cookie));
+ String content = IOUtils.readURL(get(cookie, "/"));
assertThat(content, containsString(Language.getInstance(Locale.GERMAN).getTranslation("Translations")));
}
setAcceptLanguage("fr,de,en");
User u = User.getById(createVerifiedUser("fname", "lname", createUniqueName() + "@example.org", TEST_PASSWORD));
String cookie = login(u.getEmail(), TEST_PASSWORD);
- String content = IOUtils.readURL(cookie(new URL("https://" + getServerName() + "/").openConnection(), cookie));
+ String content = IOUtils.readURL(get(cookie, "/"));
assertThat(content, containsString(Language.getInstance(Locale.FRENCH).getTranslation("Translations")));
}
}
import java.io.IOException;
import java.net.HttpURLConnection;
-import java.net.URL;
import org.cacert.gigi.testUtils.ManagedTest;
import org.junit.Test;
@Test
public void testSTS() throws IOException {
- HttpURLConnection uc = (HttpURLConnection) new URL("https://" + getServerName()).openConnection();
+ HttpURLConnection uc = get(null, "/");
assertNotNull(uc.getHeaderField("Strict-Transport-Security"));
}
public void testCSP() throws IOException {
- HttpURLConnection uc = (HttpURLConnection) new URL("https://" + getServerName()).openConnection();
+ HttpURLConnection uc = get(null, "/");
assertNotNull(uc.getHeaderField("Content-Security-Policy"));
}
public void testAllowOrigin() throws IOException {
- HttpURLConnection uc = (HttpURLConnection) new URL("https://" + getServerName()).openConnection();
+ HttpURLConnection uc = get(null, "/");
assertNotNull(uc.getHeaderField("Access-Control-Allow-Origin"));
}
import java.io.IOException;
import java.net.MalformedURLException;
-import java.net.URL;
import java.net.URLConnection;
import java.util.Locale;
import java.util.regex.Matcher;
String fname = "Först";
String lname = "Secönd";
int id = createVerifiedUser(fname, lname, email, TEST_PASSWORD);
- URLConnection uc = new URL("https://" + getServerName() + SupportUserDetailsPage.PATH + id).openConnection();
- uc.addRequestProperty("Cookie", cookie);
+ URLConnection uc = get(SupportUserDetailsPage.PATH + id);
uc.setDoOutput(true);
String res = IOUtils.readURL(uc);
assertThat(res, containsString("<input type=\"text\" value=\"" + fname + "\" name=\"fname\">"));
import static org.junit.Assume.*;
import java.io.IOException;
-import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
-import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
User user = User.getById(id);
String domainName = createUniqueName() + ".org";
new Domain(user, user, domainName);
- URLConnection uc = new URL("https://" + getServerName() + FindDomainPage.PATH).openConnection();
- uc.addRequestProperty("Cookie", cookie);
- String csrf = getCSRF(uc, 0);
+ URLConnection uc = post(FindDomainPage.PATH, "process&domain=" + URLEncoder.encode(domainName, "UTF-8"));
- uc = new URL("https://" + getServerName() + FindDomainPage.PATH).openConnection();
- uc.addRequestProperty("Cookie", cookie);
- uc.setDoOutput(true);
- OutputStream os = uc.getOutputStream();
- os.write(("csrf=" + URLEncoder.encode(csrf, "UTF-8") + "&" //
- + "process&domain=" + URLEncoder.encode(domainName, "UTF-8")).getBytes("UTF-8"));
- os.flush();
assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + id, uc.getHeaderField("Location"));
}
User user = User.getById(id);
String domainName = createUniqueName() + ".org";
Domain d = new Domain(user, user, domainName);
- URLConnection uc = new URL("https://" + getServerName() + FindDomainPage.PATH).openConnection();
- uc.addRequestProperty("Cookie", cookie);
- String csrf = getCSRF(uc, 0);
-
- uc = new URL("https://" + getServerName() + FindDomainPage.PATH).openConnection();
- uc.addRequestProperty("Cookie", cookie);
- uc.setDoOutput(true);
- OutputStream os = uc.getOutputStream();
- os.write(("csrf=" + URLEncoder.encode(csrf, "UTF-8") + "&" //
- + "process&domain=#" + d.getId()).getBytes("UTF-8"));
- os.flush();
+ URLConnection uc = post(FindDomainPage.PATH, "process&domain=#" + d.getId());
assertEquals("https://" + ServerConstants.getWwwHostNamePortSecure() + SupportUserDetailsPage.PATH + id, uc.getHeaderField("Location"));
}
@Test
public void testDomainSearchNonExist() throws MalformedURLException, UnsupportedEncodingException, IOException, GigiApiException {
- URLConnection uc = new URL("https://" + getServerName() + FindDomainPage.PATH).openConnection();
- uc.addRequestProperty("Cookie", cookie);
- String csrf = getCSRF(uc, 0);
-
- uc = new URL("https://" + getServerName() + FindDomainPage.PATH).openConnection();
- uc.addRequestProperty("Cookie", cookie);
- uc.setDoOutput(true);
- OutputStream os = uc.getOutputStream();
- os.write(("csrf=" + URLEncoder.encode(csrf, "UTF-8") + "&" //
- + "process&domain=" + URLEncoder.encode(createUniqueName() + ".de", "UTF-8")).getBytes("UTF-8"));
- os.flush();
+ URLConnection uc = post(FindDomainPage.PATH, "process&domain=" + URLEncoder.encode(createUniqueName() + ".de", "UTF-8"));
assertNotNull(fetchStartErrorMessage(IOUtils.readURL(uc)));
}
found = true;
}
assumeTrue(found);
- URLConnection uc = new URL("https://" + getServerName() + FindDomainPage.PATH).openConnection();
- uc.addRequestProperty("Cookie", cookie);
- String csrf = getCSRF(uc, 0);
- uc = new URL("https://" + getServerName() + FindDomainPage.PATH).openConnection();
- uc.addRequestProperty("Cookie", cookie);
- uc.setDoOutput(true);
- OutputStream os = uc.getOutputStream();
- os.write(("csrf=" + URLEncoder.encode(csrf, "UTF-8") + "&" //
- + "process&domain=#" + id).getBytes("UTF-8"));
- os.flush();
+ URLConnection uc = post(FindDomainPage.PATH, "process&domain=#" + id);
assertNotNull(fetchStartErrorMessage(IOUtils.readURL(uc)));
}
}
import static org.junit.Assert.*;
import java.io.IOException;
-import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
-import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
@Test
public void testWildcardMailSearchNoRes() throws MalformedURLException, UnsupportedEncodingException, IOException {
- URLConnection uc = new URL("https://" + getServerName() + FindUserPage.PATH).openConnection();
- uc.addRequestProperty("Cookie", cookie);
- String csrf = getCSRF(uc, 0);
-
- uc = new URL("https://" + getServerName() + FindUserPage.PATH).openConnection();
- uc.addRequestProperty("Cookie", cookie);
- uc.setDoOutput(true);
- OutputStream os = uc.getOutputStream();
- os.write(("csrf=" + URLEncoder.encode(csrf, "UTF-8") + "&" //
- + "process&email=" + URLEncoder.encode("%@_humpfelkumpf.org", "UTF-8")).getBytes("UTF-8"));
- os.flush();
+ URLConnection uc = post(FindUserPage.PATH, "process&email=" + URLEncoder.encode("%@_humpfelkumpf.org", "UTF-8"));
assertNotNull(fetchStartErrorMessage(IOUtils.readURL(uc)));
}
import java.io.IOException;
import java.net.HttpURLConnection;
-import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.sql.SQLException;
o1.addAdmin(u2, u, false);
String session2 = login(u2.getEmail(), TEST_PASSWORD);
- URLConnection uc = new URL("https://" + getServerName() + ViewOrgPage.DEFAULT_PATH).openConnection();
- uc.addRequestProperty("Cookie", session2);
+ URLConnection uc = get(session2, ViewOrgPage.DEFAULT_PATH);
assertEquals(403, ((HttpURLConnection) uc).getResponseCode());
- uc = new URL("https://" + getServerName() + MyDetails.PATH).openConnection();
- uc.addRequestProperty("Cookie", session2);
+ uc = get(session2, MyDetails.PATH);
String content = IOUtils.readURL(uc);
assertThat(content, containsString("name21"));
assertThat(content, not(containsString("name12")));
- uc = cookie(new URL("https://" + getServerName() + ViewOrgPage.DEFAULT_PATH + "/" + o1.getId()).openConnection(), session2);
+ uc = get(session2, ViewOrgPage.DEFAULT_PATH + "/" + o1.getId());
assertEquals(403, ((HttpURLConnection) uc).getResponseCode());
- uc = cookie(new URL("https://" + getServerName() + ViewOrgPage.DEFAULT_PATH + "/" + o2.getId()).openConnection(), session2);
+ uc = get(session2, ViewOrgPage.DEFAULT_PATH + "/" + o2.getId());
assertEquals(403, ((HttpURLConnection) uc).getResponseCode());
- uc = new URL("https://" + getServerName() + ViewOrgPage.DEFAULT_PATH).openConnection();
- uc.addRequestProperty("Cookie", cookie);
+ uc = get(ViewOrgPage.DEFAULT_PATH);
content = IOUtils.readURL(uc);
assertThat(content, containsString("name21"));
assertThat(content, containsString("name12"));
- uc = cookie(new URL("https://" + getServerName() + ViewOrgPage.DEFAULT_PATH + "/" + o1.getId()).openConnection(), cookie);
+ uc = get(ViewOrgPage.DEFAULT_PATH + "/" + o1.getId());
assertEquals(200, ((HttpURLConnection) uc).getResponseCode());
- uc = cookie(new URL("https://" + getServerName() + ViewOrgPage.DEFAULT_PATH + "/" + o2.getId()).openConnection(), cookie);
+ uc = get(ViewOrgPage.DEFAULT_PATH + "/" + o2.getId());
assertEquals(200, ((HttpURLConnection) uc).getResponseCode());
o1.delete();
o2.delete();
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
-import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.sql.SQLException;
}
private String search(String query) throws MalformedURLException, IOException, UnsupportedEncodingException {
- URL u = new URL("https://" + getServerName() + AssurePage.PATH);
- URLConnection uc = u.openConnection();
+ URLConnection uc = get(cookie, AssurePage.PATH);
uc.setDoOutput(true);
- uc.addRequestProperty("Cookie", cookie);
uc.getOutputStream().write(("search&" + query).getBytes("UTF-8"));
uc.getOutputStream().flush();
String error = getError("date=2000-01-01&location=" + uniqueLoc + "&certify=1&rules=1&CCAAgreed=1&assertion=1&points=10");
assertNull(error);
String cookie = login(assureeM, TEST_PASSWORD);
- URLConnection url = new URL("https://" + getServerName() + MyPoints.PATH).openConnection();
- url.setRequestProperty("Cookie", cookie);
+ URLConnection url = get(cookie, MyPoints.PATH);
String resp = IOUtils.readURL(url);
resp = resp.split(Pattern.quote("</table>"))[0];
assertThat(resp, containsString(uniqueLoc));
String error = getError("date=2000-01-01&location=" + uniqueLoc + "&certify=1&rules=1&CCAAgreed=1&assertion=1&points=10");
assertNull(error);
String cookie = login(assurerM, TEST_PASSWORD);
- URLConnection url = new URL("https://" + getServerName() + MyPoints.PATH).openConnection();
- url.setRequestProperty("Cookie", cookie);
+ URLConnection url = get(cookie, MyPoints.PATH);
String resp = IOUtils.readURL(url);
resp = resp.split(Pattern.quote("</table>"))[1];
assertThat(resp, containsString(uniqueLoc));
}
public static URLConnection buildupAssureFormConnection(String cookie, String email, boolean doCSRF) throws MalformedURLException, IOException {
- URL u = new URL("https://" + getServerName() + AssurePage.PATH);
- URLConnection uc = u.openConnection();
- uc.addRequestProperty("Cookie", cookie);
+ URLConnection uc = get(cookie, AssurePage.PATH);
uc.setDoOutput(true);
uc.getOutputStream().write(("email=" + URLEncoder.encode(email, "UTF-8") + "&day=1&month=1&year=1910&search").getBytes("UTF-8"));
String csrf = getCSRF(uc);
- uc = u.openConnection();
- uc.addRequestProperty("Cookie", cookie);
+ uc = get(cookie, AssurePage.PATH);
uc.setDoOutput(true);
if (doCSRF) {
uc.getOutputStream().write(("csrf=" + csrf + "&").getBytes("UTF-8"));
import static org.junit.Assert.*;
import java.io.IOException;
-import java.net.URL;
import org.cacert.gigi.GigiApiException;
import org.cacert.gigi.dbObjects.Group;
public class TestTTP extends ClientTest {
- URL ttpPage = new URL("https://" + getServerName() + RequestTTPPage.PATH);
-
public TestTTP() throws IOException {}
@Test
public void testTTPApply() throws IOException {
- String ttp = IOUtils.readURL(cookie(ttpPage.openConnection(), cookie));
+ String ttp = IOUtils.readURL(get(RequestTTPPage.PATH));
assertThat(ttp, containsString("<form"));
executeBasicWebInteraction(cookie, RequestTTPPage.PATH, "country=0");
- ttp = IOUtils.readURL(cookie(new URL("https://" + getServerName() + RequestTTPPage.PATH).openConnection(), cookie));
+ ttp = IOUtils.readURL(get(RequestTTPPage.PATH));
assertThat(ttp, not(containsString("<form")));
ObjectCache.clearAllCaches();
u = User.getById(u.getId());
User u = User.getById(createAssuranceUser("fn", "ln", createUniqueName() + "@example.org", TEST_PASSWORD));
cookie = login(u.getEmail(), TEST_PASSWORD);
- String ttp = IOUtils.readURL(cookie(new URL("https://" + getServerName() + RequestTTPPage.PATH).openConnection(), cookie));
+ String ttp = IOUtils.readURL(get(RequestTTPPage.PATH));
assertThat(ttp, not(containsString("<form")));
}
}
import static org.junit.Assert.*;
import java.io.IOException;
-import java.net.HttpURLConnection;
import java.net.MalformedURLException;
-import java.net.URL;
import org.cacert.gigi.dbObjects.Group;
import org.cacert.gigi.dbObjects.User;
grant(u.getEmail(), TTPAdminPage.TTP_APPLICANT);
cookie = login(u.getEmail(), TEST_PASSWORD);
- assertEquals( !hasRight ? 403 : 200, fetchStatusCode("https://" + getServerName() + TTPAdminPage.PATH));
- assertEquals( !hasRight ? 403 : 200, fetchStatusCode("https://" + getServerName() + TTPAdminPage.PATH + "/"));
- assertEquals( !hasRight ? 403 : 200, fetchStatusCode("https://" + getServerName() + TTPAdminPage.PATH + "/" + u.getId()));
- assertEquals( !hasRight ? 403 : 404, fetchStatusCode("https://" + getServerName() + TTPAdminPage.PATH + "/" + us2.getId()));
- assertEquals( !hasRight ? 403 : 404, fetchStatusCode("https://" + getServerName() + TTPAdminPage.PATH + "/" + 100));
+ assertEquals( !hasRight ? 403 : 200, fetchStatusCode(TTPAdminPage.PATH));
+ assertEquals( !hasRight ? 403 : 200, fetchStatusCode(TTPAdminPage.PATH + "/"));
+ assertEquals( !hasRight ? 403 : 200, fetchStatusCode(TTPAdminPage.PATH + "/" + u.getId()));
+ assertEquals( !hasRight ? 403 : 404, fetchStatusCode(TTPAdminPage.PATH + "/" + us2.getId()));
+ assertEquals( !hasRight ? 403 : 404, fetchStatusCode(TTPAdminPage.PATH + "/" + 100));
}
private int fetchStatusCode(String path) throws MalformedURLException, IOException {
- URL u = new URL(path);
- return ((HttpURLConnection) cookie(u.openConnection(), cookie)).getResponseCode();
+ return get(path).getResponseCode();
}
}
import static org.junit.Assume.*;
import java.io.IOException;
-import java.net.URL;
import java.net.URLEncoder;
import java.sql.SQLException;
import java.util.regex.Matcher;
import javax.naming.NamingException;
-import org.cacert.gigi.pages.account.domain.DomainOverview;
import org.cacert.gigi.testUtils.IOUtils;
import org.cacert.gigi.testUtils.PingTest;
import org.cacert.gigi.testUtils.TestEmailReceiver.TestMail;
String test = getTestProps().getProperty("domain.dnstest");
assumeNotNull(test);
- URL u = new URL("https://" + getServerName() + DomainOverview.PATH);
- Matcher m = initailizeDomainForm(u);
+ Matcher m = initailizeDomainForm();
updateService(m.group(1) + (dnsVariant == 1 ? "a" : ""), m.group(2) + (dnsVariant == 2 ? "a" : ""), "dns");
String content = "newdomain=" + URLEncoder.encode(test, "UTF-8") + //
"&ssl-type-2=direct&ssl-port-2=" + //
"&ssl-type-3=direct&ssl-port-3=" + //
"&adddomain&csrf=" + csrf;
- URL u2 = sendDomainForm(u, content);
+ String p2 = sendDomainForm(content);
TestMail mail = getMailReciever().receive();
if (emailVariant == 0) {
waitForPings(2);
- String newcontent = IOUtils.readURL(cookie(u2.openConnection(), cookie));
+ String newcontent = IOUtils.readURL(get(p2));
Pattern pat = Pattern.compile("<td>dns</td>\\s*<td>success</td>");
assertTrue(newcontent, !successDNS ^ pat.matcher(newcontent).find());
pat = Pattern.compile("<td>email</td>\\s*<td>success</td>");
import org.cacert.gigi.dbObjects.Domain;
import org.cacert.gigi.dbObjects.DomainPingConfiguration;
import org.cacert.gigi.dbObjects.DomainPingType;
-import org.cacert.gigi.pages.account.domain.DomainOverview;
import org.cacert.gigi.testUtils.IOUtils;
import org.cacert.gigi.testUtils.PingTest;
import org.cacert.gigi.testUtils.TestEmailReceiver.TestMail;
String test = getTestProps().getProperty("domain.http");
assumeNotNull(test);
- URL u = new URL("https://" + getServerName() + DomainOverview.PATH);
- Matcher m = initailizeDomainForm(u);
+ Matcher m = initailizeDomainForm();
updateService(m.group(1) + (httpVariant == 1 ? "a" : ""), m.group(2) + (httpVariant == 2 ? "a" : ""), "http");
String content = "newdomain=" + URLEncoder.encode(test, "UTF-8") + //
"&ssl-type-2=direct&ssl-port-2=" + //
"&ssl-type-3=direct&ssl-port-3=" + //
"&adddomain&csrf=" + csrf;
- URL u2 = sendDomainForm(u, content);
+ String p2 = sendDomainForm(content);
TestMail mail = getMailReciever().receive();
if (emailVariant == 0) {
}
waitForPings(2);
- String newcontent = IOUtils.readURL(cookie(u2.openConnection(), cookie));
+ String newcontent = IOUtils.readURL(get(p2));
Pattern pat = Pattern.compile("<td>http</td>\\s*<td>success</td>");
assertTrue(newcontent, !successHTTP ^ pat.matcher(newcontent).find());
pat = Pattern.compile("<td>email</td>\\s*<td>success</td>");
assertTrue(newcontent, !successMail ^ pat.matcher(newcontent).find());
if (successHTTP) { // give it a second try
- int id = Integer.parseInt(u2.toString().replaceFirst("^.*/([0-9]+)$", "$1"));
+ int id = Integer.parseInt(p2.replaceFirst("^.*/([0-9]+)$", "$1"));
Domain d = Domain.getById(id);
DomainPingConfiguration dpc = null;
for (DomainPingConfiguration conf : d.getConfiguredPings()) {
if (dpc == null) {
fail("Http config not found");
}
- String res = executeBasicWebInteraction(cookie, u2.getPath(), "configId=" + dpc.getId());
+ String res = executeBasicWebInteraction(cookie, p2, "configId=" + dpc.getId());
assertThat(res, containsString("only allowed after"));
}
}
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.Socket;
-import java.net.URL;
import java.net.URLEncoder;
import java.security.GeneralSecurityException;
import java.security.KeyManagementException;
import org.cacert.gigi.dbObjects.CertificateProfile;
import org.cacert.gigi.dbObjects.Digest;
import org.cacert.gigi.dbObjects.User;
-import org.cacert.gigi.pages.account.domain.DomainOverview;
import org.cacert.gigi.testUtils.IOUtils;
import org.cacert.gigi.testUtils.PingTest;
import org.cacert.gigi.testUtils.TestEmailReceiver.TestMail;
private void testEmailAndSSL(int sslVariant, int emailVariant, boolean successMail) throws IOException, InterruptedException, SQLException, GeneralSecurityException, GigiApiException {
String test = getTestProps().getProperty("domain.local");
assumeNotNull(test);
- URL u = new URL("https://" + getServerName() + DomainOverview.PATH);
-
- Matcher m = initailizeDomainForm(u);
+ Matcher m = initailizeDomainForm();
String value = m.group(2);
if (self) {
"&ssl-type-2=direct&ssl-port-2=" + //
"&ssl-type-3=direct&ssl-port-3=" + //
"&adddomain&csrf=" + csrf;
- URL u2 = sendDomainForm(u, content);
+ String p2 = sendDomainForm(content);
boolean firstSucceeds = sslVariant != 0 && sslVariant != 2;
AsyncTask<Boolean> ass = new AsyncTask<Boolean>() {
}
waitForPings(3);
- String newcontent = IOUtils.readURL(cookie(u2.openConnection(), cookie));
+ String newcontent = IOUtils.readURL(get(p2));
Pattern pat = Pattern.compile("<td>ssl</td>\\s*<td>success</td>");
Matcher matcher = pat.matcher(newcontent);
assertTrue(newcontent, firstSucceeds ^ matcher.find());
return (HttpURLConnection) uc;
}
- public HttpURLConnection get(String cookie, String path) throws IOException {
+ public static HttpURLConnection get(String cookie, String path) throws IOException {
URLConnection uc = new URL("https://" + getServerName() + path).openConnection();
uc.addRequestProperty("Cookie", cookie);
return (HttpURLConnection) uc;
}
}
- protected URL sendDomainForm(URL u, String content) throws IOException, MalformedURLException {
- URLConnection openConnection = u.openConnection();
- openConnection.setRequestProperty("Cookie", cookie);
+ protected String sendDomainForm(String content) throws IOException, MalformedURLException {
+ URLConnection openConnection = get(DomainOverview.PATH);
openConnection.setDoOutput(true);
openConnection.getOutputStream().write(content.getBytes("UTF-8"));
openConnection.getHeaderField("Location");
throw new Error(IOUtils.readURL(openConnection));
}
- String newcontent = IOUtils.readURL(cookie(u.openConnection(), cookie));
+ String newcontent = IOUtils.readURL(get(DomainOverview.PATH));
Pattern dlink = Pattern.compile(DomainOverview.PATH + "([0-9]+)'>");
Matcher m1 = dlink.matcher(newcontent);
if ( !m1.find()) {
throw new Error(newcontent);
}
- URL u2 = new URL(u.toString() + m1.group(1));
- return u2;
+ return DomainOverview.PATH + m1.group(1);
}
- protected Matcher initailizeDomainForm(URL u) throws IOException, Error {
- URLConnection openConnection = u.openConnection();
- openConnection.setRequestProperty("Cookie", cookie);
- String content1 = IOUtils.readURL(openConnection);
+ protected Matcher initailizeDomainForm() throws IOException, Error {
+ String content1 = IOUtils.readURL(get(DomainOverview.PATH));
csrf = getCSRF(1, content1);
Pattern p = Pattern.compile("([A-Za-z0-9]+)._cacert._auth IN TXT ([A-Za-z0-9]+)");