Skip to content

Commit

Permalink
Add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dheyman committed Sep 15, 2023
1 parent b450a55 commit e392583
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions ocsp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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 != "" {
Expand Down

0 comments on commit e392583

Please sign in to comment.