fix(websteps, webconnectivity): send the correct user agent (#616)
* [forwardport] fix(webconnectivity): send specific user agent (#615) This forward ports b8c530388e66b2cc86abad26d077202782e4a823 to `master`. See https://github.com/ooni/probe/issues/1902 * fix(websteps): send the correct user agent Also related to https://github.com/ooni/probe/issues/1902: let's just ensure that also websteps behaves in the correct way.
This commit is contained in:
parent
56440bec43
commit
ece6f3d48d
3 changed files with 13 additions and 4 deletions
|
|
@ -122,6 +122,9 @@ type THClientCall struct {
|
|||
|
||||
// TargetURL is the MANDATORY URL to measure.
|
||||
TargetURL string
|
||||
|
||||
// UserAgent is the OPTIONAL user-agent to use.
|
||||
UserAgent string
|
||||
}
|
||||
|
||||
// Call performs the specified TH call and returns either a response or an error.
|
||||
|
|
@ -140,7 +143,7 @@ func (c *THClientCall) Call(ctx context.Context) (*THServerResponse, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Header.Set("User-Agent", fmt.Sprintf("ooniprobe-cli/%s", version.Version))
|
||||
req.Header.Set("User-Agent", c.UserAgent)
|
||||
return c.httpClientDo(req)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue