@@ -2052,6 +2052,7 @@ check_revocation_ocsp() {
20522052 local host_header=""
20532053 local openssl_bin="$OPENSSL"
20542054 local addtl_warning=""
2055+ local smartswitch=false
20552056
20562057 "$PHONE_OUT" || [[ -n "$stapled_response" ]] || return 0
20572058 [[ -n "$GOOD_CA_BUNDLE" ]] || return 0
@@ -2087,26 +2088,34 @@ check_revocation_ocsp() {
20872088 # See #2516 and probably also #2667 and #1275 .
20882089 if [[ -x "$OPENSSL2" ]]; then
20892090 openssl_bin="$OPENSSL2"
2091+ smartswitch=true
20902092 [[ $DEBUG -ge 3 ]] && echo "Switching to $openssl_bin "
20912093 fi
20922094 else
20932095 addtl_warning="(a segfault indicates here you need to test this with another binary)"
20942096 fi
20952097 host_header=${uri##http://}
20962098 host_header=${host_header%%/*}
2097- if [[ "$OSSL_NAME" =~ LibreSSL ]]; then
2098- host_header="-header Host ${host_header}"
2099- elif [[ $OSSL_VER_MAJOR.$OSSL_VER_MINOR == 1.1.0* ]] || [[ $OSSL_VER_MAJOR.$OSSL_VER_MINOR == 1.1.1* ]] || \
2100- [[ $OSSL_VER_MAJOR -ge 3 ]]; then
2101- host_header="-header Host=${host_header}"
2099+
2100+ # This the follwomg is the default (like "-header Host r11.o.lencr.org")
2101+ host_header="-header Host ${host_header}"
2102+
2103+ if "$smartswitch" ; then
2104+ case $(openssl version -v | awk -F' ' '{ print $2 }') in
2105+ # for those versions it's "-header Host=r11.o.lencr.org"
2106+ 3.*|1.1*) host_header=${host_header/Host /Host=} ;;
2107+ esac
21022108 else
2103- host_header="-header Host ${host_header}"
2109+ case $OSSL_VER_MAJOR.$OSSL_VER_MINOR in
2110+ 3.*|1.1*) host_header=${host_header/Host /Host=} ;;
2111+ esac
21042112 fi
21052113 $openssl_bin ocsp -no_nonce ${host_header} -url "$uri" \
21062114 -issuer $TEMPDIR/hostcert_issuer.pem -verify_other $TEMPDIR/intermediatecerts.pem \
21072115 -CAfile <(cat $ADDTL_CA_FILES "$GOOD_CA_BUNDLE") -cert $HOSTCERT -text &> "$tmpfile"
21082116 success=$?
21092117 fi
2118+
21102119 if [[ $success -eq 0 ]] && grep -Fq "Response verify OK" "$tmpfile"; then
21112120 response="$(grep -F "$HOSTCERT: " "$tmpfile")"
21122121 response="${response#$HOSTCERT: }"
0 commit comments