|
@ -2222,14 +2222,15 @@ _send_signed_request() { |
|
|
|
|
|
|
|
|
_CACHED_NONCE="$(echo "$responseHeaders" | grep -i "Replay-Nonce:" | _head_n 1 | tr -d "\r\n " | cut -d ':' -f 2 | cut -d , -f 1)" |
|
|
_CACHED_NONCE="$(echo "$responseHeaders" | grep -i "Replay-Nonce:" | _head_n 1 | tr -d "\r\n " | cut -d ':' -f 2 | cut -d , -f 1)" |
|
|
|
|
|
|
|
|
|
|
|
if ! _startswith "$code" "2"; then |
|
|
_body="$response" |
|
|
_body="$response" |
|
|
if [ "$needbase64" ]; then |
|
|
if [ "$needbase64" ]; then |
|
|
_body="$(echo "$_body" | _dbase64 multiline)" |
|
|
_body="$(echo "$_body" | _dbase64 multiline)" |
|
|
_debug3 _body "$_body" |
|
|
_debug3 _body "$_body" |
|
|
fi |
|
|
fi |
|
|
_retryafter=$(echo "$responseHeaders" | grep -i "^Retry-After *: *[0-9]\+ *" | cut -d : -f 2 | tr -d ' ' | tr -d '\r') |
|
|
|
|
|
|
|
|
|
|
|
if [ "$code" = '503' ] || [ "$_retryafter" ]; then |
|
|
|
|
|
|
|
|
_retryafter=$(echo "$responseHeaders" | grep -i "^Retry-After *: *[0-9]\+ *" | cut -d : -f 2 | tr -d ' ' | tr -d '\r') |
|
|
|
|
|
if [ "$code" = '503' ]; then |
|
|
_sleep_overload_retry_sec=$_retryafter |
|
|
_sleep_overload_retry_sec=$_retryafter |
|
|
if [ -z "$_sleep_overload_retry_sec" ]; then |
|
|
if [ -z "$_sleep_overload_retry_sec" ]; then |
|
|
_sleep_overload_retry_sec=5 |
|
|
_sleep_overload_retry_sec=5 |
|
@ -2240,7 +2241,6 @@ _send_signed_request() { |
|
|
continue |
|
|
continue |
|
|
else |
|
|
else |
|
|
_info "The retryafter=$_retryafter is too large > 600, not retry anymore." |
|
|
_info "The retryafter=$_retryafter is too large > 600, not retry anymore." |
|
|
return 1 |
|
|
|
|
|
fi |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
if _contains "$_body" "JWS has invalid anti-replay nonce" || _contains "$_body" "JWS has an invalid anti-replay nonce"; then |
|
|
if _contains "$_body" "JWS has invalid anti-replay nonce" || _contains "$_body" "JWS has an invalid anti-replay nonce"; then |
|
@ -2255,7 +2255,7 @@ _send_signed_request() { |
|
|
_sleep $_sleep_retry_sec |
|
|
_sleep $_sleep_retry_sec |
|
|
continue |
|
|
continue |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
fi |
|
|
return 0 |
|
|
return 0 |
|
|
done |
|
|
done |
|
|
_info "Giving up sending to CA server after $MAX_REQUEST_RETRY_TIMES retries." |
|
|
_info "Giving up sending to CA server after $MAX_REQUEST_RETRY_TIMES retries." |
|
|