Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions rpcclient/infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -1356,17 +1356,27 @@ func newHTTPClient(config *ConnConfig) (*http.Client, error) {
}
}

transport := &ObservingTransport{
Base: &http.Transport{
Proxy: proxyFunc,
TLSClientConfig: tlsConfig,
},
baseTransport := http.Transport{
Proxy: proxyFunc,
TLSClientConfig: tlsConfig,
}

baseTransport.DialContext = (&net.Dialer{
Timeout: 3 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext
baseTransport.TLSHandshakeTimeout = 3 * time.Second
baseTransport.ResponseHeaderTimeout = 10 * time.Second

observingTransport := &ObservingTransport{
Base: &baseTransport,
// Wrap with response capturing if callback provided
OnResponseCapture: config.OnResponseCapture,
}

client := http.Client{
Transport: transport,
Transport: observingTransport,
Timeout: 30 * time.Second, // Overall request timeout
Comment on lines +1364 to +1379

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will want a way to pass the timeout value in, since we have the concept of an RPC timeout. This should be super nice.

}

return &client, nil
Expand Down