Construct net.URL directly

This commit is contained in:
Frank Denis 2021-06-07 10:08:55 +02:00
parent 525927e797
commit dce4db4c86
1 changed files with 2 additions and 5 deletions

View File

@ -668,11 +668,8 @@ func fetchTargetConfigsFromWellKnown(proxy *Proxy, url *url.URL) ([]ODoHTargetCo
}
func fetchODoHTargetInfo(proxy *Proxy, name string, stamp stamps.ServerStamp, isNew bool) (ServerInfo, error) {
xurl, err := url.Parse("https://" + url.PathEscape(stamp.ProviderName) + "/.well-known/odohconfigs")
if err != nil {
return ServerInfo{}, err
}
odohTargetConfigs, err := fetchTargetConfigsFromWellKnown(proxy, xurl)
configUrl := &url.URL{Scheme: "https", Host: stamp.ProviderName, Path: "/.well-known/odohconfigs"}
odohTargetConfigs, err := fetchTargetConfigsFromWellKnown(proxy, configUrl)
if err != nil || len(odohTargetConfigs) == 0 {
return ServerInfo{}, fmt.Errorf("[%s] does not have an Oblivious DoH configuration", name)
}