From a1174a159c42361b0b151280631598d51548edf0 Mon Sep 17 00:00:00 2001 From: Leonid Bugaev Date: Mon, 14 Nov 2016 17:47:30 +0300 Subject: [PATCH] Do not add port to Host header for https --- http_client.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/http_client.go b/http_client.go index b14242aa..a47e8503 100644 --- a/http_client.go +++ b/http_client.go @@ -58,11 +58,6 @@ func NewHTTPClient(baseURL string, config *HTTPClientConfig) *HTTPClient { } u, _ := url.Parse(baseURL) - if !strings.Contains(u.Host, ":") { - if u.Scheme != "http" { - u.Host += ":" + defaultPorts[u.Scheme] - } - } config.ConnectionTimeout = config.Timeout @@ -88,7 +83,7 @@ func (c *HTTPClient) Connect() (err error) { c.Disconnect() if !strings.Contains(c.host, ":") { - c.conn, err = net.DialTimeout("tcp", c.host+":80", c.config.ConnectionTimeout) + c.conn, err = net.DialTimeout("tcp", c.host + ":" + defaultPorts[c.scheme], c.config.ConnectionTimeout) } else { c.conn, err = net.DialTimeout("tcp", c.host, c.config.ConnectionTimeout) }