Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
proposal: net/http: add Transport.GetProxyConnectHeader #41048
net/http.Transport currently has:
// ProxyConnectHeader optionally specifies headers to send to // proxies during CONNECT requests. ProxyConnectHeader Header // Go 1.8
... but it's static for the life of the Transport.
Some authentication modes like NTLM/Kerberos/Negotiate require a dynamic header value, which currently requires making a new Transport for each request going through a proxy. That's heavy, as the Transport is the unit of connection reuse.
// GetProxyConnectHeader is called to return headers to send to // proxuURL during a CONNECT request to the target ip:port. If it returns an error, the Transport // RoundTrip fails with that error. It can return (nil, nil) to not add headers. // If GetProxyConnectHeader is non-nil, ProxyConnectHeader is ignored. GetProxyConnectHeader func(ctx context.Context, proxyURL *url.URL, target string) (Header, error) // ProxyConnectHeader optionally specifies headers to send to // proxies during CONNECT requests. For dynamic use, see GetProxyConnectHeader. ProxyConnectHeader Header // Go 1.8
The Get is a bit non-standard but it does follow our pattern of having
Does anyone object to this?