Added cookie manager for uptime survey.

This commit is contained in:
Christian P. MOMON 2021-07-03 19:55:38 +02:00
parent 893b54e013
commit 164498339d

View file

@ -19,6 +19,8 @@
package fr.devinsy.statoolinfos.uptime; package fr.devinsy.statoolinfos.uptime;
import java.io.IOException; import java.io.IOException;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
@ -93,7 +95,7 @@ public class UptimeSurveyor
if ((result == 301) || (result == 302) || (result == 307) || (result == 308)) if ((result == 301) || (result == 302) || (result == 307) || (result == 308))
{ {
System.out.println("BOUND DETECTED " + currentURL.toString() + " -> " + location); System.out.println(Thread.currentThread().getId() + " BOUND DETECTED " + currentURL.toString() + " -> " + location);
currentURL = new URL(location); currentURL = new URL(location);
currentBound += 1; currentBound += 1;
@ -153,6 +155,11 @@ public class UptimeSurveyor
} }
*/ */
//
CookieManager cookieManager = new CookieManager();
CookieHandler.setDefault(cookieManager);
//
ExecutorService pool = Executors.newFixedThreadPool(20); ExecutorService pool = Executors.newFixedThreadPool(20);
for (Uptime uptime : result) for (Uptime uptime : result)
{ {