Use url.UserPassword() so passwords are escaped

This commit is contained in:
Andy Cobaugh 2019-11-13 13:49:14 -05:00
parent 2109ac9455
commit 0360003e09
1 changed files with 2 additions and 1 deletions

View File

@ -110,7 +110,8 @@ func (vcenter *VCenter) Connect() error {
defer cancel()
stdlog.Println("Connecting to vcenter:", vcenter.Hostname)
u, err := url.Parse("https://" + vcenter.Username + ":" + vcenter.Password + "@" + vcenter.Hostname + "/sdk")
u, err := url.Parse("https://" + vcenter.Hostname + "/sdk")
u.User = url.UserPassword(vcenter.Username, vcenter.Password)
if err != nil {
errlog.Println("Could not parse vcenter url:", vcenter.Hostname)
errlog.Println("Error:", err)