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

Warn in checker and downloader if advisories are delivered as none 'application/json'

This commit is contained in:
Sascha L. Teichmann 2023-02-01 01:36:54 +01:00
parent 052dbbe1d0
commit 6430712dad
2 changed files with 14 additions and 0 deletions

View file

@ -467,6 +467,13 @@ func (p *processor) integrity(
continue continue
} }
// Warn if we do not get JSON.
if ct := res.Header.Get("Content-Type"); ct != "application/json" {
lg(WarnType,
"The content type of %s should be 'application/json but is '%s'",
u, ct)
}
s256 := sha256.New() s256 := sha256.New()
s512 := sha512.New() s512 := sha512.New()
data.Reset() data.Reset()

View file

@ -281,6 +281,13 @@ func (d *downloader) downloadFiles(label csaf.TLPLabel, files []csaf.AdvisoryFil
continue continue
} }
// Warn if we do not get JSON.
if ct := resp.Header.Get("Content-Type"); ct != "application/json" {
log.Printf(
"WARN: The content type of %s should be 'application/json but is '%s'\n",
file.URL(), ct)
}
var ( var (
writers []io.Writer writers []io.Writer
s256, s512 hash.Hash s256, s512 hash.Hash