Fixing #8 with base64 encoding of email:password for noip

This commit is contained in:
Quentin McGaw
2019-05-23 15:45:20 +02:00
parent b4e47ecc6c
commit 1f3e6cb141
2 changed files with 4 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
package update
import (
"encoding/base64"
"encoding/json"
"encoding/xml"
"fmt"
@@ -423,7 +424,8 @@ func updateNoIP(httpClient *http.Client, hostname, email, password, ip string) (
if err != nil {
return "", err
}
r.Header.Set("Authorization", "Basic "+email+":"+password)
credsEncoded := base64.StdEncoding.EncodeToString([]byte(email + ":" + password))
r.Header.Set("Authorization", "Basic "+credsEncoded)
r.Header.Set("User-Agent", "DDNS-Updater quentin.mcgaw@gmail.com")
status, content, err := network.DoHTTPRequest(httpClient, r)
if err != nil {