Browse Source

Remove custom URL encoding and use library's implementation.

Armando Lüscher 8 years ago
parent
commit
9499a1142b
1 changed files with 4 additions and 9 deletions
  1. 4 9
      dnsapi/dns_cyon.sh

+ 4 - 9
dnsapi/dns_cyon.sh

@@ -79,11 +79,6 @@ _cyon_is_idn() {
   [ "$_idn_temp" ] || [ "$_idn_temp2" ]
   [ "$_idn_temp" ] || [ "$_idn_temp2" ]
 }
 }
 
 
-# comment on https://stackoverflow.com/a/10797966
-_cyon_urlencode() {
-  curl -Gso /dev/null -w "%{url_effective}" --data-urlencode @- "" | cut -c 3-
-}
-
 _cyon_load_parameters() {
 _cyon_load_parameters() {
   # Read the required parameters to add the TXT entry.
   # Read the required parameters to add the TXT entry.
   fulldomain="$(printf "%s" "${1}" | tr '[A-Z]' '[a-z]')"
   fulldomain="$(printf "%s" "${1}" | tr '[A-Z]' '[a-z]')"
@@ -140,8 +135,8 @@ _cyon_get_cookie_header() {
 _cyon_login() {
 _cyon_login() {
   _info "  - Logging in..."
   _info "  - Logging in..."
 
 
-  username_encoded="$(printf "%s" "${CY_Username}" | _cyon_urlencode)"
-  password_encoded="$(printf "%s" "${CY_Password}" | _cyon_urlencode)"
+  username_encoded="$(printf "%s" "${CY_Username}" | _url_encode)"
+  password_encoded="$(printf "%s" "${CY_Password}" | _url_encode)"
 
 
   login_url="https://my.cyon.ch/auth/index/dologin-async"
   login_url="https://my.cyon.ch/auth/index/dologin-async"
   login_data="$(printf "%s" "username=${username_encoded}&password=${password_encoded}&pathname=%2F")"
   login_data="$(printf "%s" "username=${username_encoded}&password=${password_encoded}&pathname=%2F")"
@@ -278,8 +273,8 @@ _cyon_delete_txt() {
       continue
       continue
     fi
     fi
 
 
-    hash_encoded="$(printf "%s" "${_hash}" | _cyon_urlencode)"
-    identifier_encoded="$(printf "%s" "${_identifier}" | _cyon_urlencode)"
+    hash_encoded="$(printf "%s" "${_hash}" | _url_encode)"
+    identifier_encoded="$(printf "%s" "${_identifier}" | _url_encode)"
 
 
     delete_txt_url="https://my.cyon.ch/domain/dnseditor/delete-record-async"
     delete_txt_url="https://my.cyon.ch/domain/dnseditor/delete-record-async"
     delete_txt_data="$(printf "%s" "hash=${hash_encoded}&identifier=${identifier_encoded}")"
     delete_txt_data="$(printf "%s" "hash=${hash_encoded}&identifier=${identifier_encoded}")"