Skip to content

Commit

Permalink
repository: set user agent for mirror requests (#1342)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroProfundis authored May 6, 2021
1 parent 54ac4d5 commit c7536d9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/repository/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/pingcap/tiup/pkg/utils/mock"
"github.com/pingcap/tiup/pkg/utils/rand"
"github.com/pingcap/tiup/pkg/verbose"
"github.com/pingcap/tiup/pkg/version"
)

const (
Expand Down Expand Up @@ -293,6 +294,7 @@ func (l *httpMirror) download(url string, to string, maxSize int64) (io.ReadClos
}(time.Now())

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

0 comments on commit c7536d9

Please sign in to comment.