fix: crash caused by non-resumable http download resources (#97)

This commit is contained in:
Li Wei authored and GitHub committed 2023-03-06 21:09:31 +08:00
1 parent f42838810a
commit dd46e7a3eb
2 files changed
+2 -1

No files matched your search

+1 -1
View File
@@ -250,7 +250,7 @@ func (f *Fetcher) filepath() string {
func (f *Fetcher) fetch() {
f.ctx, f.cancel = context.WithCancel(context.Background())
eg, _ := errgroup.WithContext(f.ctx)
for i := 0; i < f.meta.Opts.Extra.(*fhttp.OptsExtra).Connections; i++ {
for i := 0; i < len(f.chunks); i++ {
i := i
eg.Go(func() error {
return f.fetchChunk(i)
+1
View File
@@ -79,6 +79,7 @@ func TestFetcher_DownloadChunked(t *testing.T) {
defer listener.Close()
// chunked编码下载
downloadNormal(listener, 1, t)
downloadNormal(listener, 2, t)
}
func TestFetcher_DownloadPost(t *testing.T) {