HTTPS call with error "The system cannot find the file specified"

53 views
Skip to first unread message

Daniel Hemmerling

unread,
Oct 28, 2021, 4:04:01 PM10/28/21
to golang-nuts
I got an unexpected error The system cannot find the file specified. when calling method `RoundTrip(req *Request)` from `http.Transport`.

Error occurs on a Windows 10 Enterprise (19041) maschine. Not my maschine, so no debugging.

Implementation

This go application is only a simple reverse proxy which adds TLS Client Auth.

```go
transport:= &http.Transport{
DialContext: (&net.Dialer{
KeepAlive: 1 * time.Minute,
Timeout:   1 * time.Minute,
}).DialContext,
IdleConnTimeout:       1 * time.Hour,
TLSHandshakeTimeout:   20 * time.Second,
ExpectContinueTimeout: 20 * time.Second,
ResponseHeaderTimeout: 1 * time.Minute,
MaxIdleConns:          100,
MaxIdleConnsPerHost:   4,
}
if ProxyURL != nil {
transport.Proxy = http.ProxyURL(ProxyURL)
}

transport.TLSClientConfig = &tls.Config{
Certificates: []tls.Certificate{certificate},
}

response, err := transport.RoundTrip(r)
if err != nil {
t.Logger.Errorf("Error at send to %v in %vms with error ", r.URL, elapsed.Milliseconds(), err.Error())
}
```

- `certificate` is a `tls.Certificate`
- `r` is a `*http.Request`

Error Message

```
Error at send to https://example.org:443 in 88ms with error %!(EXTRA string=The system cannot find the file specified.)
```

My guess is, that a Windows Api Call cannot find a file or registry entry, maybe while reading the  Root CAs? 

Does anyone had simlar experience and can give me a hint? How to fix the windows system; or a workaround in Go?


Link to implementation of root CAs in windows

Reply all
Reply to author
Forward
0 new messages