Skip to content
This repository has been archived by the owner on Apr 20, 2021. It is now read-only.

Commit

Permalink
Revert "Add timeouts to the probe http client"
Browse files Browse the repository at this point in the history
This reverts commit 28213a0.
  • Loading branch information
alban committed Nov 11, 2016
1 parent 5ffc71a commit cf773e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
3 changes: 1 addition & 2 deletions probe/appclient/app_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ func NewAppClient(pc ProbeConfig, hostname string, target url.URL, control xfer.
Timeout: httpClientTimeout,
},
wsDialer: websocket.Dialer{
TLSClientConfig: httpTransport.TLSClientConfig,
HandshakeTimeout: httpClientTimeout,
TLSClientConfig: httpTransport.TLSClientConfig,
},
conns: map[string]xfer.Websocket{},
readers: make(chan io.Reader, 2),
Expand Down
26 changes: 9 additions & 17 deletions probe/appclient/probe_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,16 @@ func (pc ProbeConfig) authorizedRequest(method string, urlStr string, body io.Re
}

func (pc ProbeConfig) getHTTPTransport(hostname string) (*http.Transport, error) {
var tlsConfig *tls.Config
if pc.Insecure {
tlsConfig = &tls.Config{InsecureSkipVerify: true}
} else {
tlsConfig = &tls.Config{
RootCAs: certPool,
ServerName: hostname,
}
return &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}, nil
}
return &http.Transport{
TLSClientConfig: tlsConfig,

DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext,
IdleConnTimeout: http.DefaultTransport.IdleConnTimeout,
TLSHandshakeTimeout: http.DefaultTransport.TLSHandshakeTimeout,
ExpectContinueTimeout: http.DefaultTransport.ExpectContinueTimeout,
}
return &http.Transport{
TLSClientConfig: &tls.Config{
RootCAs: certPool,
ServerName: hostname,
},
}, nil
}

0 comments on commit cf773e4

Please sign in to comment.