Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'workhorse/internal/transport/transport.go')
-rw-r--r--workhorse/internal/transport/transport.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/workhorse/internal/transport/transport.go b/workhorse/internal/transport/transport.go
index f19d332a28a..87fa73985a9 100644
--- a/workhorse/internal/transport/transport.go
+++ b/workhorse/internal/transport/transport.go
@@ -1,6 +1,7 @@
package transport
import (
+ "net"
"net/http"
"time"
@@ -41,6 +42,20 @@ func WithDisabledCompression() Option {
}
}
+func WithDialTimeout(timeout time.Duration) Option {
+ return func(t *http.Transport) {
+ t.DialContext = (&net.Dialer{
+ Timeout: timeout,
+ }).DialContext
+ }
+}
+
+func WithResponseHeaderTimeout(timeout time.Duration) Option {
+ return func(t *http.Transport) {
+ t.ResponseHeaderTimeout = timeout
+ }
+}
+
func newRestrictedTransport(options ...Option) http.RoundTripper {
t := http.DefaultTransport.(*http.Transport).Clone()