From 5aabdae26a9348bb252c856b508bc90fd2c9ca07 Mon Sep 17 00:00:00 2001 From: Dario Domizioli Date: Fri, 28 Sep 2018 14:54:05 +0100 Subject: [PATCH] Fix missing context on request sent through UDS (#1251) --- api/agent/agent.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/agent/agent.go b/api/agent/agent.go index ede44c8f9..ee36af5ad 100644 --- a/api/agent/agent.go +++ b/api/agent/agent.go @@ -716,6 +716,9 @@ func callToHTTPRequest(ctx context.Context, call *call) (*http.Request, error) { if err != nil { return req, err } + // Set the context on the request to make sure transport and client handle + // it properly and close connections at the end, e.g. when using UDS. + req = req.WithContext(ctx) req.Header = make(http.Header) for k, vs := range call.req.Header {