Commit bf1a31df by Papersnake

fix: add ForceAttemptHTTP2

parent 14622aed
...@@ -37,6 +37,7 @@ func InitHttpClient() { ...@@ -37,6 +37,7 @@ func InitHttpClient() {
transport := &http.Transport{ transport := &http.Transport{
MaxIdleConns: common.RelayMaxIdleConns, MaxIdleConns: common.RelayMaxIdleConns,
MaxIdleConnsPerHost: common.RelayMaxIdleConnsPerHost, MaxIdleConnsPerHost: common.RelayMaxIdleConnsPerHost,
ForceAttemptHTTP2: true,
} }
if common.RelayTimeout == 0 { if common.RelayTimeout == 0 {
...@@ -93,6 +94,7 @@ func NewProxyHttpClient(proxyURL string) (*http.Client, error) { ...@@ -93,6 +94,7 @@ func NewProxyHttpClient(proxyURL string) (*http.Client, error) {
Transport: &http.Transport{ Transport: &http.Transport{
MaxIdleConns: common.RelayMaxIdleConns, MaxIdleConns: common.RelayMaxIdleConns,
MaxIdleConnsPerHost: common.RelayMaxIdleConnsPerHost, MaxIdleConnsPerHost: common.RelayMaxIdleConnsPerHost,
ForceAttemptHTTP2: true,
Proxy: http.ProxyURL(parsedURL), Proxy: http.ProxyURL(parsedURL),
}, },
CheckRedirect: checkRedirect, CheckRedirect: checkRedirect,
...@@ -127,6 +129,7 @@ func NewProxyHttpClient(proxyURL string) (*http.Client, error) { ...@@ -127,6 +129,7 @@ func NewProxyHttpClient(proxyURL string) (*http.Client, error) {
Transport: &http.Transport{ Transport: &http.Transport{
MaxIdleConns: common.RelayMaxIdleConns, MaxIdleConns: common.RelayMaxIdleConns,
MaxIdleConnsPerHost: common.RelayMaxIdleConnsPerHost, MaxIdleConnsPerHost: common.RelayMaxIdleConnsPerHost,
ForceAttemptHTTP2: true,
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
return dialer.Dial(network, addr) return dialer.Dial(network, addr)
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment