neilpang 7 years ago
parent
commit
45e386b26d
  1. 14
      acme.sh

14
acme.sh

@ -63,6 +63,7 @@ END_CSR="-----END CERTIFICATE REQUEST-----"
BEGIN_CERT="-----BEGIN CERTIFICATE-----" BEGIN_CERT="-----BEGIN CERTIFICATE-----"
END_CERT="-----END CERTIFICATE-----" END_CERT="-----END CERTIFICATE-----"
CONTENT_TYPE_JSON="application/jose+json"
RENEW_SKIP=2 RENEW_SKIP=2
ECC_SEP="_" ECC_SEP="_"
@ -1591,12 +1592,13 @@ _inithttp() {
} }
# body url [needbase64] [POST|PUT]
# body url [needbase64] [POST|PUT] [ContentType]
_post() { _post() {
body="$1" body="$1"
_post_url="$2" _post_url="$2"
needbase64="$3" needbase64="$3"
httpmethod="$4" httpmethod="$4"
_postContentType="$5"
if [ -z "$httpmethod" ]; then if [ -z "$httpmethod" ]; then
httpmethod="POST" httpmethod="POST"
@ -1612,6 +1614,9 @@ _post() {
if [ "$HTTPS_INSECURE" ]; then if [ "$HTTPS_INSECURE" ]; then
_CURL="$_CURL --insecure " _CURL="$_CURL --insecure "
fi fi
if [ "$_postContentType" ]; then
_CURL="$_CURL -H \"Content-Type: $_postContentType\" "
fi
_debug "_CURL" "$_CURL" _debug "_CURL" "$_CURL"
if [ "$needbase64" ]; then if [ "$needbase64" ]; then
response="$($_CURL --user-agent "$USER_AGENT" -X $httpmethod -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" --data "$body" "$_post_url" | _base64)" response="$($_CURL --user-agent "$USER_AGENT" -X $httpmethod -H "$_H1" -H "$_H2" -H "$_H3" -H "$_H4" -H "$_H5" --data "$body" "$_post_url" | _base64)"
@ -1631,6 +1636,9 @@ _post() {
if [ "$HTTPS_INSECURE" ]; then if [ "$HTTPS_INSECURE" ]; then
_WGET="$_WGET --no-check-certificate " _WGET="$_WGET --no-check-certificate "
fi fi
if [ "$_postContentType" ]; then
_WGET="$_WGET --header \"Content-Type: $_postContentType\" "
fi
_debug "_WGET" "$_WGET" _debug "_WGET" "$_WGET"
if [ "$needbase64" ]; then if [ "$needbase64" ]; then
if [ "$httpmethod" = "POST" ]; then if [ "$httpmethod" = "POST" ]; then
@ -1765,7 +1773,7 @@ _send_signed_request() {
if [ "$ACME_NEW_NONCE" ]; then if [ "$ACME_NEW_NONCE" ]; then
_debug2 "Get nonce. ACME_NEW_NONCE" "$ACME_NEW_NONCE" _debug2 "Get nonce. ACME_NEW_NONCE" "$ACME_NEW_NONCE"
nonceurl="$ACME_NEW_NONCE" nonceurl="$ACME_NEW_NONCE"
if _post "" "$nonceurl" "" "HEAD"; then
if _post "" "$nonceurl" "" "HEAD" "$CONTENT_TYPE_JSON"; then
_headers="$(cat "$HTTP_HEADER")" _headers="$(cat "$HTTP_HEADER")"
fi fi
fi fi
@ -1820,7 +1828,7 @@ _send_signed_request() {
fi fi
_debug3 body "$body" _debug3 body "$body"
response="$(_post "$body" "$url" "$needbase64")"
response="$(_post "$body" "$url" "$needbase64" "POST" "$CONTENT_TYPE_JSON")"
_CACHED_NONCE="" _CACHED_NONCE=""
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then

Loading…
Cancel
Save