Skip to content

Commit

Permalink
only configure http2 transport when http2 settings are set
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj committed Jul 7, 2023
1 parent bb2441c commit 0ff4322
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions plugins/outputs/influxdb_v2/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,12 @@ func NewHTTPClient(cfg *HTTPConfig) (*httpClient, error) {
Proxy: proxy,
TLSClientConfig: cfg.TLSConfig,
}
http2Trans, err := http2.ConfigureTransports(transport)
if err == nil {
http2Trans.ReadIdleTimeout = time.Duration(cfg.ReadIdleTimeout)
http2Trans.PingTimeout = time.Duration(cfg.PingTimeout)
if cfg.ReadIdleTimeout != 0 || cfg.PingTimeout != 0 {
http2Trans, err := http2.ConfigureTransports(transport)
if err == nil {
http2Trans.ReadIdleTimeout = time.Duration(cfg.ReadIdleTimeout)
http2Trans.PingTimeout = time.Duration(cfg.PingTimeout)
}
}
case "unix":
transport = &http.Transport{
Expand Down

0 comments on commit 0ff4322

Please sign in to comment.