mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 18:15:42 +01:00
Make map handling consistent
This commit is contained in:
parent
65b2b79baa
commit
6a74f0f5a8
1 changed files with 4 additions and 9 deletions
|
|
@ -192,6 +192,8 @@ func newProcessor(cfg *config) (*processor, error) {
|
||||||
advisories: map[csaf.TLPLabel]util.Set[string]{},
|
advisories: map[csaf.TLPLabel]util.Set[string]{},
|
||||||
whiteAdvisories: map[identifier]bool{},
|
whiteAdvisories: map[identifier]bool{},
|
||||||
},
|
},
|
||||||
|
times: map[csaf.AdvisoryFile]time.Time{},
|
||||||
|
noneTLS: util.Set[string]{},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -206,14 +208,12 @@ func (p *processor) close() {
|
||||||
// reset clears the fields values of the given processor.
|
// reset clears the fields values of the given processor.
|
||||||
func (p *processor) reset() {
|
func (p *processor) reset() {
|
||||||
p.redirects = nil
|
p.redirects = nil
|
||||||
p.noneTLS = nil
|
|
||||||
for k := range p.alreadyChecked {
|
|
||||||
delete(p.alreadyChecked, k)
|
|
||||||
}
|
|
||||||
p.pmdURL = ""
|
p.pmdURL = ""
|
||||||
p.pmd256 = nil
|
p.pmd256 = nil
|
||||||
p.pmd = nil
|
p.pmd = nil
|
||||||
p.keys = nil
|
p.keys = nil
|
||||||
|
clear(p.alreadyChecked)
|
||||||
|
clear(p.noneTLS)
|
||||||
clear(p.times)
|
clear(p.times)
|
||||||
|
|
||||||
p.invalidAdvisories.reset()
|
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
|
// checkTLS parses the given URL to check its schema, as a result it sets
|
||||||
// the value of "noneTLS" field if it is not HTTPS.
|
// the value of "noneTLS" field if it is not HTTPS.
|
||||||
func (p *processor) checkTLS(u string) {
|
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" {
|
if x, err := url.Parse(u); err == nil && x.Scheme != "https" {
|
||||||
p.noneTLS.Add(u)
|
p.noneTLS.Add(u)
|
||||||
}
|
}
|
||||||
|
|
@ -961,8 +958,6 @@ func (p *processor) checkChanges(base string, mask whereType) error {
|
||||||
}
|
}
|
||||||
p.badChanges.info("Found %v", changes)
|
p.badChanges.info("Found %v", changes)
|
||||||
|
|
||||||
p.times = map[csaf.AdvisoryFile]time.Time{}
|
|
||||||
|
|
||||||
times, files, err := func() ([]time.Time, []csaf.AdvisoryFile, error) {
|
times, files, err := func() ([]time.Time, []csaf.AdvisoryFile, error) {
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
var times []time.Time
|
var times []time.Time
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue