Skip to content

Commit

Permalink
fix: update
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <[email protected]>
  • Loading branch information
JeyJeyGao committed Sep 19, 2024
1 parent 2df6f2f commit 6267143
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions revocation/crl/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ type Fetcher interface {

// HTTPFetcher is a Fetcher implementation that fetches CRL from the given URL
type HTTPFetcher struct {
// Cache stores fetched CRLs and reuses them until the CRL expires.
// Cache stores fetched CRLs and reuses them until the CRL reaches the
// NextUpdate time.
// If Cache is nil, no cache is used.
Cache Cache

Expand All @@ -66,9 +67,9 @@ func NewHTTPFetcher(httpClient *http.Client) (*HTTPFetcher, error) {

// Fetch retrieves the CRL from the given URL
//
// It try to get the CRL from the cache first, if the cache is not nil or have
// an error (e.g. cache miss), it will download the CRL from the URL, then
// store it to the cache if the cache is not nil.
// If cache is not nil, try to get the CRL from the cache first. On failure
// (e.g. cache miss), it will download the CRL from the URL and store it to the
// cache.
func (f *HTTPFetcher) Fetch(ctx context.Context, url string) (bundle *Bundle, err error) {
if url == "" {
return nil, errors.New("CRL URL is empty")
Expand All @@ -94,7 +95,7 @@ func (f *HTTPFetcher) Fetch(ctx context.Context, url string) (bundle *Bundle, er
return bundle, nil
}

// Download downloads the CRL from the given URL and saves it to the
// download downloads the CRL from the given URL and saves it to the
// cache
func (f *HTTPFetcher) download(ctx context.Context, url string) (bundle *Bundle, err error) {
base, err := download(ctx, url, f.httpClient)
Expand Down

0 comments on commit 6267143

Please sign in to comment.