From a272ee4f59bc19cf5d5bd3449bb79bc09106c297 Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 31 May 2016 20:16:57 +0800 Subject: [PATCH] fix get nonce --- acme.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/acme.sh b/acme.sh index 80156362..c3d9d76f 100755 --- a/acme.sh +++ b/acme.sh @@ -657,11 +657,17 @@ _send_signed_request() { _debug2 payload64 $payload64 nonceurl="$API/directory" - nonce="$(_get $nonceurl "onlyheader" | grep -o "Replay-Nonce:.*$" | head -1 | tr -d "\r\n" | cut -d ' ' -f 2)" + _headers="$(_get $nonceurl "onlyheader")" + if [ "$?" != "0" ] ; then _err "Can not connect to $nonceurl to get nonce." return 1 fi + + _debug2 _headers "$_headers" + + nonce="$( echo "$_headers" | grep "Replay-Nonce:" | head -1 | tr -d "\r\n " | cut -d ':' -f 2)" + _debug nonce "$nonce" protected="$(printf "$HEADERPLACE" | sed "s/NONCE/$nonce/" )"