Fix messing up the 'source' tag for https sources. (#9400)

This commit is contained in:
Sven Rebhan 2021-06-22 20:45:03 +02:00 committed by GitHub
parent 812fbd6791
commit d63a7010d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -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
}