Closed ghost closed 7 years ago
Hello sir: sorry, my English is very bad, I use Google Translate. When the page redirects happen, user agent will be reset. Please add following line in your source browser.go.
func (bow Browser) shouldRedirect(req *http.Request, []_http.Request) error { if bow.attributes[FollowRedirects] { req.Header.Set("User-Agent", bow.userAgent) return nil } return errors.NewLocation( "Redirects are disabled. Cannot follow '%s'.", req.URL.String()) }
This is actually a fairly serious issue. The user agent leaks on redirects as User-Agent: Go-http-client/1.1.
User-Agent: Go-http-client/1.1
Fixed in https://github.com/cardigann/surf/commit/7ce0920552c70dae633192a73923ed71d9f899ef
Hello sir: sorry, my English is very bad, I use Google Translate. When the page redirects happen, user agent will be reset. Please add following line in your source browser.go.
func (bow Browser) shouldRedirect(req *http.Request, []_http.Request) error { if bow.attributes[FollowRedirects] { req.Header.Set("User-Agent", bow.userAgent) return nil } return errors.NewLocation( "Redirects are disabled. Cannot follow '%s'.", req.URL.String()) }