mirror of
https://github.com/minio/minio.git
synced 2025-11-10 05:59:43 -05:00
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:
@@ -95,7 +95,7 @@ func (target *ElasticsearchTarget) ID() event.TargetID {
|
||||
|
||||
// IsActive - Return true if target is up and active
|
||||
func (target *ElasticsearchTarget) IsActive() (bool, error) {
|
||||
if dErr := target.args.URL.DialHTTP(); dErr != nil {
|
||||
if dErr := target.args.URL.DialHTTP(nil); dErr != nil {
|
||||
if xnet.IsNetworkOrHostDown(dErr) {
|
||||
return false, errNotConnected
|
||||
}
|
||||
@@ -260,7 +260,7 @@ func NewElasticsearchTarget(id string, args ElasticsearchArgs, doneCh <-chan str
|
||||
}
|
||||
}
|
||||
|
||||
dErr := args.URL.DialHTTP()
|
||||
dErr := args.URL.DialHTTP(nil)
|
||||
if dErr != nil {
|
||||
if store == nil {
|
||||
return nil, dErr
|
||||
|
||||
@@ -95,7 +95,7 @@ func (target *WebhookTarget) IsActive() (bool, error) {
|
||||
if pErr != nil {
|
||||
return false, pErr
|
||||
}
|
||||
if dErr := u.DialHTTP(); dErr != nil {
|
||||
if dErr := u.DialHTTP(nil); dErr != nil {
|
||||
if xnet.IsNetworkOrHostDown(dErr) {
|
||||
return false, errNotConnected
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user