mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-06 08:30:29 +00:00
fix: http request cookie incremented indefinitely on retries (#514)
This commit is contained in:
1 file changed
+6
-5
@@ -280,10 +280,6 @@ func (f *Fetcher) fetchChunk(index int, ctx context.Context) (err error) {
|
||||
chunk := f.chunks[index]
|
||||
chunk.retryTimes = 0
|
||||
|
||||
httpReq, err := f.buildRequest(ctx, f.meta.Req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var (
|
||||
client = f.buildClient()
|
||||
buf = make([]byte, 8192)
|
||||
@@ -314,8 +310,13 @@ func (f *Fetcher) fetchChunk(index int, ctx context.Context) (err error) {
|
||||
}
|
||||
|
||||
var (
|
||||
resp *http.Response
|
||||
httpReq *http.Request
|
||||
resp *http.Response
|
||||
)
|
||||
httpReq, err = f.buildRequest(ctx, f.meta.Req)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if f.meta.Res.Range {
|
||||
httpReq.Header.Set(base.HttpHeaderRange,
|
||||
fmt.Sprintf(base.HttpHeaderRangeFormat, chunk.Begin+chunk.Downloaded, chunk.End))
|
||||
|
||||
Reference in new issue
Block a user