From 71cbea2fbc0ed4e47d004acccc7ef6d27203b455 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Sun, 14 Nov 2021 14:01:46 +1100 Subject: [PATCH] Add a comment about not discarding in webseed OK response bodies --- webseed/client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/webseed/client.go b/webseed/client.go index a98940e6..5dc9d2c4 100644 --- a/webseed/client.go +++ b/webseed/client.go @@ -144,6 +144,10 @@ func recvPartResult(ctx context.Context, buf io.Writer, part requestPart) error part.req.URL, 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) if discarded != 0 { log.Printf("discarded %v bytes in webseed request response part", discarded)