Skip to content

Commit

Permalink
Merge branch 'master' into support-ignore-version-check
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot[bot] authored Sep 25, 2023
2 parents 13852d8 + 456f37a commit c91ba93
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/repository/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package repository

import (
"bytes"
"crypto/tls"
"encoding/json"
stderrors "errors"
"fmt"
Expand Down Expand Up @@ -293,6 +294,14 @@ func (l *httpMirror) downloadFile(url string, to string, maxSize int64) (io.Read
}(time.Now())

client := grab.NewClient()

// workaround to resolve cdn error "tls: protocol version not supported"
client.HTTPClient.(*http.Client).Transport = &http.Transport{
Proxy: http.ProxyFromEnvironment,
// avoid using http/2 by setting non-nil TLSClientConfig
TLSClientConfig: &tls.Config{},
}

client.UserAgent = fmt.Sprintf("tiup/%s", version.NewTiUPVersion().SemVer())
req, err := grab.NewRequest(to, url)
if err != nil {
Expand Down

0 comments on commit c91ba93

Please sign in to comment.