Initial support for --donotredirect

This commit is contained in:
Lutchy Horace 2021-03-17 17:47:19 -04:00
parent 185d813c0e
commit 2a08de6115
2 changed files with 63 additions and 17 deletions

View file

@ -26,13 +26,18 @@ function warn
function validate_host
{
local _ret=0
echo "$1" | grep -P '^(http|https):\/\/(([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])(:[0-9]+)?$' > /dev/null 2>&1
if [ $? -eq 0 ]; then
debug "Checking host is resolvable: $1"
# The remote servers may sometimes have self-signed certs
curl --insecure $1 > /dev/null 2>&1
# Add --insecure becase remote servers may sometimes have self-signed certs
if ! curl --insecure $1 > /dev/null 2>&1; then
_ret=1
debug "Host '$1' is not resolvable!"
fi
fi
return $?
return $_ret
}
function validate_ip