Skip to content

Commit

Permalink
improve default header
Browse files Browse the repository at this point in the history
 * 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.
  • Loading branch information
bernhardreiter committed Aug 1, 2024
1 parent 3a67fb5 commit 1a2ce68
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/csaf_checker.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Help Options:

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.

Expand Down
2 changes: 1 addition & 1 deletion docs/csaf_downloader.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Help Options:

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.

Expand Down
2 changes: 1 addition & 1 deletion util/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (hc *HeaderClient) Do(req *http.Request) (*http.Response, error) {

// Use default user agent if none is set
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)
}
Expand Down

0 comments on commit 1a2ce68

Please sign in to comment.