Skip to content

Commit f66f74b

Browse files
rolandshoemakergopherbot
authored andcommitted
acme/autocert: check host policy before probing the cache
Avoid unnessecary cache probes for names that don't match the host policy. Fixes golang/go#71199 Change-Id: I11e8465b0416e960a549b0c0d74a622026c39931 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/651296 Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Gopher Robot <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]>
1 parent b0784b7 commit f66f74b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

acme/autocert/autocert.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,10 @@ func (m *Manager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate,
292292
}
293293

294294
// regular domain
295+
if err := m.hostPolicy()(ctx, name); err != nil {
296+
return nil, err
297+
}
298+
295299
ck := certKey{
296300
domain: strings.TrimSuffix(name, "."), // golang.org/issue/18114
297301
isRSA: !supportsECDSA(hello),
@@ -305,9 +309,6 @@ func (m *Manager) GetCertificate(hello *tls.ClientHelloInfo) (*tls.Certificate,
305309
}
306310

307311
// first-time
308-
if err := m.hostPolicy()(ctx, name); err != nil {
309-
return nil, err
310-
}
311312
cert, err = m.createCert(ctx, ck)
312313
if err != nil {
313314
return nil, err

0 commit comments

Comments
 (0)