Add a comment about not discarding in webseed OK response bodies

This commit is contained in:
Matt Joiner 2021-11-14 14:01:46 +11:00
parent 60dd68ede9
commit 71cbea2fbc
1 changed files with 4 additions and 0 deletions

View File

@ -144,6 +144,10 @@ func recvPartResult(ctx context.Context, buf io.Writer, part requestPart) error
part.req.URL, part.req.URL,
part.req.Header.Get("Range")) part.req.Header.Get("Range"))
} }
// Instead of discarding, we could try receiving all the chunks present in the response
// body. I don't know how one would handle multiple chunk requests resulting in an OK
// response for the same file. The request algorithm might be need to be smarter for
// that.
discarded, _ := io.CopyN(io.Discard, result.resp.Body, part.e.Start) discarded, _ := io.CopyN(io.Discard, result.resp.Body, part.e.Start)
if discarded != 0 { if discarded != 0 {
log.Printf("discarded %v bytes in webseed request response part", discarded) log.Printf("discarded %v bytes in webseed request response part", discarded)