Commit 2ef89059 authored by Nimi Wariboko Jr's avatar Nimi Wariboko Jr

Proxy: Instead of setting DisableKeepAlives, set MaxIdleConnsPerHost to -1 to...

Proxy: Instead of setting DisableKeepAlives, set MaxIdleConnsPerHost to -1 to prevent net/http from pooling the connections. DisableKeepAlives causes net/http to send a Connection: Closed header which is bad. Fixes #1056
parent fdad616d
...@@ -304,7 +304,7 @@ func newConnHijackerTransport(base http.RoundTripper) *connHijackerTransport { ...@@ -304,7 +304,7 @@ func newConnHijackerTransport(base http.RoundTripper) *connHijackerTransport {
KeepAlive: 30 * time.Second, KeepAlive: 30 * time.Second,
}).Dial, }).Dial,
TLSHandshakeTimeout: 10 * time.Second, TLSHandshakeTimeout: 10 * time.Second,
DisableKeepAlives: true, MaxIdleConnsPerHost: -1,
} }
if base != nil { if base != nil {
if baseTransport, ok := base.(*http.Transport); ok { if baseTransport, ok := base.(*http.Transport); ok {
...@@ -313,7 +313,7 @@ func newConnHijackerTransport(base http.RoundTripper) *connHijackerTransport { ...@@ -313,7 +313,7 @@ func newConnHijackerTransport(base http.RoundTripper) *connHijackerTransport {
transport.TLSHandshakeTimeout = baseTransport.TLSHandshakeTimeout transport.TLSHandshakeTimeout = baseTransport.TLSHandshakeTimeout
transport.Dial = baseTransport.Dial transport.Dial = baseTransport.Dial
transport.DialTLS = baseTransport.DialTLS transport.DialTLS = baseTransport.DialTLS
transport.DisableKeepAlives = true transport.MaxIdleConnsPerHost = -1
} }
} }
hjTransport := &connHijackerTransport{transport, nil, bufferPool.Get().([]byte)[:0]} hjTransport := &connHijackerTransport{transport, nil, bufferPool.Get().([]byte)[:0]}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment