From c8dcb9584e1ea77c9b967d2bec5d167c7df410f0 Mon Sep 17 00:00:00 2001 From: Ryan Schneider Date: Sat, 2 Jun 2018 06:26:47 -0400 Subject: [PATCH] rpc: use HTTP request context as top-level context (#16861) --- rpc/http.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpc/http.go b/rpc/http.go index feaa7348c4..fe5e4b3093 100644 --- a/rpc/http.go +++ b/rpc/http.go @@ -181,7 +181,7 @@ func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // All checks passed, create a codec that reads direct from the request body // untilEOF and writes the response to w and order the server to process a // single request. - ctx := context.Background() + ctx := r.Context() ctx = context.WithValue(ctx, "remote", r.RemoteAddr) ctx = context.WithValue(ctx, "scheme", r.Proto) ctx = context.WithValue(ctx, "local", r.Host)