FIX #1009 and leftover fix for #988

In cases where HTTP/2 was the only ALPN protocol, the
JSON output was missing the finding as the additional
protocol was empty.

This fix tests whether there's an additional protcol
and only calls fileout() if there's one.
This commit is contained in:
Dirk 2018-03-17 20:37:00 +01:00
parent 4eb6ab5976
commit c91a771465

View File

@ -8104,7 +8104,7 @@ run_alpn() {
else
out ", "
fi
# only h2 is what browser need to use HTTP/2.0 and brings a security benefit
# only h2 is what browser need to use HTTP/2.0 and brings a security,privacy and performance benefit
if [[ "$proto" == "h2" ]]; then
pr_svrty_good "$proto"
fileout "${jsonID}_HTTP2" "OK" "$proto"
@ -8116,7 +8116,8 @@ run_alpn() {
done
if $has_alpn_proto; then
outln " (offered)"
fileout "$jsonID" "INFO" "$alpn_finding"
# if h2 is not the only protocol:
[[ -n "$alpn_finding" ]] && fileout "$jsonID" "INFO" "$alpn_finding"
else
outln "not offered"
fileout "$jsonID" "INFO" "not offered"