-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcurl-features.sh
executable file
·52 lines (48 loc) · 1.25 KB
/
curl-features.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
#
# show curl features/protocols/etc. per tls provider
#
set -eu
set -o pipefail
declare -a curls
curls=( $(find ${cwsw}/curl*/current/bin/curl-*{ssl,tls}{,minimal} 2>/dev/null | sort ; true) )
declare -A tls tlsver feat prot
for c in ${curls[@]} ; do
v=()
b="$(basename $c)"
p="${b##curl-}"
tls["${p}"]="${c}"
readarray -t v < <(${c} --version)
for i in ${!v[@]} ; do
line="${v[${i}]}"
if [[ "${line}" =~ ^curl ]] ; then
tlsver["${p}"]="${line}"
elif [[ "${line}" =~ ^Features: ]] ; then
line="${line##Features:}"
for f in ${line} ; do
feat["${f}"]+=" ${p}"
done
elif [[ "${line}" =~ ^Protocols: ]] ; then
line="${line##Protocols:}"
for r in ${line} ; do
prot["${r}"]+=" ${p}"
done
fi
done
done
echo
echo "versions:"
for p in $(echo ${!tls[@]} | tr ' ' '\n' | sort) ; do
echo "- ${p} : ${tlsver[${p}]}"
done | tr -s ' '
echo
echo "features:"
for f in $(echo ${!feat[@]} | tr ' ' '\n' | sort) ; do
echo "- ${f} : $(echo ${feat[${f}]} | tr ' ' '\n' | sort | xargs echo)"
done | tr -s ' '
echo
echo "protocols:"
for r in $(echo ${!prot[@]} | tr ' ' '\n' | sort) ; do
echo "- ${r} : $(echo ${prot[${r}]} | tr ' ' '\n' | sort | xargs echo)"
done | tr -s ' '
echo