fix(measurex): avoid data race with HTTP request headers (#573)

Closes https://github.com/ooni/probe/issues/1859
This commit is contained in:
Simone Basso 2021-11-05 11:11:43 +01:00 committed by GitHub
parent aa27bbe33f
commit 60cfa68b5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -513,7 +513,7 @@ func (mx *Measurer) httpClientDo(ctx context.Context,
if err != nil {
return nil, err
}
req.Header = epnt.Header
req.Header = epnt.Header.Clone() // must clone because of parallel usage
const timeout = 15 * time.Second
ol := NewOperationLogger(mx.Logger,
"%s %s with %s/%s", req.Method, req.URL.String(), epnt.Address, epnt.Network)