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 text was updated successfully, but these errors were encountered:
The Get is a bit non-standard but it does follow our pattern of having
Does anyone object to this?