소스 검색

fix: add ForceAttemptHTTP2

Papersnake 2 달 전
부모
커밋
2f7eebcd10
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      service/http_client.go

+ 3 - 0
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)
 				},