check return code

This commit is contained in:
neil 2016-05-31 20:32:58 +08:00
parent a272ee4f59
commit c4d8fd83d4

21
acme.sh
View File

@ -1242,7 +1242,13 @@ issue() {
vtype="$VTYPE_DNS"
fi
_info "Getting token for domain" $d
_send_signed_request "$API/acme/new-authz" "{\"resource\": \"new-authz\", \"identifier\": {\"type\": \"dns\", \"value\": \"$d\"}}"
if ! _send_signed_request "$API/acme/new-authz" "{\"resource\": \"new-authz\", \"identifier\": {\"type\": \"dns\", \"value\": \"$d\"}}" ; then
_err "Can not get domain token."
_clearup
return 1
fi
if [ ! -z "$code" ] && [ ! "$code" = '201' ] ; then
_err "new-authz error: $response"
_clearup
@ -1419,7 +1425,12 @@ issue() {
fi
fi
_send_signed_request $uri "{\"resource\": \"challenge\", \"keyAuthorization\": \"$keyauthorization\"}"
if ! _send_signed_request $uri "{\"resource\": \"challenge\", \"keyAuthorization\": \"$keyauthorization\"}" ; then
_err "$d:Can not get challenge: $response"
_clearupwebbroot "$_currentRoot" "$removelevel" "$token"
_clearup
return 1
fi
if [ ! -z "$code" ] && [ ! "$code" = '202' ] ; then
_err "$d:Challenge error: $response"
@ -1494,7 +1505,11 @@ issue() {
_clearup
_info "Verify finished, start to sign."
der="$(_getfile "${CSR_PATH}" "${BEGIN_CSR}" "${END_CSR}" | tr -d "\r\n" | _urlencode)"
_send_signed_request "$API/acme/new-cert" "{\"resource\": \"new-cert\", \"csr\": \"$der\"}" "needbase64"
if ! _send_signed_request "$API/acme/new-cert" "{\"resource\": \"new-cert\", \"csr\": \"$der\"}" "needbase64" ; then
_err "Sign failed."
return 1
fi
Le_LinkCert="$(grep -i -o '^Location.*$' $HTTP_HEADER | head -1 | tr -d "\r\n" | cut -d " " -f 2)"