mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Mark files as already checked.
This commit is contained in:
parent
86c6b425b5
commit
d9ab244918
1 changed files with 29 additions and 13 deletions
|
|
@ -38,6 +38,7 @@ type processor struct {
|
|||
opts *options
|
||||
redirects map[string]string
|
||||
noneTLS map[string]struct{}
|
||||
alreadyChecked map[string]struct{}
|
||||
pmd256 []byte
|
||||
pmd interface{}
|
||||
builder gval.Language
|
||||
|
|
@ -57,6 +58,7 @@ func newProcessor(opts *options) *processor {
|
|||
opts: opts,
|
||||
redirects: map[string]string{},
|
||||
noneTLS: map[string]struct{}{},
|
||||
alreadyChecked: map[string]struct{}{},
|
||||
builder: gval.Full(jsonpath.Language()),
|
||||
}
|
||||
}
|
||||
|
|
@ -68,6 +70,9 @@ func (p *processor) clean() {
|
|||
for k := range p.noneTLS {
|
||||
delete(p.noneTLS, k)
|
||||
}
|
||||
for k := range p.alreadyChecked {
|
||||
delete(p.alreadyChecked, k)
|
||||
}
|
||||
p.pmd256 = nil
|
||||
p.pmd = nil
|
||||
p.keys = nil
|
||||
|
|
@ -119,6 +124,14 @@ func (p *processor) checkTLS(u string) {
|
|||
}
|
||||
}
|
||||
|
||||
func (p *processor) markChecked(s string) bool {
|
||||
if _, ok := p.alreadyChecked[s]; ok {
|
||||
return true
|
||||
}
|
||||
p.alreadyChecked[s] = struct{}{}
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *processor) checkRedirect(r *http.Request, via []*http.Request) error {
|
||||
|
||||
var path strings.Builder
|
||||
|
|
@ -178,6 +191,9 @@ func (p *processor) integrity(
|
|||
return err
|
||||
}
|
||||
u := b.ResolveReference(fp).String()
|
||||
if p.markChecked(u) {
|
||||
continue
|
||||
}
|
||||
p.checkTLS(u)
|
||||
res, err := client.Get(u)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue