Skip to content

feat: add continue option to mirror for resumable downloads#24

Draft
Koan-Bot wants to merge 1 commit into
Perl-Toolchain-Gang:masterfrom
Koan-Bot:koan.atoomic/fix-issue-10
Draft

feat: add continue option to mirror for resumable downloads#24
Koan-Bot wants to merge 1 commit into
Perl-Toolchain-Gang:masterfrom
Koan-Bot:koan.atoomic/fix-issue-10

Conversation

@Koan-Bot
Copy link
Copy Markdown

@Koan-Bot Koan-Bot commented Mar 19, 2026

Summary

Adds a continue option to the mirror method that enables resuming incomplete downloads. When set and the destination file already exists with content, the request includes Range and If-Range headers to fetch only the missing bytes.

Fixes #10

Changes

  • lib/HTTP/Tiny.pm: Implements the continue option in sub mirror with full response-code handling (206, 200, 304, 412) and updates the POD documentation
  • t/110_mirror.t: Adds test infrastructure for continue/initial_content corpus params and an explicit multi-exchange test for 412 fallback behavior
  • corpus/mirror-06.txt: New corpus test case — partial file + 206 Partial Content resume

Behavior

Response Action
206 Partial Content Appends new bytes to existing file
200 OK Replaces file (server ignored Range or resource changed)
304 Not Modified Returns success, file unchanged
412 Precondition Failed Falls back to standard If-Modified-Since conditional GET

Test plan

  • prove -I lib t/110_mirror.t — all 33 tests pass, including the new 206 resume and 412 fallback cases
  • prove -I lib t/ — all 471 tests pass, no regressions

Generated by Kōan /fix


Quality Report

Changes: 3 files changed, 151 insertions(+), 1 deletion(-)

Code scan: clean

Tests: skipped

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

When the `continue` option is set and the destination file already exists
with content, mirror sends Range + If-Range headers to resume the download.

- 206 Partial Content: appends new bytes to the existing file
- 200 OK: replaces the file (server ignored Range or resource changed)
- 412 Precondition Failed: falls back to standard If-Modified-Since mirror
- 304 Not Modified: returns success without downloading

Fixes Perl-Toolchain-Gang#10

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.

Add continue option to mirror

1 participant