]> WPIA git - gigi.git/blobdiff - tests/org/cacert/gigi/testUtils/PingTest.java
fix: do not follow redirects when doing http-pings (+testCase)
[gigi.git] / tests / org / cacert / gigi / testUtils / PingTest.java
index 0d15f2e86c3cf5807c3a969d647b83e061103c89..967fdb2ded062a95e998f640767bd77ecbee4cfc 100644 (file)
@@ -51,8 +51,9 @@ public abstract class PingTest extends ClientTest {
         openConnection.setDoOutput(true);
         openConnection.getOutputStream().write(content.getBytes("UTF-8"));
         openConnection.getHeaderField("Location");
         openConnection.setDoOutput(true);
         openConnection.getOutputStream().write(content.getBytes("UTF-8"));
         openConnection.getHeaderField("Location");
-        if (((HttpURLConnection) openConnection).getResponseCode() != 302) {
-            throw new Error(IOUtils.readURL(openConnection));
+        int code = ((HttpURLConnection) openConnection).getResponseCode();
+        if (code != 302) {
+            throw new Error("Code was: " + code + "\ncontent was: " + IOUtils.readURL(openConnection));
         }
 
         String newcontent = IOUtils.readURL(get(DomainOverview.PATH));
         }
 
         String newcontent = IOUtils.readURL(get(DomainOverview.PATH));