使用uTls时,如何修复 www.fedex.com 上的TLS错误?

有人可以帮助我使用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

}


慕的地6264312
浏览 121回答 1
1回答

繁花不似锦

           tlsConn.SetSNI(URL)SNI 的值应为主机名 () 而不是 URL ()。这有效:www.fedex.comhttps://www.fedex.com            u,_ := url.Parse(URL)             tlsConn.SetSNI(u.Host)
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Go