Fix server name in TLS connections

This commit is contained in:
Adnan Maolood 2020-11-27 17:45:15 -05:00
parent 82688746dd
commit e0ac1685d2

View File

@ -85,6 +85,13 @@ func (c *Client) Do(req *Request) (*Response, error) {
} }
func (c *Client) do(req *Request, via []*Request) (*Response, error) { func (c *Client) do(req *Request, via []*Request) (*Response, error) {
// Extract hostname
colonPos := strings.LastIndex(req.Host, ":")
if colonPos == -1 {
colonPos = len(req.Host)
}
hostname := req.Host[:colonPos]
// Connect to the host // Connect to the host
config := &tls.Config{ config := &tls.Config{
InsecureSkipVerify: true, InsecureSkipVerify: true,