Speed up downloads by combining multiple network connections in parallel
TypeScript bandwidth-aggregationcross-platformdesktop-appdownloaderdownloadmanagerlinuxmacosmulticonnectionparallel-downloadswindows
fix: treat 416 like 404/410 as a dead link, not a retry loop (#120)
Giulio Savini5366a8c01c68
diff --git a/e2e/downloadActions.spec.ts b/e2e/downloadActions.spec.tsindex 85dde75..3679cf5 100644--- a/e2e/downloadActions.spec.ts+++ b/e2e/downloadActions.spec.ts@@ -64,6 +64,15 @@ test.describe('what each state offers', () => {expect(ids([item])).toEqual(['fix', 'copy', 'remove'])})+ test('failed with a range no longer satisfiable can be fixed', () => {+ const item = download({+ status: 'error',+ error: 'Server answered with status 416 for range request'+ })+ expect(failureAction(item as DownloadState)).toBe('fix')+ expect(ids([item])).toEqual(['fix', 'copy', 'remove'])+ })+test('failed with nothing to resume starts over', () => {expect(ids([download({ status: 'error', error: 'reset', resumable: false })])).toEqual(['again',diff --git a/src/renderer/src/utils/format.ts b/src/renderer/src/utils/format.tsindex bf79029..a830fbf 100644--- a/src/renderer/src/utils/format.ts+++ b/src/renderer/src/utils/format.ts@@ -254,9 +254,12 @@ export function toDisplayPath(path: string, homeDir: string): string {export { describeError } from '@shared/errors'-const LINK_REFUSED = /status (401|403|404|410) for range request/+const LINK_REFUSED = /status (401|403|404|410|416) for range request/-/** A download whose link the server now refuses: a fresh link to the same file picks it up. */+/** A download whose link the server now refuses: a fresh link to the same file picks it up.+ * 416 (Range Not Satisfiable) belongs here too: the server is saying the byte range this+ * download was resuming no longer exists, same as a 404/410 — retrying the same range would+ * just repeat the same 416 forever. */export function linkExpired(download: DownloadState): boolean {return (download.kind === 'http' &&