Skip to content

Commit

Permalink
Prefer API V2 when both offered in a single directory
Browse files Browse the repository at this point in the history
This doesn't happen with Let'sEncrypt, but it does with at least
one other CA.  The ACME spec allows it.
  • Loading branch information
tlhackque committed Jul 30, 2021
1 parent d2bdc92 commit 5a6f3e3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions getssl
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@
# 2021-07-22 Only pass +noidnout param to dig/drill(#682)(2.38)
# 2021-07-25 Fix copy_file_to_location failures with ssh when suffix applied to file lacking an extension (tlhackque)(#686)
# 2021-07-27 Support ftps://, FTPS_OPTIONS, remove default --insecure parameter to ftpes. Report caller(s) of error_exit in debug and test modes (tlhackque)(#687)(2.39)
# 2021-07-30 Prefer API V2 when both offered (tlhackque) (#690) (2.40)
# ----------------------------------------------------------------------------------------

case :$SHELLOPTS: in
Expand All @@ -274,7 +275,7 @@ esac

PROGNAME=${0##*/}
PROGDIR="$(cd "$(dirname "$0")" || exit; pwd -P;)"
VERSION="2.39"
VERSION="2.40"

# defaults
ACCOUNT_KEY_LENGTH=4096
Expand Down Expand Up @@ -2072,10 +2073,11 @@ obtain_ca_resource_locations()
fi
done

if [[ -n "$URL_new_reg" ]]; then
API=1
elif [[ -n "$URL_newAccount" ]]; then
# If a directory offers both versions, select V2.
if [[ -n "$URL_newAccount" ]]; then
API=2
elif [[ -n "$URL_new_reg" ]]; then
API=1
else
error_exit "unknown API version"
fi
Expand Down

0 comments on commit 5a6f3e3

Please sign in to comment.