feat: add continue option to mirror for resumable downloads#24
Draft
Koan-Bot wants to merge 1 commit into
Draft
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
continueoption to themirrormethod that enables resuming incomplete downloads. When set and the destination file already exists with content, the request includesRangeandIf-Rangeheaders to fetch only the missing bytes.Fixes #10
Changes
lib/HTTP/Tiny.pm: Implements thecontinueoption insub mirrorwith full response-code handling (206, 200, 304, 412) and updates the POD documentationt/110_mirror.t: Adds test infrastructure forcontinue/initial_contentcorpus params and an explicit multi-exchange test for 412 fallback behaviorcorpus/mirror-06.txt: New corpus test case — partial file + 206 Partial Content resumeBehavior
206 Partial Content200 OKRangeor resource changed)304 Not Modified412 Precondition FailedIf-Modified-Sinceconditional GETTest plan
prove -I lib t/110_mirror.t— all 33 tests pass, including the new 206 resume and 412 fallback casesprove -I lib t/— all 471 tests pass, no regressionsGenerated 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