Skip to content

Commit f1d151b

Browse files
committed
disable broken http2
1 parent 04178d9 commit f1d151b

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

gophertunnel

utils/proxy/resourcepacks.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import (
44
"bytes"
55
"context"
66
"crypto/sha256"
7+
"crypto/tls"
78
"fmt"
89
"io"
910
"net"
11+
"net/http"
1012
"strings"
1113
"sync"
1214

@@ -143,6 +145,15 @@ func (r *rpHandler) OnResourcePacksInfo(pk *packet.ResourcePacksInfo) error {
143145
totalPacks := len(pk.TexturePacks) + len(pk.BehaviourPacks)
144146
packsToDownload := make([]string, 0, totalPacks)
145147

148+
var httpClient = http.Client{
149+
Transport: &http.Transport{
150+
ForceAttemptHTTP2: false,
151+
TLSClientConfig: &tls.Config{
152+
NextProtos: []string{"http/1.1"},
153+
},
154+
},
155+
}
156+
146157
packFunc := func(id, ver, key string, size uint64) (err error) {
147158
packID := id + "_" + ver
148159
if r.filterDownloadResourcePacks(packID) {
@@ -182,7 +193,7 @@ func (r *rpHandler) OnResourcePacksInfo(pk *packet.ResourcePacksInfo) error {
182193
go func(url string) {
183194
defer r.dlwg.Done()
184195
r.log.Infof("Downloading Resourcepack: %s", url)
185-
newPack, err := resource.ReadURL(url)
196+
newPack, err := resource.ReadURL(&httpClient, url)
186197
if err != nil {
187198
r.log.Error(err)
188199
return

0 commit comments

Comments
 (0)