From 3f44c1320a9c5239d3353d1571e4e1decd4592b9 Mon Sep 17 00:00:00 2001 From: bol-van Date: Wed, 8 Dec 2021 17:11:00 +0300 Subject: [PATCH] blockcheck: improve bad redirect detection --- blockcheck.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/blockcheck.sh b/blockcheck.sh index d4def65..2de24c8 100755 --- a/blockcheck.sh +++ b/blockcheck.sh @@ -154,7 +154,8 @@ curl_test_http() code=$(hdrfile_http_code "$HDRTEMP") [ "$code" = 301 -o "$code" = 302 -o "$code" = 307 -o "$code" = 308 ] && { loc=$(hdrfile_location "$HDRTEMP") - [ "${loc#*$2}" = "$loc" ] && { + echo "$loc" | grep -qE "^https?://.*$2(/|$)" || + echo "$loc" | grep -vqE '^https?://' || { echo suspicious redirection to : $loc rm -f "$HDRTEMP" return 254