aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.functions10
1 files changed, 5 insertions, 5 deletions
diff --git a/.functions b/.functions
index d3ae860..f440be4 100644
--- a/.functions
+++ b/.functions
@@ -82,7 +82,7 @@ function gz() {
# Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL.
# Send a fake UA string for sites that sniff it instead of using the Accept-Encoding header. (Looking at you, ajax.googleapis.com!)
function httpcompression() {
- encoding="$(curl -LIs -H 'User-Agent: Mozilla/5 Gecko' -H 'Accept-Encoding: gzip,deflate,compress,sdch' "$1" | grep '^Content-Encoding:')" && echo "$1 is encoded using ${encoding#* }" || echo "$1 is not using any encoding"
+ local encoding="$(curl -LIs -H 'User-Agent: Mozilla/5 Gecko' -H 'Accept-Encoding: gzip,deflate,compress,sdch' "$1" | grep '^Content-Encoding:')" && echo "$1 is encoded using ${encoding#* }" || echo "$1 is not using any encoding"
}
# Syntax-highlight JSON strings or files
@@ -126,15 +126,15 @@ function getcertnames() {
return 1
fi
- domain="${1}"
+ local domain="${1}"
echo "Testing ${domain}…"
echo # newline
- tmp=$(echo -e "GET / HTTP/1.0\nEOT" \
+ local tmp=$(echo -e "GET / HTTP/1.0\nEOT" \
| openssl s_client -connect "${domain}:443" 2>&1);
if [[ "${tmp}" = *"-----BEGIN CERTIFICATE-----"* ]]; then
- certText=$(echo "${tmp}" \
+ local certText=$(echo "${tmp}" \
| openssl x509 -text -certopt "no_header, no_serial, no_version, \
no_signame, no_validity, no_issuer, no_pubkey, no_sigdump, no_aux");
echo "Common Name:"
@@ -144,7 +144,7 @@ function getcertnames() {
echo "Subject Alternative Name(s):"
echo # newline
echo "${certText}" | grep -A 1 "Subject Alternative Name:" \
- | head -2 | tail -1 | sed "s/DNS://g" | sed "s/ //g" | tr "," "\n"
+ | sed -e "2s/DNS://g" -e "s/ //g" | tr "," "\n" | tail -n +2
return 0
else
echo "ERROR: Certificate not found.";