Skip to content

Commit

Permalink
Fix messing up the 'source' tag for https sources. (#9400)
Browse files Browse the repository at this point in the history
(cherry picked from commit d63a701)
  • Loading branch information
srebhan authored and reimda committed Jul 7, 2021
1 parent a21c212 commit f710ba9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/inputs/x509_cert/x509_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,15 @@ func (c *X509Cert) serverName(u *url.URL) (string, error) {
}

func (c *X509Cert) getCert(u *url.URL, timeout time.Duration) ([]*x509.Certificate, error) {
protocol := u.Scheme
switch u.Scheme {
case "https":
u.Scheme = "tcp"
protocol = "tcp"
fallthrough
case "udp", "udp4", "udp6":
fallthrough
case "tcp", "tcp4", "tcp6":
ipConn, err := net.DialTimeout(u.Scheme, u.Host, timeout)
ipConn, err := net.DialTimeout(protocol, u.Host, timeout)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit f710ba9

Please sign in to comment.