问题描述
有人可以帮助我在 go 中使用 uTls 修复我的 TLS 吗?每当我尝试对 https://www.fedex.com/ 发出 GET 请求时,我都会得到:
{% if is_birthday %}
<p>Happy Birthday! Use the coupon code BIRTHDAY10 to receive 10% off your next order.</p>
{% endif %}
这是我的代码:
Get "https://www.fedex.com/": uTlsConn.Handshake() error: remote error: tls: internal error
解决方法
tlsConn.SetSNI(URL)
SNI 的值应该是主机名 (www.fedex.com
) 而不是 URL (https://www.fedex.com
)。这有效:
u,_ := url.Parse(URL)
tlsConn.SetSNI(u.Host)