有人可以帮助我使用uTls在go中修复我的TLS吗?每当我尝试对 https://www.fedex.com/ 的GET请求时,我都会得到:Get "https://www.fedex.com/": uTlsConn.Handshake() error: remote error: tls: internal error这是我的代码:func tls_connection(URL string) *http.Response { cookieJar, _ := cookiejar.New(nil) client := &http.Client{ Jar: cookieJar} tlsConn.SetSNI(URL) req, err := http.NewRequest("GET", URL, nil) req.Header.Add("user-agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36") // the client.do wraps the request resp, err := client.Do(req) if err != nil { fmt.Println(err) } else { fmt.Println(resp.StatusCode) body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) } return resp}
1 回答

繁花不似锦
TA贡献1851条经验 获得超4个赞
tlsConn.SetSNI(URL)
SNI 的值应为主机名 () 而不是 URL ()。这有效:www.fedex.com
https://www.fedex.com
u,_ := url.Parse(URL) tlsConn.SetSNI(u.Host)
- 1 回答
- 0 关注
- 120 浏览
添加回答
举报
0/150
提交
取消