From 96019b6ef7756cdf6f7583c65d43dcd8f47b598c Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 27 Oct 2024 15:01:55 +0200 Subject: [PATCH] hicli: apply more default settings to http transport --- pkg/hicli/hicli.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/hicli/hicli.go b/pkg/hicli/hicli.go index 9549edc..062ee05 100644 --- a/pkg/hicli/hicli.go +++ b/pkg/hicli/hicli.go @@ -92,12 +92,17 @@ func New(rawDB, cryptoDB *dbutil.Database, log zerolog.Logger, pickleKey []byte, UserAgent: mautrix.DefaultUserAgent, Client: &http.Client{ Transport: &http.Transport{ - DialContext: (&net.Dialer{Timeout: 10 * time.Second}).DialContext, - TLSHandshakeTimeout: 10 * time.Second, + DialContext: (&net.Dialer{Timeout: 10 * time.Second}).DialContext, // This needs to be relatively high to allow initial syncs, // it's lowered after the first sync in postProcessSyncResponse ResponseHeaderTimeout: 300 * time.Second, + // Default settings from http.DefaultTransport + Proxy: http.ProxyFromEnvironment, ForceAttemptHTTP2: true, + MaxIdleConns: 100, + IdleConnTimeout: 90 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 1 * time.Second, }, Timeout: 300 * time.Second, },