perf: multi-thread downloader, Content-Disposition (#4921)

general: enhance multi-thread downloader with cancelable context, immediately stop all stream processes when canceled;
feat(crypt): improve stream closing;
general: fix the bug of downloading files becomes previewing stream on modern browsers;

Co-authored-by: Sean He <866155+seanhe26@users.noreply.github.com>
Co-authored-by: Andy Hsu <i@nn.ci>
This commit is contained in:
Sean
2023-08-04 15:29:54 +08:00
committed by GitHub
parent 861948bcf3
commit 15b7169df4
7 changed files with 58 additions and 34 deletions

View File

@ -2,6 +2,7 @@ package model
import (
"github.com/alist-org/alist/v3/pkg/http_range"
"github.com/alist-org/alist/v3/pkg/utils"
"io"
"net/http"
"time"
@ -45,7 +46,7 @@ type FsOtherArgs struct {
}
type RangeReadCloser struct {
RangeReader RangeReaderFunc
Closer io.Closer
Closers *utils.Closers
}
type WriterFunc func(w io.Writer) error