Remove unused MaxGetEntriesSize from RFC6962Log

This commit is contained in:
Andrew Ayer 2025-05-01 13:13:17 -04:00
parent e909faaaf8
commit 0cd0c7d602
1 changed files with 4 additions and 10 deletions

View File

@ -23,7 +23,6 @@ import (
type RFC6962Log struct { type RFC6962Log struct {
URL *url.URL URL *url.URL
MaxGetEntriesSize uint64
HTTPClient *http.Client // nil to use default client HTTPClient *http.Client // nil to use default client
} }
@ -46,13 +45,8 @@ func (ctlog *RFC6962Log) GetRoots(ctx context.Context) ([][]byte, error) {
} }
func (ctlog *RFC6962Log) getEntries(ctx context.Context, startInclusive uint64, endInclusive uint64) ([]RFC6962LogEntry, error) { func (ctlog *RFC6962Log) getEntries(ctx context.Context, startInclusive uint64, endInclusive uint64) ([]RFC6962LogEntry, error) {
size := endInclusive - startInclusive + 1
if ctlog.MaxGetEntriesSize != 0 && size > ctlog.MaxGetEntriesSize {
size = ctlog.MaxGetEntriesSize
}
fullURL := ctlog.URL.JoinPath("/ct/v1/get-entries").String() fullURL := ctlog.URL.JoinPath("/ct/v1/get-entries").String()
fullURL += fmt.Sprintf("?start=%d&end=%d", startInclusive, startInclusive+size-1) fullURL += fmt.Sprintf("?start=%d&end=%d", startInclusive, endInclusive)
var parsedResponse struct { var parsedResponse struct {
Entries []RFC6962LogEntry `json:"entries"` Entries []RFC6962LogEntry `json:"entries"`
@ -63,7 +57,7 @@ func (ctlog *RFC6962Log) getEntries(ctx context.Context, startInclusive uint64,
if len(parsedResponse.Entries) == 0 { if len(parsedResponse.Entries) == 0 {
return nil, fmt.Errorf("Get %q: zero entries returned", fullURL) return nil, fmt.Errorf("Get %q: zero entries returned", fullURL)
} }
if uint64(len(parsedResponse.Entries)) > size { if uint64(len(parsedResponse.Entries)) > endInclusive-startInclusive+1 {
return nil, fmt.Errorf("Get %q: extraneous entries returned", fullURL) return nil, fmt.Errorf("Get %q: extraneous entries returned", fullURL)
} }
return parsedResponse.Entries, nil return parsedResponse.Entries, nil