aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdnan Maolood <[email protected]>2021-02-23 08:52:12 -0500
committerAdnan Maolood <[email protected]>2021-02-23 08:52:12 -0500
commitf6bccb156afa370afe938bea7752e70c65947535 (patch)
tree679e8d705801c2a4c0272e80b1a43284527e6b11
parentcertificate.Store: Allow certificate of scope '*' (diff)
downloadgo-gemini-f6bccb156afa370afe938bea7752e70c65947535.tar.xz
go-gemini-f6bccb156afa370afe938bea7752e70c65947535.zip
certificate.Store: Check '*' scope last
-rw-r--r--certificate/store.go8
1 files 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
@@ -83,10 +83,6 @@ func (s *Store) Get(hostname string) (*tls.Certificate, error) {
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)
if len(wildcard) == 2 {
@@ -95,6 +91,10 @@ func (s *Store) Get(hostname string) (*tls.Certificate, error) {
}
}
if !ok {
+ // Try "*"
+ cert, ok = s.certs["*"]
+ }
+ if !ok {
return nil, errors.New("unrecognized scope")
}