feat(http): implement HTTP range request logic #130
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/pget!130
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/http-range-requests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implement HTTP range request logic: HEAD probe, Accept-Ranges detection, Content-Length parsing, chunk splitting, and Range header generation.
Refactor Client struct to store User-Agent internally (removes need to pass config to NewRequest).
Why
Core prerequisite for parallel chunked downloads — determines if server supports ranges, calculates chunk boundaries, and builds correct Range headers.
Testing
go vet ./...passesgo build ./...passesgolangci-lint run ./...passesBreaking Changes
Client.NewRequestsignature changed — removedcfgparameter (User-Agent now stored in Client struct).Notes
ProbeURL— HEAD request, parsesContent-LengthandAccept-Ranges: bytesSplitChunks— divides file into[start, end)byte ranges for N workersBuildRangeHeader— formats HTTPRangeheader value (e.g.bytes=0-1023)FileInfo— size + ranges booleanChunk— start/end byte offsetsCloses #0027
Closes #0028
Closes #0029
Closes #0030
Closes #0031
Review: APPROVED
Verification
go vet ./...— ✅ passesgo build ./...— ✅ passesgolangci-lint v2 run ./...— ✅ 0 issuesChanges
internal/downloader/range.go(new) — ProbeURL, SplitChunks, BuildRangeHeader, FileInfo, Chunkinternal/downloader/client.go— stores userAgent on Client, NewRequest no longer needs cfg (fixes #128)ROADMAP.md— Marks Phase 2 range request items as [x]Suggestions (non-blocking)
SplitChunks(0, n)produces invalid Range header for zero-size filesCloses #0027, #0028, #0029, #0030, #0031 on merge.