Skip to content

Commit b7a575b

Browse files
authored
Merge pull request #6582 from Roy-Orbison/request-ip-family
Choose an IP address family for outgoing requests
2 parents 9a994e7 + 48c48cb commit b7a575b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

acme.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,6 +1897,11 @@ _inithttp() {
18971897

18981898
if [ -z "$_ACME_CURL" ] && _exists "curl"; then
18991899
_ACME_CURL="curl --silent --dump-header $HTTP_HEADER "
1900+
if [ "$ACME_USE_IPV6_REQUESTS" ]; then
1901+
_ACME_CURL="$_ACME_CURL --ipv6 "
1902+
elif [ "$ACME_USE_IPV4_REQUESTS" ]; then
1903+
_ACME_CURL="$_ACME_CURL --ipv4 "
1904+
fi
19001905
if [ -z "$ACME_HTTP_NO_REDIRECTS" ]; then
19011906
_ACME_CURL="$_ACME_CURL -L "
19021907
fi
@@ -1924,6 +1929,11 @@ _inithttp() {
19241929

19251930
if [ -z "$_ACME_WGET" ] && _exists "wget"; then
19261931
_ACME_WGET="wget -q"
1932+
if [ "$ACME_USE_IPV6_REQUESTS" ]; then
1933+
_ACME_WGET="$_ACME_WGET --inet6-only "
1934+
elif [ "$ACME_USE_IPV4_REQUESTS" ]; then
1935+
_ACME_WGET="$_ACME_WGET --inet4-only "
1936+
fi
19271937
if [ "$ACME_HTTP_NO_REDIRECTS" ]; then
19281938
_ACME_WGET="$_ACME_WGET --max-redirect 0 "
19291939
fi
@@ -7076,6 +7086,8 @@ Parameters:
70767086
--alpn Use standalone alpn mode.
70777087
--stateless Use stateless mode.
70787088
See: $_STATELESS_WIKI
7089+
--request-v4 Force client requests to use ipv4.
7090+
--request-v6 Force client requests to use ipv6.
70797091
70807092
--apache Use Apache mode.
70817093
--dns [dns_hook] Use dns manual mode or dns api. Defaults to manual mode when argument is omitted.
@@ -7255,6 +7267,20 @@ _processAccountConf() {
72557267
_saveaccountconf "ACME_USE_WGET" "$ACME_USE_WGET"
72567268
fi
72577269

7270+
if [ "$_request_v6" ]; then
7271+
_saveaccountconf "ACME_USE_IPV6_REQUESTS" "$_request_v6"
7272+
_clearaccountconf "ACME_USE_IPV4_REQUESTS"
7273+
elif [ "$ACME_USE_IPV6_REQUESTS" ]; then
7274+
_saveaccountconf "ACME_USE_IPV6_REQUESTS" "$ACME_USE_IPV6_REQUESTS"
7275+
_clearaccountconf "ACME_USE_IPV4_REQUESTS"
7276+
elif [ "$_request_v4" ]; then
7277+
_saveaccountconf "ACME_USE_IPV4_REQUESTS" "$_request_v4"
7278+
_clearaccountconf "ACME_USE_IPV6_REQUESTS"
7279+
elif [ "$ACME_USE_IPV4_REQUESTS" ]; then
7280+
_saveaccountconf "ACME_USE_IPV4_REQUESTS" "$ACME_USE_IPV4_REQUESTS"
7281+
_clearaccountconf "ACME_USE_IPV6_REQUESTS"
7282+
fi
7283+
72587284
}
72597285

72607286
_checkSudo() {
@@ -7420,6 +7446,8 @@ _process() {
74207446
_local_address=""
74217447
_log_level=""
74227448
_auto_upgrade=""
7449+
_request_v4=""
7450+
_request_v6=""
74237451
_listen_v4=""
74247452
_listen_v6=""
74257453
_openssl_bin=""
@@ -7885,6 +7913,18 @@ _process() {
78857913
fi
78867914
AUTO_UPGRADE="$_auto_upgrade"
78877915
;;
7916+
--request-v4)
7917+
_request_v4="1"
7918+
ACME_USE_IPV4_REQUESTS="1"
7919+
_request_v6=""
7920+
ACME_USE_IPV6_REQUESTS=""
7921+
;;
7922+
--request-v6)
7923+
_request_v6="1"
7924+
ACME_USE_IPV6_REQUESTS="1"
7925+
_request_v4=""
7926+
ACME_USE_IPV4_REQUESTS=""
7927+
;;
78887928
--listen-v4)
78897929
_listen_v4="1"
78907930
Le_Listen_V4="$_listen_v4"

0 commit comments

Comments
 (0)