Use user CAs in checkEndpoint() call (#8911)

The server info handler makes a http connection to other
nodes to check if they are up but does not load the custom
CAs in ~/.minio/certs/CAs.

This commit fix it.

Co-authored-by: Harshavardhana <harsha@minio.io>
This commit is contained in:
Anis Elleuch
2020-02-02 02:45:29 +01:00
committed by GitHub
parent d76160c245
commit 7432b5c9b2
5 changed files with 56 additions and 55 deletions

View File

@@ -86,14 +86,20 @@ func (u *URL) UnmarshalJSON(data []byte) (err error) {
}
// DialHTTP - dials the url to check the connection.
func (u URL) DialHTTP() error {
var client = &http.Client{
Transport: &http.Transport{
func (u URL) DialHTTP(transport *http.Transport) error {
if transport == nil {
transport = &http.Transport{
DialContext: (&net.Dialer{
Timeout: 2 * time.Second,
}).DialContext,
},
}
}
var client = &http.Client{
Transport: transport,
}
req, err := http.NewRequest("POST", u.String(), nil)
if err != nil {
return err