Improved uptime survey in case of 403 status.
This commit is contained in:
parent
4ac7be0e78
commit
abde4824f8
1 changed files with 9 additions and 1 deletions
|
@ -79,6 +79,7 @@ public class UptimeSurveyor
|
||||||
int boundMax = 7;
|
int boundMax = 7;
|
||||||
boolean ended = false;
|
boolean ended = false;
|
||||||
URL currentURL = url;
|
URL currentURL = url;
|
||||||
|
String currentUserAgent = "StatoolInfos Uptime Bot";
|
||||||
result = 0;
|
result = 0;
|
||||||
int currentBound = 0;
|
int currentBound = 0;
|
||||||
while (!ended)
|
while (!ended)
|
||||||
|
@ -88,7 +89,7 @@ public class UptimeSurveyor
|
||||||
HttpURLConnection connection = (HttpURLConnection) currentURL.openConnection();
|
HttpURLConnection connection = (HttpURLConnection) currentURL.openConnection();
|
||||||
connection.setConnectTimeout(5 * 1000);
|
connection.setConnectTimeout(5 * 1000);
|
||||||
connection.setReadTimeout(5 * 1000);
|
connection.setReadTimeout(5 * 1000);
|
||||||
connection.setRequestProperty("User-Agent", "StatoolInfos Uptime Bot");
|
connection.setRequestProperty("User-Agent", currentUserAgent);
|
||||||
result = connection.getResponseCode();
|
result = connection.getResponseCode();
|
||||||
String location = connection.getHeaderField("Location");
|
String location = connection.getHeaderField("Location");
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
|
@ -100,6 +101,13 @@ public class UptimeSurveyor
|
||||||
|
|
||||||
currentBound += 1;
|
currentBound += 1;
|
||||||
}
|
}
|
||||||
|
else if (result == 403)
|
||||||
|
{
|
||||||
|
System.out.println(Thread.currentThread().getId() + " 403 FORBIDDEN DETECTED " + currentURL.toString() + " -> " + location);
|
||||||
|
currentUserAgent = "Mozilla from StatoolInfos Uptime B**";
|
||||||
|
|
||||||
|
currentBound += 1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ended = true;
|
ended = true;
|
||||||
|
|
Loading…
Reference in a new issue