From c2df2f1fc00bf20fc730706bfa85ee2d679eee11 Mon Sep 17 00:00:00 2001 From: Dirk Date: Mon, 3 Feb 2020 22:26:01 +0100 Subject: [PATCH] Fix URL when hostname with trailing dot supplied Hostnames can contain a trailing dot (and sometimes they should). If they are supplied to testssl.sh however they will be also interpreted as a URL PATH when the servive is HTTP. This commit fixes that. --- testssl.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testssl.sh b/testssl.sh index 78f2ddf..5bca933 100755 --- a/testssl.sh +++ b/testssl.sh @@ -18802,8 +18802,9 @@ parse_hn_port() { SNI="-servername $NODE" URL_PATH=$(sed 's/https:\/\///' <<< "$1" | sed 's/'"${NODE}"'//' | sed 's/.*'"${PORT}"'//') # remove protocol and node part and port URL_PATH=$(sed 's/\/\//\//g' <<< "$URL_PATH") # we rather want // -> / + URL_PATH=${URL_PATH%%.} # strip trailing "." so that it is not interpreted as URL [[ -z "$URL_PATH" ]] && URL_PATH="/" - debugme echo $URL_PATH + debugme echo "URL_PATH: $URL_PATH" return 0 # NODE, URL_PATH, PORT is set now }