File tree 2 files changed +5
-20
lines changed
2 files changed +5
-20
lines changed Original file line number Diff line number Diff line change 16
16
package globals
17
17
18
18
import (
19
- "fmt"
20
- "net/http"
21
19
"os"
22
20
"path/filepath"
23
- "runtime"
24
21
25
22
"github.com/arduino/arduino-cli/version"
26
23
)
31
28
// DefaultIndexURL is the default index url
32
29
DefaultIndexURL = "https://downloads.arduino.cc/packages/package_index.json"
33
30
)
34
-
35
- // NewHTTPClientHeader returns the http.Header object that must be used by the clients inside the downloaders
36
- // and adds the subComponent if specified
37
- func NewHTTPClientHeader (subComponent string ) http.Header {
38
- if subComponent != "" {
39
- subComponent = " " + subComponent
40
- }
41
- userAgentValue := fmt .Sprintf ("%s/%s%s (%s; %s; %s) Commit:%s" ,
42
- VersionInfo .Application ,
43
- VersionInfo .VersionString ,
44
- subComponent ,
45
- runtime .GOARCH , runtime .GOOS , runtime .Version (),
46
- VersionInfo .Commit )
47
- return http.Header {"User-Agent" : []string {userAgentValue }}
48
- }
Original file line number Diff line number Diff line change 16
16
package commands
17
17
18
18
import (
19
+ "net/http"
19
20
"net/url"
20
21
"time"
21
22
22
- "github.com/arduino/arduino-cli/cli/globals "
23
+ "github.com/arduino/arduino-cli/httpclient "
23
24
rpc "github.com/arduino/arduino-cli/rpc/commands"
24
25
"github.com/pkg/errors"
25
26
"github.com/sirupsen/logrus"
@@ -31,7 +32,9 @@ import (
31
32
// current settings.
32
33
func GetDownloaderConfig () (* downloader.Config , error ) {
33
34
res := & downloader.Config {
34
- RequestHeaders : globals .NewHTTPClientHeader (viper .GetString ("network.user_agent_ext" )),
35
+ RequestHeaders : http.Header {
36
+ "User-Agent" : []string {httpclient .UserAgent ()},
37
+ },
35
38
}
36
39
if viper .IsSet ("network.proxy" ) {
37
40
proxy := viper .GetString ("network.proxy" )
You can’t perform that action at this time.
0 commit comments