From 594ba1dab25303ea44cea0cf244ccb46e89f92e9 Mon Sep 17 00:00:00 2001 From: sago35 Date: Sun, 24 Jul 2022 12:21:44 +0900 Subject: [PATCH] net/http: support for cookies when https --- net/http/tinygo.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/net/http/tinygo.go b/net/http/tinygo.go index a84040b..6ac3449 100644 --- a/net/http/tinygo.go +++ b/net/http/tinygo.go @@ -20,6 +20,11 @@ func SetBuf(b []byte) { } func (c *Client) Do(req *Request) (*Response, error) { + if c.Jar != nil { + for _, cookie := range c.Jar.Cookies(req.URL) { + req.AddCookie(cookie) + } + } switch req.URL.Scheme { case "http": return c.doHTTP(req) @@ -31,12 +36,6 @@ func (c *Client) Do(req *Request) (*Response, error) { } func (c *Client) doHTTP(req *Request) (*Response, error) { - if c.Jar != nil { - for _, cookie := range c.Jar.Cookies(req.URL) { - req.AddCookie(cookie) - } - } - // make TCP connection ip := net.ParseIP(req.URL.Hostname()) port := 80