Skip to content

Commit

Permalink
fix: correctly skip cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
ww-github committed Aug 3, 2020
1 parent 83b629d commit 10aa148
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion core/client.go
Expand Up @@ -128,7 +128,8 @@ func (client *HTTPClient) Do(req *http.Request, opts *RequestOptions) (*http.Res
if opts != nil && resp != nil && opts.SkipCookies {
cookies := resp.Cookies()
for _, rc := range cookies {
client.PersistentJar.RemoveCookie(rc)
rc.MaxAge = -1
client.Jar.SetCookies(resp.Request.URL, []*http.Cookie{rc})
}
}

Expand Down
5 changes: 3 additions & 2 deletions scripts/quebec/readings.go
Expand Up @@ -92,8 +92,9 @@ func (s *scriptQuebec) getReadings(recv chan<- *core.Measurement, errs chan<- er
errs <- err
return
}
// resp, err := core.Client.Get(fmt.Sprintf(s.readingsURLFormat, code), &core.RequestOptions{SkipCookies: true})
resp, err := core.Client.Get(fmt.Sprintf(s.readingsURLFormat, code), nil)
// will set-cookies every time, until max headers length overflows
// the workaround is to ignore cookies entirely
resp, err := core.Client.Get(fmt.Sprintf(s.readingsURLFormat, code), &core.RequestOptions{SkipCookies: true})
if err != nil {
errs <- err
return
Expand Down

0 comments on commit 10aa148

Please sign in to comment.