Skip to content

Change curl and wget commands to resume downloads - #414

Open
bturmann wants to merge 2 commits into
k0sproject:mainfrom
bturmann:resume_downloads_curl_wget
Open

Change curl and wget commands to resume downloads#414
bturmann wants to merge 2 commits into
k0sproject:mainfrom
bturmann:resume_downloads_curl_wget

Conversation

@bturmann

Copy link
Copy Markdown

Partially fixes: k0sproject/k0sctl#1131
This is the first part handling the commands curl and wget. There will be another PR regarding Windows Powershell.

Currently, repeated executions will download a complete file each time even if the file is already existing.

This change implements resuming downloads by default for curl and wget. In case, the source server does not support resuming, then this option is simply ignored and the download happens anyway.

curl
Use option -C or --continue-at <offset> to resume downloads. It is required to specify the offset which can be generalized by adding the option with -C -.

wget
Use option -c or --continue to resume downloads.

Currently, repeated executions will download a complete file each time even if
the file is already existing.

This change implements resuming downloads by default for curl and wget. In case,
the source server does not support resuming, then this option is simply ignored
and the download happens anyway.

- curl
Use option -C, --continue-at <offset> to resume downloads.
It is required to specify the offset which can be generalized by adding the
option with "-C -".

- wget
Use option -c or --continue to resume downloads.
@bturmann

Copy link
Copy Markdown
Author

I don't see the exact reason of the failed check, only "Error:" is shown.

@kke
kke requested a balanced review from Copilot August 10, 2026 04:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds resumable POSIX downloads using curl and wget.

Changes:

  • Adds curl continuation support.
  • Enables wget’s continue option.
Suppressed comments (2)

remotefs/posixfs.go:405

  • The promised fallback for servers without range support is missing. Curl documents that a -C resume attempt fails when the server does not support byte ranges; this code immediately returns that error instead of retrying a normal download, contradicting the PR description that the option is ignored and the download proceeds. Handle resume rejection by retrying without -C (while preserving genuine download errors).
		if err := s.Exec(sh.Command("curl", "-C -", "-sSLf", "-o", dst, "--", url)); err != nil {

remotefs/posixfs.go:411

  • The existing TestPosixDownloadURL uses only HasPrefix("curl")/HasPrefix("wget"), so it does not verify either new resume option and already misses the malformed curl argument. Add exact command assertions for both branches, including separation of -C and -.
		if err := s.Exec(sh.Command("wget", "-c", "-qO", dst, "--", url)); err != nil {

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread remotefs/posixfs.go Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Downloads of remote source files always start from scratch

2 participants