mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-04-30 07:22:44 +00:00
Check return status of curl and report error
This is really handy if you run without DEBUG mode and curl has a problem (like out of date SSL certs)
This commit is contained in:
parent
20a937e443
commit
4880297e5c
12
acme.sh
12
acme.sh
@ -491,8 +491,14 @@ _post() {
|
|||||||
CURL="$CURL --dump-header $HTTP_HEADER "
|
CURL="$CURL --dump-header $HTTP_HEADER "
|
||||||
if [ "$needbase64" ] ; then
|
if [ "$needbase64" ] ; then
|
||||||
response="$($CURL -A "User-Agent: $USER_AGENT" -X POST --data "$body" $url | _base64)"
|
response="$($CURL -A "User-Agent: $USER_AGENT" -X POST --data "$body" $url | _base64)"
|
||||||
|
if [[ $? -gt 0 ]] ;then
|
||||||
|
_err "Curl failed with exit code $?, trying running script in DEBUG=1 mode"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
response="$($CURL -A "User-Agent: $USER_AGENT" -X POST --data "$body" $url)"
|
response="$($CURL -A "User-Agent: $USER_AGENT" -X POST --data "$body" $url)"
|
||||||
|
if [[ $? -gt 0 ]] ;then
|
||||||
|
_err "Curl failed with exit code $?, trying running script in DEBUG=1 mode"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "$needbase64" ] ; then
|
if [ "$needbase64" ] ; then
|
||||||
@ -514,8 +520,14 @@ _get() {
|
|||||||
if _exists "curl" ; then
|
if _exists "curl" ; then
|
||||||
if [ "$onlyheader" ] ; then
|
if [ "$onlyheader" ] ; then
|
||||||
$CURL -I -A "User-Agent: $USER_AGENT" $url
|
$CURL -I -A "User-Agent: $USER_AGENT" $url
|
||||||
|
if [[ $? -gt 0 ]] ;then
|
||||||
|
_err "Curl failed with exit code $?, trying running script in DEBUG=1 mode"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
$CURL -A "User-Agent: $USER_AGENT" $url
|
$CURL -A "User-Agent: $USER_AGENT" $url
|
||||||
|
if [[ $? -gt 0 ]] ;then
|
||||||
|
_err "Curl failed with exit code $?, trying running script in DEBUG=1 mode"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
_debug "WGET" "$WGET"
|
_debug "WGET" "$WGET"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user