Browse Source

added additional checks and retry on 500 error from ACME server

pull/117/head
srvrco 9 years ago
parent
commit
d8fca69d5f
1 changed files with 12 additions and 5 deletions
  1. +12
    -5
      getssl

+ 12
- 5
getssl View File

@ -107,11 +107,12 @@
# 2016-09-19 remove update check on recursive calls when using -a (1.41)
# 2016-09-21 changed shebang for portability (1.42)
# 2016-09-21 Included option to Deactivate an Authorization (1.43)
# 2016-09-21 retry on 500 error from ACME server (1.44)
# 2016-09-22 retry on 500 error from ACME server (1.44)
# 2016-09-22 added additional checks and retry on 500 error from ACME server (1.45)
# ---------------------------------------------------------------------------
PROGNAME=${0##*/}
VERSION="1.44"
VERSION="1.45"
# defaults
CODE_LOCATION="https://raw.githubusercontent.com/srvrco/getssl/master/getssl"
@ -505,7 +506,8 @@ send_signed_request() { # Sends a request to the ACME server, signed with your p
body='{"header": '"${header}"', "protected": "'"${protected64}"'", "payload": "'"${payload64}"'", "signature": "'"${signed64}"'"}'
debug "data for account registration = $body"
code=500
code="500"
loop_limit=5
while [ $code -eq 500 ]; do
if [ "$needbase64" ] ; then
response=$($CURL -X POST --data "$body" "$url" | urlbase64)
@ -519,8 +521,13 @@ send_signed_request() { # Sends a request to the ACME server, signed with your p
code=$(os_grep ^HTTP "$CURL_HEADER" | tail -1 | cut -d " " -f 2)
debug code "$code"
response_status=$(echo "$response"| os_grep status | head -1 | awk -F'"' '{print $4}')
if [ $code -eq 500 ]; then
info "error on acme server - trying again"
if [ "$code" -eq 500 ]; then
info "error on acme server - trying again ...."
sleep 2
loop_limit=$((loop_limit - 1))
if [ $loop_limit -lt 1 ]; then
error_exit "500 error from ACME server: $response"
fi
fi
done
}


Loading…
Cancel
Save