fix(http): keep Resolve response until Range takeover succeeds (#1465)

This commit is contained in:
Levi authored and GitHub committed 2026-09-02 23:49:37 +08:00
1 parent f49e2510f5
commit 9b704f6f14
3 files changed
+389 -67

No files matched your search

+8 -2
View File
@@ -167,11 +167,13 @@ func newTestDownloadOptAt(path string) *base.Options {
Path: path,
Name: test.DownloadName,
Extra: http.OptsExtra{
Connections: 4,
Connections: testDownloadConnections,
},
}
}
const testDownloadConnections = 4
func TestDownloader_Resolve(t *testing.T) {
listener := test.StartTestFileServer()
defer listener.Close()
@@ -1479,7 +1481,11 @@ func TestDownloader_PauseAndContinue(t *testing.T) {
}
func TestDownloader_PauseAllAndContinueAll(t *testing.T) {
listener := test.StartTestSlowFileServer(time.Millisecond * 2000)
const targetDownloadDuration = time.Second
// Scale the per-byte delay with the configured connection count so a full
// ranged transfer stays near one second and is still running at Pause.
delayPerByte := targetDownloadDuration * testDownloadConnections / test.BuildSize
listener := test.StartTestLowSpeedServer(delayPerByte)
defer listener.Close()
downloader := NewDownloader(nil)