fix wget support in dns api

This commit is contained in:
neil
2016-05-07 23:33:42 +08:00
parent 94dc5f330c
commit a4270efac9
4 changed files with 49 additions and 34 deletions

View File

@@ -183,11 +183,16 @@ _rest() {
_debug sec "$sec"
hmac=$(printf "$sec"| openssl md5 |cut -d " " -f 2)
_debug hmac "$hmac"
if [ "$3" ] ; then
response="$(curl --silent -X $m "$url" -H "API-KEY: $CX_Key" -H "API-REQUEST-DATE: $cdate" -H "API-HMAC: $hmac" -H 'Content-Type: application/json' -d "$data")"
_H1="API-KEY: $CX_Key"
_H2="API-REQUEST-DATE: $cdate"
_H3="API-HMAC: $hmac"
_H4="Content-Type: application/json"
if [ "$data" ] ; then
response="$(_post "$data" "$url" "" $m)"
else
response="$(curl --silent -X $m "$url" -H "API-KEY: $CX_Key" -H "API-REQUEST-DATE: $cdate" -H "API-HMAC: $hmac" -H 'Content-Type: application/json')"
response="$(_get "$url")"
fi
if [ "$?" != "0" ] ; then