File tree 9 files changed +23
-27
lines changed
libraries/librariesmanager
9 files changed +23
-27
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import (
19
19
"fmt"
20
20
21
21
"github.com/arduino/arduino-cli/arduino/cores"
22
- "go.bug.st/downloader"
22
+ "go.bug.st/downloader/v2 "
23
23
semver "go.bug.st/relaxed-semver"
24
24
)
25
25
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ package librariesmanager
18
18
import (
19
19
"net/url"
20
20
21
- "go.bug.st/downloader"
21
+ "go.bug.st/downloader/v2 "
22
22
)
23
23
24
24
// LibraryIndexURL is the URL where to get library index.
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import (
20
20
"os"
21
21
22
22
"github.com/arduino/go-paths-helper"
23
- "go.bug.st/downloader"
23
+ "go.bug.st/downloader/v2 "
24
24
)
25
25
26
26
// ArchivePath returns the path of the Archive of the specified DownloadResource relative
Original file line number Diff line number Diff line change @@ -23,9 +23,10 @@ import (
23
23
"strings"
24
24
"testing"
25
25
26
+ "github.com/arduino/arduino-cli/httpclient"
26
27
"github.com/arduino/go-paths-helper"
27
28
"github.com/stretchr/testify/require"
28
- "go.bug.st/downloader"
29
+ "go.bug.st/downloader/v2 "
29
30
)
30
31
31
32
type EchoHandler struct {}
@@ -53,7 +54,9 @@ func TestDownloadApplyUserAgentHeaderUsingConfig(t *testing.T) {
53
54
URL : srv .URL ,
54
55
}
55
56
56
- d , err := r .Download (tmp , & downloader.Config {RequestHeaders : http.Header {"User-Agent" : []string {goldUserAgentValue }}})
57
+ httpClient := httpclient .NewWithConfig (& httpclient.Config {UserAgent : goldUserAgentValue })
58
+
59
+ d , err := r .Download (tmp , & downloader.Config {HttpClient : * httpClient })
57
60
require .NoError (t , err )
58
61
err = d .Run ()
59
62
require .NoError (t , err )
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import (
22
22
23
23
"github.com/arduino/go-paths-helper"
24
24
"github.com/stretchr/testify/require"
25
- "go.bug.st/downloader"
25
+ "go.bug.st/downloader/v2 "
26
26
)
27
27
28
28
func TestDownloadAndChecksums (t * testing.T ) {
Original file line number Diff line number Diff line change 16
16
package commands
17
17
18
18
import (
19
- "net/http"
20
- "net/url"
21
19
"time"
22
20
23
21
"github.com/arduino/arduino-cli/httpclient"
24
22
rpc "github.com/arduino/arduino-cli/rpc/commands"
25
- "github.com/pkg/errors"
26
- "github.com/sirupsen/logrus"
27
- "github.com/spf13/viper"
28
- "go.bug.st/downloader"
23
+ "go.bug.st/downloader/v2"
29
24
)
30
25
31
26
// GetDownloaderConfig returns the downloader configuration based on
32
27
// current settings.
33
28
func GetDownloaderConfig () (* downloader.Config , error ) {
34
- res := & downloader. Config {
35
- RequestHeaders : http. Header {
36
- "User-Agent" : [] string { httpclient . UserAgent ()},
37
- },
29
+
30
+ httpClient , err := httpclient . New ()
31
+ if err != nil {
32
+ return nil , err
38
33
}
39
- if viper .IsSet ("network.proxy" ) {
40
- proxy := viper .GetString ("network.proxy" )
41
- if _ , err := url .Parse (proxy ); err != nil {
42
- return nil , errors .New ("Invalid network.proxy '" + proxy + "': " + err .Error ())
43
- }
44
- res .ProxyURL = proxy
45
- logrus .Infof ("Using proxy %s" , proxy )
34
+
35
+ res := & downloader.Config {
36
+ HttpClient : * httpClient ,
46
37
}
47
38
return res , nil
48
39
}
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import (
33
33
paths "github.com/arduino/go-paths-helper"
34
34
"github.com/sirupsen/logrus"
35
35
"github.com/spf13/viper"
36
- "go.bug.st/downloader"
36
+ "go.bug.st/downloader/v2 "
37
37
)
38
38
39
39
// this map contains all the running Arduino Core Services instances
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ require (
38
38
github.com/spf13/viper v1.6.2
39
39
github.com/stretchr/testify v1.4.0
40
40
go.bug.st/cleanup v1.0.0
41
- go.bug.st/downloader v1.2.0
41
+ go.bug.st/downloader/v2 v2.0.1
42
42
go.bug.st/relaxed-semver v0.0.0-20190922224835-391e10178d18
43
43
go.bug.st/serial v1.0.0
44
44
go.bug.st/serial.v1 v0.0.0-20180827123349-5f7892a7bb45 // indirect
@@ -51,3 +51,5 @@ require (
51
51
gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce // indirect
52
52
gopkg.in/yaml.v2 v2.2.4
53
53
)
54
+
55
+ replace go.bug.st/downloader/v2 v2.0.1 => github.com/hdiniz/go-downloader/v2 v2.0.1
Original file line number Diff line number Diff line change @@ -85,6 +85,8 @@ github.com/h2non/filetype v1.0.8 h1:le8gpf+FQA0/DlDABbtisA1KiTS0Xi+YSC/E8yY3Y14=
85
85
github.com/h2non/filetype v1.0.8 /go.mod h1:isekKqOuhMj+s/7r3rIeTErIRy4Rub5uBWHfvMusLMU =
86
86
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4 =
87
87
github.com/hashicorp/hcl v1.0.0 /go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ =
88
+ github.com/hdiniz/go-downloader/v2 v2.0.1 h1:8+yB5gwlJJSri5wPatCuCDb3dnFDMROiLGQfb7fbFBA =
89
+ github.com/hdiniz/go-downloader/v2 v2.0.1 /go.mod h1:VZW2V1iGKV8rJL2ZEGIDzzBeKowYv34AedJz13RzVII =
88
90
github.com/imjasonmiller/godice v0.1.2 h1:T1/sW/HoDzFeuwzOOuQjmeMELz9CzZ53I2CnD+08zD4 =
89
91
github.com/imjasonmiller/godice v0.1.2 /go.mod h1:8cTkdnVI+NglU2d6sv+ilYcNaJ5VSTBwvMbFULJd/QQ =
90
92
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM =
@@ -205,8 +207,6 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q
205
207
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 /go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q =
206
208
go.bug.st/cleanup v1.0.0 h1:XVj1HZxkBXeq3gMT7ijWUpHyIC1j8XAoNSyQ06CskgA =
207
209
go.bug.st/cleanup v1.0.0 /go.mod h1:EqVmTg2IBk4znLbPD28xne3abjsJftMdqqJEjhn70bk =
208
- go.bug.st/downloader v1.2.0 h1:YmXFTcTnm0v8WzAWHn2DyV46c/Izlc/gReXubc2oBho =
209
- go.bug.st/downloader v1.2.0 /go.mod h1:l+RPbNbrTB+MoAIp8nrZsP22nRPDy26XJZQqmm4gNT4 =
210
210
go.bug.st/relaxed-semver v0.0.0-20190922224835-391e10178d18 h1:F1qxtaFuewctYc/SsHRn+Q7Dtwi+yJGPgVq8YLtQz98 =
211
211
go.bug.st/relaxed-semver v0.0.0-20190922224835-391e10178d18 /go.mod h1:Cx1VqMtEhE9pIkEyUj3LVVVPkv89dgW8aCKrRPDR/uE =
212
212
go.bug.st/serial v1.0.0 h1:ogEPzrllCsnG00EqKRjeYvPRsO7NJW6DqykzkdD6E/k =
You can’t perform that action at this time.
0 commit comments