Compare commits

...

2 Commits

Author SHA1 Message Date
masterZSH 07a5cebf9a
Merge c19c24aa37 into 1bddf2e0db 2024-05-09 09:11:23 +02:00
zsh c19c24aa37 Fix Manually passed `Cookie` header overrides `http.CookieJar` cookies 2020-06-08 16:16:12 +08:00
1 changed files with 7 additions and 7 deletions

View File

@ -198,13 +198,6 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
}
req = req.WithContext(ctx)
// Set the cookies present in the cookie jar of the dialer
if d.Jar != nil {
for _, cookie := range d.Jar.Cookies(u) {
req.AddCookie(cookie)
}
}
// Set the request headers using the capitalization for names and values in
// RFC examples. Although the capitalization shouldn't matter, there are
// servers that depend on it. The Header.Set method is not used because the
@ -236,6 +229,13 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
}
}
// Set the cookies present in the cookie jar of the dialer
if d.Jar != nil {
for _, cookie := range d.Jar.Cookies(u) {
req.AddCookie(cookie)
}
}
if d.EnableCompression {
req.Header["Sec-WebSocket-Extensions"] = []string{"permessage-deflate; server_no_context_takeover; client_no_context_takeover"}
}