Compare commits

..

No commits in common. "be42e60731e53ec0e32ee97a4fdce4df256d93e0" and "f4d8b151eca0b5a12899335607285663316f6467" have entirely different histories.

2 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package dns package dns
import ( import (
"errors"
"net" "net"
"strings" "strings"
"time" "time"
@ -58,6 +59,10 @@ func LookupRepoTXT(domain string) (string, error) {
func LookupCNAME(domain string) (string, error) { func LookupCNAME(domain string) (string, error) {
cname, found := cnameCache.Get(domain) cname, found := cnameCache.Get(domain)
if found { if found {
if cname == "" {
return "", errors.New("Previous request failure")
}
return cname.(string), nil return cname.(string), nil
} }
@ -67,5 +72,6 @@ func LookupCNAME(domain string) (string, error) {
return cname.(string), nil return cname.(string), nil
} }
cnameCache.Set(domain, "", cache.DefaultExpiration)
return "", err return "", err
} }

View File

@ -73,9 +73,9 @@ func MakeTlsConfig(pagesDomain, cachePath string, cache *certificates.Certificat
// Note: We do not check err here because err != nil // Note: We do not check err here because err != nil
// always implies that cname == "", which does not have // always implies that cname == "", which does not have
// pagesDomain as a suffix. // pagesDomain as a suffix.
cname, err := dns.LookupCNAME(info.ServerName) cname, _ = dns.LookupCNAME(info.ServerName)
if !strings.HasSuffix(cname, pagesDomain) { if !strings.HasSuffix(cname, pagesDomain) {
log.Warnf("Got ServerName for Domain %s that we're not responsible for. CNAME '%s', err: %v", info.ServerName, cname, err) log.Warnf("Got ServerName for Domain %s that we're not responsible for", info.ServerName)
return cache.FallbackCertificate.TlsCertificate, nil return cache.FallbackCertificate.TlsCertificate, nil
} }
} }