fix: http download fail (#61)

This commit is contained in:
Li Wei authored and GitHub committed 2022-12-14 12:12:39 +08:00
1 parent c62867e3ef
commit 0a4be165a5
14 files changed
+113 -54

No files matched your search

+1 -1
View File
@@ -151,7 +151,7 @@ func (f *Fetcher) Create(res *base.Resource, opts *base.Options) error {
return err
}
if opts.Extra == nil {
opts.Extra = &fhttp.ReqExtra{}
opts.Extra = &fhttp.OptsExtra{}
}
extra := opts.Extra.(*fhttp.OptsExtra)
if extra.Connections == 0 {
+9 -5
View File
@@ -142,12 +142,16 @@ func doDownloadReady(f fetcher.Fetcher, listener net.Listener, connections int,
if err != nil {
t.Fatal(err)
}
opts = &base.Options{
Name: test.DownloadName,
Path: test.Dir,
Extra: http.OptsExtra{
var extra any = nil
if connections > 0 {
extra = http.OptsExtra{
Connections: connections,
},
}
}
opts = &base.Options{
Name: test.DownloadName,
Path: test.Dir,
Extra: extra,
}
err = fetcher.Create(res, opts)
if err != nil {