1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Make map handling consistent

This commit is contained in:
koplas 2025-01-22 13:27:36 +01:00
parent 65b2b79baa
commit 6a74f0f5a8

View file

@ -192,6 +192,8 @@ func newProcessor(cfg *config) (*processor, error) {
advisories: map[csaf.TLPLabel]util.Set[string]{},
whiteAdvisories: map[identifier]bool{},
},
times: map[csaf.AdvisoryFile]time.Time{},
noneTLS: util.Set[string]{},
}, nil
}
@ -206,14 +208,12 @@ func (p *processor) close() {
// reset clears the fields values of the given processor.
func (p *processor) reset() {
p.redirects = nil
p.noneTLS = nil
for k := range p.alreadyChecked {
delete(p.alreadyChecked, k)
}
p.pmdURL = ""
p.pmd256 = nil
p.pmd = nil
p.keys = nil
clear(p.alreadyChecked)
clear(p.noneTLS)
clear(p.times)
p.invalidAdvisories.reset()
@ -379,9 +379,6 @@ func (p *processor) checkDomain(domain string) error {
// checkTLS parses the given URL to check its schema, as a result it sets
// the value of "noneTLS" field if it is not HTTPS.
func (p *processor) checkTLS(u string) {
if p.noneTLS == nil {
p.noneTLS = util.Set[string]{}
}
if x, err := url.Parse(u); err == nil && x.Scheme != "https" {
p.noneTLS.Add(u)
}
@ -961,8 +958,6 @@ func (p *processor) checkChanges(base string, mask whereType) error {
}
p.badChanges.info("Found %v", changes)
p.times = map[csaf.AdvisoryFile]time.Time{}
times, files, err := func() ([]time.Time, []csaf.AdvisoryFile, error) {
defer res.Body.Close()
var times []time.Time