client: Allow Request.Host to omit a port

This commit is contained in:
Adnan Maolood
2021-02-20 13:30:55 -05:00
parent 5922cff2e5
commit 0ab236c736
2 changed files with 4 additions and 3 deletions

View File

@@ -86,8 +86,9 @@ func (c *Client) Do(req *Request) (*Response, error) {
if req.Host != "" {
hostname, port, err = net.SplitHostPort(req.Host)
if err != nil {
// Port is required
return nil, err
// Likely no port
hostname = req.Host
port = "1965"
}
// Punycode hostname
hostname, err = punycodeHostname(hostname)