Commit d79f8563 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Do not duplicate http.DefaultTransport

parent 92b51f76
...@@ -17,12 +17,6 @@ var DefaultDialer = &net.Dialer{ ...@@ -17,12 +17,6 @@ var DefaultDialer = &net.Dialer{
KeepAlive: 30 * time.Second, KeepAlive: 30 * time.Second,
} }
var DefaultTransport = &http.Transport{
Proxy: http.ProxyFromEnvironment, // from http.DefaultTransport
Dial: DefaultDialer.Dial, // from http.DefaultTransport
TLSHandshakeTimeout: 10 * time.Second, // from http.DefaultTransport
}
type RoundTripper struct { type RoundTripper struct {
Socket string Socket string
ProxyHeadersTimeout time.Duration ProxyHeadersTimeout time.Duration
...@@ -67,7 +61,8 @@ func (t *RoundTripper) configureRoundTripper() { ...@@ -67,7 +61,8 @@ func (t *RoundTripper) configureRoundTripper() {
return return
} }
tr := *DefaultTransport // Clone http.DefaultTransport. Needs a cast from http.RoundTripper to *http.Transport.
tr := *(http.DefaultTransport.(*http.Transport))
tr.ResponseHeaderTimeout = t.ProxyHeadersTimeout tr.ResponseHeaderTimeout = t.ProxyHeadersTimeout
if t.Socket != "" { if t.Socket != "" {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment