Reduce memory by removing cookie jar after login
This commit is contained in:
parent
1f17fed32c
commit
0bbf81aa6d
1 changed files with 8 additions and 6 deletions
|
|
@ -47,12 +47,19 @@ func NewIdentity(log *util.Logger) *Identity {
|
|||
Helper: request.NewHelper(log),
|
||||
}
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
// Login performs the identity.vwgroup.io login
|
||||
func (v *Identity) login(uri, user, password string) (url.Values, error) {
|
||||
// track cookies and don't follow redirects
|
||||
jar, _ := cookiejar.New(&cookiejar.Options{
|
||||
PublicSuffixList: publicsuffix.List,
|
||||
})
|
||||
|
||||
// track cookies and don't follow redirects
|
||||
v.Client.Jar = jar
|
||||
defer func() { v.Client.Jar = nil }()
|
||||
|
||||
v.Client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
|
||||
if req.URL.Scheme != "https" {
|
||||
return http.ErrUseLastResponse
|
||||
|
|
@ -60,11 +67,6 @@ func NewIdentity(log *util.Logger) *Identity {
|
|||
return nil
|
||||
}
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
// Login performs the identity.vwgroup.io login
|
||||
func (v *Identity) login(uri, user, password string) (url.Values, error) {
|
||||
var vars FormVars
|
||||
|
||||
// add nonce and state
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue