From 2f7eebcd102a121dad8dfb8c6e33e7f468c3f5c6 Mon Sep 17 00:00:00 2001 From: Papersnake Date: Tue, 2 Dec 2025 10:08:58 +0800 Subject: [PATCH] fix: add ForceAttemptHTTP2 --- service/http_client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/service/http_client.go b/service/http_client.go index 85863efa6..2fa9e51cf 100644 --- a/service/http_client.go +++ b/service/http_client.go @@ -37,6 +37,7 @@ func InitHttpClient() { transport := &http.Transport{ MaxIdleConns: common.RelayMaxIdleConns, MaxIdleConnsPerHost: common.RelayMaxIdleConnsPerHost, + ForceAttemptHTTP2: true, } if common.RelayTimeout == 0 { @@ -93,6 +94,7 @@ func NewProxyHttpClient(proxyURL string) (*http.Client, error) { Transport: &http.Transport{ MaxIdleConns: common.RelayMaxIdleConns, MaxIdleConnsPerHost: common.RelayMaxIdleConnsPerHost, + ForceAttemptHTTP2: true, Proxy: http.ProxyURL(parsedURL), }, CheckRedirect: checkRedirect, @@ -127,6 +129,7 @@ func NewProxyHttpClient(proxyURL string) (*http.Client, error) { Transport: &http.Transport{ MaxIdleConns: common.RelayMaxIdleConns, MaxIdleConnsPerHost: common.RelayMaxIdleConnsPerHost, + ForceAttemptHTTP2: true, DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { return dialer.Dial(network, addr) },