diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /workhorse/internal/upstream/roundtripper/roundtripper.go | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'workhorse/internal/upstream/roundtripper/roundtripper.go')
-rw-r--r-- | workhorse/internal/upstream/roundtripper/roundtripper.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/workhorse/internal/upstream/roundtripper/roundtripper.go b/workhorse/internal/upstream/roundtripper/roundtripper.go index fdbca5c0120..fcba50d7975 100644 --- a/workhorse/internal/upstream/roundtripper/roundtripper.go +++ b/workhorse/internal/upstream/roundtripper/roundtripper.go @@ -32,19 +32,23 @@ func NewBackendRoundTripper(backend *url.URL, socket string, proxyHeadersTimeout } func newBackendRoundTripper(backend *url.URL, socket string, proxyHeadersTimeout time.Duration, developmentMode bool, tlsConf *tls.Config) http.RoundTripper { - // Copied from the definition of http.DefaultTransport. We can't literally copy http.DefaultTransport because of its hidden internal state. - transport, dialer := newBackendTransport() + transport := http.DefaultTransport.(*http.Transport).Clone() transport.ResponseHeaderTimeout = proxyHeadersTimeout transport.TLSClientConfig = tlsConf + // Puma does not support http/2, there's no point in reconnecting + transport.ForceAttemptHTTP2 = false + + dial := transport.DialContext + if backend != nil && socket == "" { address := mustParseAddress(backend.Host, backend.Scheme) transport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) { - return dialer.DialContext(ctx, "tcp", address) + return dial(ctx, "tcp", address) } } else if socket != "" { transport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) { - return dialer.DialContext(ctx, "unix", socket) + return dial(ctx, "unix", socket) } } else { panic("backend is nil and socket is empty") |