Problem
Retry counts are inconsistent between the two retry loops and do not match the documented contract:
downloadChunkdoesn++then checksn >= MaxRetries(downloader.go:290-291):MaxRetries = 3yields exactly 3 attempts (2 retries).getDownloadSizerequest-error path usesn > MaxRetries(downloader.go:226-227): 4 attempts for the same setting.
Additionally, any non-200 status — including permanent ones like 404 — goes through the same retry path (downloader.go:240-250), so permanent errors burn WaitRetry × N for nothing.
Reproduction (verified)
MaxRetries = 3→ exactly 3 GET attempts against a 500.- The same 3 attempts against a 404.
Flag help and README say "maximum number of retries", so users expect MaxRetries + 1 attempts.
Suggested fix
Unify the counting (n >= MaxRetries or n > MaxRetries everywhere) and skip retries for permanent status codes (404, 4xx non-retryable).