diff --git a/internal/net/request.go b/internal/net/request.go index c0f547ba8c3..1a7405e4260 100644 --- a/internal/net/request.go +++ b/internal/net/request.go @@ -169,9 +169,7 @@ func (d *downloader) sendChunkTask() *chunk { // when the final reader Close, we interrupt func (d *downloader) interrupt() error { - if d.chunkChannel == nil { - return nil - } + d.cancel() if d.written != d.params.Range.Length { log.Debugf("Downloader interrupt before finish") @@ -181,7 +179,6 @@ func (d *downloader) interrupt() error { } defer func() { close(d.chunkChannel) - d.chunkChannel = nil for _, buf := range d.bufs { buf.Close() } diff --git a/internal/net/serve.go b/internal/net/serve.go index 0eb8cbb8866..e85f61a8950 100644 --- a/internal/net/serve.go +++ b/internal/net/serve.go @@ -174,7 +174,7 @@ func ServeHTTP(w http.ResponseWriter, r *http.Request, name string, modTime time pw.Close() }() } - defer sendContent.Close() + //defer sendContent.Close() w.Header().Set("Accept-Ranges", "bytes") if w.Header().Get("Content-Encoding") == "" {