Skip to content

Commit

Permalink
Optimize cURL version checks
Browse files Browse the repository at this point in the history
Only run cURL once to determine it's version.
  • Loading branch information
tlhackque committed Aug 4, 2021
1 parent d915167 commit 2f55c41
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions getssl
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ DNS_WAIT_RETRY_ADD="false" # Try the dns_add_command again if the DNS recor
# Private variables
_CHECK_ALL=0
_CREATE_CONFIG=0
_CURL_VERSION=""
_FORCE_RENEW=0
_KEEP_VERSIONS=""
_MUTE=0
Expand Down Expand Up @@ -2246,7 +2247,7 @@ send_signed_request() { # Sends a request to the ACME server, signed with your p

CURL="curl ${_NOMETER} "
# shellcheck disable=SC2072
if [[ ! "$($CURL -V | head -1 | cut -d' ' -f2 )" < "7.33" ]]; then
if [[ ! "${_CURL_VERSION}" < "7.33" ]]; then
CURL="$CURL --http1.1 "
fi

Expand Down Expand Up @@ -2740,8 +2741,9 @@ requires mktemp
# TODO: see where --silent can be removed (if _NOMETER defaults to --silent for old versions?)
# This would help with debugging transfer errors.

_CURL_VERSION="$(curl -V | head -1 | cut -d' ' -f2 )"
# shellcheck disable=SC2072
if [[ ! "$(curl -V | head -1 | cut -d' ' -f2 )" < "7.67" ]]; then
if [[ ! "${_CURL_VERSION}" < "7.67" ]]; then
_NOMETER="--no-progress-meter"
fi

Expand Down

0 comments on commit 2f55c41

Please sign in to comment.