From d6133867670070f1a9bf8fb3bc3d0498f868fe10 Mon Sep 17 00:00:00 2001 From: WJQSERVER Date: Thu, 23 Jan 2025 16:18:34 +0800 Subject: [PATCH] Enhance HTTP Client parameters. --- proxy/chunkreq.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/proxy/chunkreq.go b/proxy/chunkreq.go index 29bb4b5..4d8201f 100644 --- a/proxy/chunkreq.go +++ b/proxy/chunkreq.go @@ -34,9 +34,13 @@ func initChunkedBufferSize(cfgBufferSize int) { func initChunkedHTTPClient() { tr = &http.Transport{ MaxIdleConns: 100, - IdleConnTimeout: 30 * time.Second, + MaxConnsPerHost: 60, + IdleConnTimeout: 15 * time.Second, + } + client = &http.Client{ + Transport: tr, + Timeout: 5 * time.Second, } - client = &http.Client{Transport: tr} } func ChunkedProxyRequest(c *gin.Context, u string, cfg *config.Config, mode string, runMode string) {