mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-16 12:53:23 +00:00
net/http: support for cookies when https
This commit is contained in:
+5
-6
@@ -20,6 +20,11 @@ func SetBuf(b []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Do(req *Request) (*Response, error) {
|
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 {
|
switch req.URL.Scheme {
|
||||||
case "http":
|
case "http":
|
||||||
return c.doHTTP(req)
|
return c.doHTTP(req)
|
||||||
@@ -31,12 +36,6 @@ func (c *Client) Do(req *Request) (*Response, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) doHTTP(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
|
// make TCP connection
|
||||||
ip := net.ParseIP(req.URL.Hostname())
|
ip := net.ParseIP(req.URL.Hostname())
|
||||||
port := 80
|
port := 80
|
||||||
|
|||||||
Reference in New Issue
Block a user