From e392583de943fb08108329bd71138fdaa24f8a45 Mon Sep 17 00:00:00 2001 From: Dawid Heyman Date: Fri, 15 Sep 2023 11:45:31 +0200 Subject: [PATCH] Add logs --- ocsp.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ocsp.go b/ocsp.go index 82a39db15..a1eaed141 100644 --- a/ocsp.go +++ b/ocsp.go @@ -442,7 +442,7 @@ func retryOCSP( return fallbackRetryOCSPToGETRequest(ctx, client, req, ocspHost, headers, issuer, totalTimeout) } - logger.Debugf("OCSP ResponseStatus from server: %v\n", ocspRes.Status) + logger.Debugf("OCSP Status from server: %v\n", ocspRes.Status) return ocspRes, ocspResBytes, &ocspStatus{ code: ocspSuccess, } @@ -495,12 +495,25 @@ func fallbackRetryOCSPToGETRequest( } } - logger.Debugf("GET fallback OCSP ResponseStatus from server: %v\n", ocspRes.Status) + logger.Debugf("GET fallback OCSP Status from server: %v\n", printStatus(ocspRes)) return ocspRes, ocspResBytes, &ocspStatus{ code: ocspSuccess, } } +func printStatus(response *ocsp.Response) string { + switch response.Status { + case ocsp.Good: + return "Good" + case ocsp.Revoked: + return "Revoked" + case ocsp.Unknown: + return "Unknown" + default: + return fmt.Sprintf("%d", response.Status) + } +} + func fullOCSPURL(url *url.URL) string { fullUrl := url.Hostname() if url.Path != "" {