Forcing conns to be gc-ed by default disabling keep-alive
* Forcing conns to be gc-ed with keep-alive
* removing redundant code
keep-alive are disabled by default
* fixing merge conflict
@@ -241,7 +241,7 @@ func (request *Request) Compile(options *protocols.ExecuterOptions) error {
MaxRedirects: request.MaxRedirects,
NoTimeout: false,
CookieReuse: request.CookieReuse,
- Connection: &httpclientpool.ConnectionConfiguration{},
+ Connection: &httpclientpool.ConnectionConfiguration{DisableKeepAlive: true},
RedirectFlow: httpclientpool.DontFollowRedirect,
}
@@ -260,11 +260,6 @@ func (request *Request) Compile(options *protocols.ExecuterOptions) error {
}
request.connConfiguration = connectionConfiguration
- // if the headers contain "Connection" we need to disable the automatic keep alive of the standard library
- if _, hasConnectionHeader := request.Headers["Connection"]; hasConnectionHeader {
- connectionConfiguration.Connection.DisableKeepAlive = true
- }
-
client, err := httpclientpool.Get(options.Options, connectionConfiguration)
if err != nil {
return errors.Wrap(err, "could not get dns client")
