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

improve default header

* use `csaf_distribution` with an underscore as underscores
   are allowed by RFC9110 and it is more consistent as it is used
   with underscore at other places.
 * change example to `VERSION` to indicate that this is dynamic.
This commit is contained in:
Bernhard Reiter 2024-08-01 14:53:23 +02:00
parent 3a67fb5210
commit 1a2ce684ff
No known key found for this signature in database
GPG key ID: 2B7BA3BF9BC3A554
3 changed files with 3 additions and 3 deletions

View file

@ -30,7 +30,7 @@ Help Options:
Will check all given _domains_, by trying each as a CSAF provider. Will check all given _domains_, by trying each as a CSAF provider.
If no user agent is specified with `--header=user-agent:custom-agent/1.0` then the default agent in the form of `csaf-distribution/version` is sent. If no user agent is specified with `--header=user-agent:custom-agent/1.0` then the default agent in the form of `csaf_distribution/VERSION` is sent.
If a _domain_ starts with `https://` it is instead considered a direct URL to the `provider-metadata.json` and checking proceeds from there. If a _domain_ starts with `https://` it is instead considered a direct URL to the `provider-metadata.json` and checking proceeds from there.

View file

@ -40,7 +40,7 @@ Help Options:
Will download all CSAF documents for the given _domains_, by trying each as a CSAF provider. Will download all CSAF documents for the given _domains_, by trying each as a CSAF provider.
If no user agent is specified with `--header=user-agent:custom-agent/1.0` then the default agent in the form of `csaf-distribution/version` is sent. If no user agent is specified with `--header=user-agent:custom-agent/1.0` then the default agent in the form of `csaf_distribution/VERSION` is sent.
If a _domain_ starts with `https://` it is instead considered a direct URL to the `provider-metadata.json` and downloading procedes from there. If a _domain_ starts with `https://` it is instead considered a direct URL to the `provider-metadata.json` and downloading procedes from there.

View file

@ -64,7 +64,7 @@ func (hc *HeaderClient) Do(req *http.Request) (*http.Response, error) {
// Use default user agent if none is set // Use default user agent if none is set
if userAgent := hc.Header.Get("User-Agent"); userAgent == "" { if userAgent := hc.Header.Get("User-Agent"); userAgent == "" {
req.Header.Add("User-Agent", "csaf-distribution/"+SemVersion) req.Header.Add("User-Agent", "csaf_distribution/"+SemVersion)
} }
return hc.Client.Do(req) return hc.Client.Do(req)
} }