Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
2aec6275
Commit
2aec6275
authored
Feb 17, 2017
by
neil
Committed by
GitHub
Feb 17, 2017
Browse files
Merge pull request #630 from Neilpang/nonce
Nonce
parents
52f8b787
b7924ce5
Changes
1
Show whitespace changes
Inline
Side-by-side
acme.sh
View file @
2aec6275
...
@@ -1530,6 +1530,10 @@ _send_signed_request() {
...
@@ -1530,6 +1530,10 @@ _send_signed_request() {
payload64
=
$(
printf
"%s"
"
$payload
"
| _base64 | _url_replace
)
payload64
=
$(
printf
"%s"
"
$payload
"
| _base64 | _url_replace
)
_debug3 payload64
"
$payload64
"
_debug3 payload64
"
$payload64
"
MAX_REQUEST_RETRY_TIMES
=
5
_request_retry_times
=
0
while
[
"
${
_request_retry_times
}
"
-lt
"
$MAX_REQUEST_RETRY_TIMES
"
]
;
do
_debug3 _request_retry_times
"
$_request_retry_times
"
if
[
-z
"
$_CACHED_NONCE
"
]
;
then
if
[
-z
"
$_CACHED_NONCE
"
]
;
then
_debug2
"Get nonce."
_debug2
"Get nonce."
nonceurl
=
"
$API
/directory"
nonceurl
=
"
$API
/directory"
...
@@ -1570,15 +1574,15 @@ _send_signed_request() {
...
@@ -1570,15 +1574,15 @@ _send_signed_request() {
response
=
"
$(
_post
"
$body
"
"
$url
"
"
$needbase64
"
)
"
response
=
"
$(
_post
"
$body
"
"
$url
"
"
$needbase64
"
)
"
_CACHED_NONCE
=
""
_CACHED_NONCE
=
""
if
[
"
$?
"
!=
"0"
]
;
then
if
[
"
$?
"
!=
"0"
]
;
then
_err
"Can not post to
$url
"
_err
"Can not post to
$url
"
return
1
return
1
fi
fi
_debug2 original
"
$response
"
_debug2 original
"
$response
"
response
=
"
$(
echo
"
$response
"
| _normalizeJson
)
"
response
=
"
$(
echo
"
$response
"
| _normalizeJson
)
"
responseHeaders
=
"
$(
cat
"
$HTTP_HEADER
"
)
"
responseHeaders
=
"
$(
<
"
$HTTP_HEADER
"
)
"
_debug2 responseHeaders
"
$responseHeaders
"
_debug2 responseHeaders
"
$responseHeaders
"
_debug2 response
"
$response
"
_debug2 response
"
$response
"
...
@@ -1587,6 +1591,15 @@ _send_signed_request() {
...
@@ -1587,6 +1591,15 @@ _send_signed_request() {
_CACHED_NONCE
=
"
$(
echo
"
$responseHeaders
"
|
grep
"Replay-Nonce:"
| _head_n 1 |
tr
-d
"
\r\n
"
|
cut
-d
':'
-f
2
)
"
_CACHED_NONCE
=
"
$(
echo
"
$responseHeaders
"
|
grep
"Replay-Nonce:"
| _head_n 1 |
tr
-d
"
\r\n
"
|
cut
-d
':'
-f
2
)
"
if
_contains
"
$response
"
"JWS has invalid anti-replay nonce"
;
then
_info
"It seems the CA server is busy now, let's wait and retry."
_request_retry_times
=
$(
_math
"
$_request_retry_times
"
+ 1
)
_sleep 5
continue
fi
break
done
}
}
#setopt "file" "opt" "=" "value" [";"]
#setopt "file" "opt" "=" "value" [";"]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment