assume port 443 when not specified in printServerCert() test helper

This commit is contained in:
Ryan Richard
2024-10-07 13:18:42 -07:00
parent 3e72e40af2
commit 6fe55a3b48

View File

@@ -663,6 +663,11 @@ func printServerCert(t *testing.T, address string, dnsOverrides map[string]strin
host = dnsOverrides[host]
}
if !strings.Contains(host, ":") {
// tls.Dial() requires a port number, but there was no port number in the host, so assume 443.
host += ":443"
}
conn, err := tls.Dial("tcp", host, conf)
require.NoError(t, err)
defer func() { _ = conn.Close() }()