mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 11:55:40 +01:00
Improve https get diagnostics, add verbose option
* Implement a logging client and activate it using verbose parameter or option in checker and aggregator. Co-authored-by: Sascha L. Teichmann <sascha.teichmann@intevation.de>
This commit is contained in:
parent
e4011ea4cc
commit
a849ac0d5f
7 changed files with 70 additions and 14 deletions
|
|
@ -270,9 +270,9 @@ func (p *processor) httpClient() util.Client {
|
|||
return p.client
|
||||
}
|
||||
|
||||
client := http.Client{}
|
||||
hClient := http.Client{}
|
||||
|
||||
client.CheckRedirect = p.checkRedirect
|
||||
hClient.CheckRedirect = p.checkRedirect
|
||||
|
||||
var tlsConfig tls.Config
|
||||
if p.opts.Insecure {
|
||||
|
|
@ -287,17 +287,25 @@ func (p *processor) httpClient() util.Client {
|
|||
tlsConfig.Certificates = []tls.Certificate{cert}
|
||||
}
|
||||
|
||||
client.Transport = &http.Transport{
|
||||
hClient.Transport = &http.Transport{
|
||||
TLSClientConfig: &tlsConfig,
|
||||
}
|
||||
|
||||
var client util.Client
|
||||
|
||||
if p.opts.Verbose {
|
||||
client = &util.LoggingClient{Client: &hClient}
|
||||
} else {
|
||||
client = &hClient
|
||||
}
|
||||
|
||||
if p.opts.Rate == nil {
|
||||
p.client = &client
|
||||
return &client
|
||||
p.client = client
|
||||
return client
|
||||
}
|
||||
|
||||
p.client = &util.LimitingClient{
|
||||
Client: &client,
|
||||
Client: client,
|
||||
Limiter: rate.NewLimiter(rate.Limit(*p.opts.Rate), 1),
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue