From 60cfa68b5ac7ab9d75e64f3a01d817fdea8b3d8b Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Fri, 5 Nov 2021 11:11:43 +0100 Subject: [PATCH] fix(measurex): avoid data race with HTTP request headers (#573) Closes https://github.com/ooni/probe/issues/1859 --- internal/measurex/measurer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/measurex/measurer.go b/internal/measurex/measurer.go index 285b852..ebd12b2 100644 --- a/internal/measurex/measurer.go +++ b/internal/measurex/measurer.go @@ -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)