mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-26 15:02:03 +00:00
add err check for post and get
This commit is contained in:
parent
16679b572f
commit
7012b91f05
12
acme.sh
12
acme.sh
@ -658,7 +658,10 @@ _send_signed_request() {
|
|||||||
|
|
||||||
nonceurl="$API/directory"
|
nonceurl="$API/directory"
|
||||||
nonce="$(_get $nonceurl "onlyheader" | grep -o "Replay-Nonce:.*$" | head -1 | tr -d "\r\n" | cut -d ' ' -f 2)"
|
nonce="$(_get $nonceurl "onlyheader" | grep -o "Replay-Nonce:.*$" | head -1 | tr -d "\r\n" | cut -d ' ' -f 2)"
|
||||||
|
if [ "$?" != "0" ] ; then
|
||||||
|
_err "Can not connect to $nonceurl to get nonce."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
_debug nonce "$nonce"
|
_debug nonce "$nonce"
|
||||||
|
|
||||||
protected="$(printf "$HEADERPLACE" | sed "s/NONCE/$nonce/" )"
|
protected="$(printf "$HEADERPLACE" | sed "s/NONCE/$nonce/" )"
|
||||||
@ -675,7 +678,10 @@ _send_signed_request() {
|
|||||||
|
|
||||||
|
|
||||||
response="$(_post "$body" $url "$needbase64")"
|
response="$(_post "$body" $url "$needbase64")"
|
||||||
|
if [ "$?" != "0" ] ; then
|
||||||
|
_err "Can not post to $url."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
_debug2 original "$response"
|
_debug2 original "$response"
|
||||||
|
|
||||||
response="$( echo "$response" | _normalizeJson )"
|
response="$( echo "$response" | _normalizeJson )"
|
||||||
@ -1434,13 +1440,13 @@ issue() {
|
|||||||
sleep 5
|
sleep 5
|
||||||
_debug "checking"
|
_debug "checking"
|
||||||
response="$(_get $uri | _normalizeJson )"
|
response="$(_get $uri | _normalizeJson )"
|
||||||
_debug2 response "$response"
|
|
||||||
if [ "$?" != "0" ] ; then
|
if [ "$?" != "0" ] ; then
|
||||||
_err "$d:Verify error:$response"
|
_err "$d:Verify error:$response"
|
||||||
_clearupwebbroot "$_currentRoot" "$removelevel" "$token"
|
_clearupwebbroot "$_currentRoot" "$removelevel" "$token"
|
||||||
_clearup
|
_clearup
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
_debug2 response "$response"
|
||||||
|
|
||||||
status=$(echo $response | egrep -o '"status":"[^"]*' | cut -d : -f 2 | tr -d '"')
|
status=$(echo $response | egrep -o '"status":"[^"]*' | cut -d : -f 2 | tr -d '"')
|
||||||
if [ "$status" = "valid" ] ; then
|
if [ "$status" = "valid" ] ; then
|
||||||
|
Loading…
Reference in New Issue
Block a user