Skip to content

Commit db87716

Browse files
committed
http: fix default port value for dialer
1 parent ebf799f commit db87716

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

nbhttp/client_conn.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,16 @@ func (c *ClientConn) Do(req *http.Request, handler func(res *http.Response, conn
216216

217217
strs := strings.Split(req.URL.Host, ":")
218218
host := strs[0]
219-
port := req.URL.Scheme
219+
port := "80"
220220
if len(strs) >= 2 {
221221
port = strs[1]
222+
} else {
223+
switch req.URL.Scheme {
224+
case "http":
225+
port = "80"
226+
case "https":
227+
port = "443"
228+
}
222229
}
223230
addr := host + ":" + port
224231

0 commit comments

Comments
 (0)