Skip to content

Commit 594ba1d

Browse files
sago35deadprogram
authored andcommitted
net/http: support for cookies when https
1 parent 625c565 commit 594ba1d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

net/http/tinygo.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ func SetBuf(b []byte) {
2020
}
2121

2222
func (c *Client) Do(req *Request) (*Response, error) {
23+
if c.Jar != nil {
24+
for _, cookie := range c.Jar.Cookies(req.URL) {
25+
req.AddCookie(cookie)
26+
}
27+
}
2328
switch req.URL.Scheme {
2429
case "http":
2530
return c.doHTTP(req)
@@ -31,12 +36,6 @@ func (c *Client) Do(req *Request) (*Response, error) {
3136
}
3237

3338
func (c *Client) doHTTP(req *Request) (*Response, error) {
34-
if c.Jar != nil {
35-
for _, cookie := range c.Jar.Cookies(req.URL) {
36-
req.AddCookie(cookie)
37-
}
38-
}
39-
4039
// make TCP connection
4140
ip := net.ParseIP(req.URL.Hostname())
4241
port := 80

0 commit comments

Comments
 (0)