Skip to content

Commit 2f55c41

Browse files
committed
Optimize cURL version checks
Only run cURL once to determine it's version.
1 parent d915167 commit 2f55c41

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

getssl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ DNS_WAIT_RETRY_ADD="false" # Try the dns_add_command again if the DNS recor
336336
# Private variables
337337
_CHECK_ALL=0
338338
_CREATE_CONFIG=0
339+
_CURL_VERSION=""
339340
_FORCE_RENEW=0
340341
_KEEP_VERSIONS=""
341342
_MUTE=0
@@ -2246,7 +2247,7 @@ send_signed_request() { # Sends a request to the ACME server, signed with your p
22462247

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

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

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

0 commit comments

Comments
 (0)