Skip to content

Commit

Permalink
Do not add port to Host header for https (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
buger authored Nov 14, 2016
2 parents 22466d4 + a1174a1 commit 1f24c70
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
}
Expand Down

0 comments on commit 1f24c70

Please sign in to comment.