fix: Handle CNAMEs with a trailing dot
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
be42e60731
commit
2fb1e36b06
@ -61,10 +61,13 @@ func LookupCNAME(domain string) (string, error) {
|
|||||||
return cname.(string), nil
|
return cname.(string), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
cname, err := net.LookupCNAME(domain)
|
query, err := net.LookupCNAME(domain)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
cnameCache.Set(domain, cname, cache.DefaultExpiration)
|
if query[len(query)-1] == '.' {
|
||||||
return cname.(string), nil
|
query = query[:len(query)-1]
|
||||||
|
}
|
||||||
|
cnameCache.Set(domain, query, cache.DefaultExpiration)
|
||||||
|
return query, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return "", err
|
return "", err
|
||||||
|
Loading…
Reference in New Issue
Block a user