certificate.Store: Check '*' scope last
This commit is contained in:
parent
3c9c087a25
commit
f6bccb156a
@ -82,10 +82,6 @@ func (s *Store) Get(hostname string) (*tls.Certificate, error) {
|
|||||||
s.mu.RLock()
|
s.mu.RLock()
|
||||||
defer s.mu.RUnlock()
|
defer s.mu.RUnlock()
|
||||||
cert, ok := s.certs[hostname]
|
cert, ok := s.certs[hostname]
|
||||||
if !ok {
|
|
||||||
// Try "*"
|
|
||||||
cert, ok = s.certs["*"]
|
|
||||||
}
|
|
||||||
if !ok {
|
if !ok {
|
||||||
// Try wildcard
|
// Try wildcard
|
||||||
wildcard := strings.SplitN(hostname, ".", 2)
|
wildcard := strings.SplitN(hostname, ".", 2)
|
||||||
@ -94,6 +90,10 @@ func (s *Store) Get(hostname string) (*tls.Certificate, error) {
|
|||||||
cert, ok = s.certs[hostname]
|
cert, ok = s.certs[hostname]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !ok {
|
||||||
|
// Try "*"
|
||||||
|
cert, ok = s.certs["*"]
|
||||||
|
}
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.New("unrecognized scope")
|
return nil, errors.New("unrecognized scope")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user