BIN: analyse-headers: read from stdin if first arg is -

This makes testing much easier
This commit is contained in:
Jonathan Hodgson 2020-12-09 16:24:59 +00:00
parent 039f4e2270
commit 27b9af6327

View file

@ -403,7 +403,13 @@ args+=("$@")
url="${args[0]}"
[ -z "$url" ] && die "You need to specify a url"
headers="$(curl -s -I "$url")"
# If url is -, read headers from stdin
if [ "$url" = "-" ]; then
headers="$(cat -)"
else
headers="$(curl -s -I "$url")"
fi
missingHeaders="x-frame-options
content-security-policy
x-xss-protection