Updates based on code review

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
Ivan Kozlovic
2021-07-28 12:40:48 -06:00
parent 67b9bba32d
commit aaaf28a436
2 changed files with 3 additions and 1 deletions

View File

@@ -334,6 +334,8 @@ func (srv *Server) NewOCSPMonitor(config *tlsConfigKind) (*tls.Config, *OCSPMoni
// NOTE: Currently OCSP Stapling is enabled only for the first certificate found.
var mon *OCSPMonitor
for _, cert := range tc.Certificates {
// This is normally non-nil, but can still be nil here when in tests
// or in some embedded scenarios.
if cert.Leaf == nil {
if len(cert.Certificate) <= 0 {
return nil, nil, fmt.Errorf("no certificate found")

View File

@@ -2439,7 +2439,7 @@ func getOCSPStatus(s tls.ConnectionState) (*ocsp.Response, error) {
return resp, nil
}
func TestOCSPManualConfig(t *testing.T) {
func TestOCSPTLSConfigNoLeafSet(t *testing.T) {
o := DefaultTestOptions
o.HTTPHost = "127.0.0.1"
o.HTTPSPort = -1