fix panic for situation common with self-signed certs

This commit is contained in:
Matthew Holt 2015-10-28 21:36:02 -06:00
parent 3842dc6432
commit f146acc019

View file

@ -55,6 +55,10 @@ func GetOCSPForCert(bundle []byte) ([]byte, int, error) {
// We only got one certificate, means we have no issuer certificate - get it.
if len(certificates) == 1 {
// TODO: build fallback. If this fails, check the remaining array entries.
if len(certificates[0].IssuingCertificateURL) == 0 {
return nil, OCSPUnknown, errors.New("no issuing certificate URL")
}
resp, err := http.Get(certificates[0].IssuingCertificateURL[0])
if err != nil {
return nil, OCSPUnknown, err