|
6 | 6 | "crypto/x509" |
7 | 7 | "errors" |
8 | 8 | "fmt" |
9 | | - "net" |
10 | 9 | "net/http" |
11 | 10 | "os" |
12 | 11 | "runtime" |
@@ -129,19 +128,25 @@ func (p *altinityCloudProvider) Configure(ctx context.Context, req provider.Conf |
129 | 128 | } |
130 | 129 | } |
131 | 130 |
|
| 131 | + defaultTransport, ok := http.DefaultTransport.(*http.Transport) |
| 132 | + if !ok { |
| 133 | + resp.Diagnostics.AddError( |
| 134 | + "Failed to configure HTTP client", |
| 135 | + "Unable to get default HTTP transport", |
| 136 | + ) |
| 137 | + return |
| 138 | + } |
| 139 | + |
132 | 140 | client := client.NewClient( |
133 | 141 | &http.Client{ |
134 | 142 | Transport: &http.Transport{ |
135 | | - Proxy: http.ProxyFromEnvironment, |
136 | | - DialContext: (&net.Dialer{ |
137 | | - Timeout: 30 * time.Second, |
138 | | - KeepAlive: 30 * time.Second, |
139 | | - }).DialContext, |
140 | | - ForceAttemptHTTP2: true, |
141 | | - MaxIdleConns: 16, |
142 | | - IdleConnTimeout: 45 * time.Second, |
143 | | - TLSHandshakeTimeout: 10 * time.Second, |
144 | | - ExpectContinueTimeout: 1 * time.Second, |
| 143 | + Proxy: defaultTransport.Proxy, |
| 144 | + DialContext: defaultTransport.DialContext, |
| 145 | + ForceAttemptHTTP2: defaultTransport.ForceAttemptHTTP2, |
| 146 | + MaxIdleConns: defaultTransport.MaxIdleConns, |
| 147 | + IdleConnTimeout: defaultTransport.IdleConnTimeout, |
| 148 | + TLSHandshakeTimeout: defaultTransport.TLSHandshakeTimeout, |
| 149 | + ExpectContinueTimeout: defaultTransport.ExpectContinueTimeout, |
145 | 150 | TLSClientConfig: &tls.Config{ |
146 | 151 | RootCAs: rootCAs, |
147 | 152 | }, |
|
0 commit comments