@@ -7,7 +7,11 @@ package x509_test
7
7
import (
8
8
"crypto/tls"
9
9
"crypto/x509"
10
+ "errors"
10
11
"internal/testenv"
12
+ "net"
13
+ "strings"
14
+ "syscall"
11
15
"testing"
12
16
"time"
13
17
)
@@ -17,10 +21,19 @@ func TestPlatformVerifier(t *testing.T) {
17
21
t .Skip ()
18
22
}
19
23
20
- getChain := func (host string ) []* x509.Certificate {
24
+ getChain := func (t * testing. T , host string ) []* x509.Certificate {
21
25
t .Helper ()
22
26
c , err := tls .Dial ("tcp" , host + ":443" , & tls.Config {InsecureSkipVerify : true })
23
27
if err != nil {
28
+ // From https://docs.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2,
29
+ // matching the error string observed in https://go.dev/issue/52094.
30
+ const WSATRY_AGAIN syscall.Errno = 11002
31
+ var errDNS * net.DNSError
32
+ if strings .HasSuffix (host , ".badssl.com" ) && errors .As (err , & errDNS ) && strings .HasSuffix (errDNS .Err , WSATRY_AGAIN .Error ()) {
33
+ t .Log (err )
34
+ testenv .SkipFlaky (t , 52094 )
35
+ }
36
+
24
37
t .Fatalf ("tls connection failed: %s" , err )
25
38
}
26
39
return c .ConnectionState ().PeerCertificates
@@ -74,7 +87,7 @@ func TestPlatformVerifier(t *testing.T) {
74
87
75
88
for _ , tc := range tests {
76
89
t .Run (tc .name , func (t * testing.T ) {
77
- chain := getChain (tc .host )
90
+ chain := getChain (t , tc .host )
78
91
var opts x509.VerifyOptions
79
92
if len (chain ) > 1 {
80
93
opts .Intermediates = x509 .NewCertPool ()
0 commit comments