From 5d7451ccb1e163c8e1777246c3565ed9d78c9fb2 Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Fri, 15 Jul 2022 12:39:38 +0200 Subject: [PATCH] Prevent getting stuck on testing services that take too long to respond --- Docker/run-analysis.sh | 3 ++- Docker/utils.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Docker/run-analysis.sh b/Docker/run-analysis.sh index 2b7fd25..229f580 100755 --- a/Docker/run-analysis.sh +++ b/Docker/run-analysis.sh @@ -32,7 +32,7 @@ while IFS= read -r DOMAIN; do # these domains return a 404 anyways, no need to waste time on them: if is_http_error "$DOMAIN"; then echo "skipping $DOMAIN"; continue; fi load_website "$DOMAIN?hl=pl" "$DOMAIN" - sleep 4 # sometimes the consent popup needs a little time + sleep 1 # sometimes the consent popup needs a little time open_console grab "$DOMAIN before" (tr '\n' ' ' < click-accept-all.js) | xclip -sel clip @@ -46,6 +46,7 @@ done <<< "$DOMAINS" click 1270 217 # the "trash" icon, so requests from plamienie don't appear in the screenshots load_website "$URL" "$URL" +sleep 7 # sometimes the consent popup needs a little time echo "{\"current_action\": \"Strona $ORIGIN_DOMAIN wczytana. Przygotowywanie do analizy...\"}" grab load_website open_network_inspector diff --git a/Docker/utils.sh b/Docker/utils.sh index d25d858..92f4320 100644 --- a/Docker/utils.sh +++ b/Docker/utils.sh @@ -248,7 +248,7 @@ screenshot_and_annotate(){ get_http_status(){ _url="$1" - curl -L -s -o /dev/null --head -w "%{http_code}" "$_url" + curl --connect-timeout 3 --location --silent --output /dev/null --head --write-out "%{http_code}" "$_url" } is_http_error(){