We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ca34b93 commit 1713666Copy full SHA for 1713666
net/http/tinygo.go
@@ -38,8 +38,16 @@ func (c *Client) doHTTP(req *Request) (*Response, error) {
38
}
39
40
// make TCP connection
41
- ip := net.ParseIP(req.URL.Host)
42
- raddr := &net.TCPAddr{IP: ip, Port: 80}
+ ip := net.ParseIP(req.URL.Hostname())
+ port := 80
43
+ if req.URL.Port() != "" {
44
+ p, err := strconv.ParseUint(req.URL.Port(), 0, 64)
45
+ if err != nil {
46
+ return nil, err
47
+ }
48
+ port = int(p)
49
50
+ raddr := &net.TCPAddr{IP: ip, Port: port}
51
laddr := &net.TCPAddr{Port: 8080}
52
53
conn, err := net.DialTCP("tcp", laddr, raddr)
0 commit comments