Fix server name in TLS connections
This commit is contained in:
parent
82688746dd
commit
e0ac1685d2
@ -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,
|
||||||