From f6bccb156afa370afe938bea7752e70c65947535 Mon Sep 17 00:00:00 2001 From: Adnan Maolood Date: Tue, 23 Feb 2021 08:52:12 -0500 Subject: [PATCH] certificate.Store: Check '*' scope last --- certificate/store.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/certificate/store.go b/certificate/store.go index 375068b..4e9dced 100644 --- a/certificate/store.go +++ b/certificate/store.go @@ -82,10 +82,6 @@ func (s *Store) Get(hostname string) (*tls.Certificate, error) { s.mu.RLock() defer s.mu.RUnlock() cert, ok := s.certs[hostname] - if !ok { - // Try "*" - cert, ok = s.certs["*"] - } if !ok { // Try wildcard wildcard := strings.SplitN(hostname, ".", 2) @@ -94,6 +90,10 @@ func (s *Store) Get(hostname string) (*tls.Certificate, error) { cert, ok = s.certs[hostname] } } + if !ok { + // Try "*" + cert, ok = s.certs["*"] + } if !ok { return nil, errors.New("unrecognized scope") }