feat: propagate req context into proxyReq

Goal of this commit is to propagate req context into proxyReq
so it propagates to proxyClientConn.Do.

This change is linked to PR #105632
This commit is contained in:
Romain Aviolat 2022-01-17 15:52:40 +01:00
parent 8815a3119c
commit a5e41daaa4
No known key found for this signature in database
GPG Key ID: AAE0F5B36C8102C2

View File

@ -173,12 +173,14 @@ func (s *SpdyRoundTripper) dial(req *http.Request) (net.Conn, error) {
Host: targetHost,
}
proxyReq = *proxyReq.WithContext(req.Context())
if pa := s.proxyAuth(proxyURL); pa != "" {
proxyReq.Header = http.Header{}
proxyReq.Header.Set("Proxy-Authorization", pa)
}
proxyDialConn, err := s.dialWithoutProxy(req.Context(), proxyURL)
proxyDialConn, err := s.dialWithoutProxy(proxyReq.Context(), proxyURL)
if err != nil {
return nil, err
}