fix(proxy): preserve SigV4-signed ranges - #1820
Open
YQ-Wang wants to merge 3 commits into
Open
Conversation
YQ-Wang
requested review from
LunaWhispers,
bergwolf,
fcgxz2003,
hhhhsdxxxx,
imeoer and
mingcheng
April 29, 2026 17:53
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1820 +/- ##
==========================================
+ Coverage 51.23% 53.01% +1.77%
==========================================
Files 100 100
Lines 26530 27498 +968
==========================================
+ Hits 13593 14578 +985
+ Misses 12937 12920 -17
🚀 New features to boost your workflow:
|
This was referenced Apr 29, 2026
YQ-Wang
force-pushed
the
fix/proxy-preserve-sigv4-signed-range
branch
from
July 21, 2026 04:43
888b2aa to
cf75114
Compare
YQ-Wang
force-pushed
the
fix/proxy-preserve-sigv4-signed-range
branch
from
July 24, 2026 09:17
5869cba to
0d981ed
Compare
Keep signature-bound Range headers unchanged across stat and piece downloads, isolate compact range tasks, and validate the returned representation before caching it. Signed-off-by: Yiqing Wang <yiqing@wangemail.com>
YQ-Wang
force-pushed
the
fix/proxy-preserve-sigv4-signed-range
branch
from
August 1, 2026 03:14
6dc0223 to
ac63402
Compare
Signed-off-by: Yiqing Wang <yiqing@wangemail.com>
Signed-off-by: Yiqing Wang <yiqing@wangemail.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.
Description
This fixes multipart S3 downloads through dfdaemon's HTTP proxy when AWS SigV4 or SigV4a covers the
Rangeheader.The change is limited to signature-bound ranges:
Rangein SigV4/SigV4a signed headers, including presigned URLs.Accept,Accept-Language, andAccept-Encodingin compact-range cache identity to avoid cross-representation cache reuse.206 Partial Content,Content-Range,Content-Length,ETag, and S3 version ID when present before caching source bytes.If-Rangerequests directly to origin because a validator mismatch can legitimately return a full200response that a compact range task cannot represent.304, while reporting locally generated validation failures on nominal success responses as502 Bad Gatewayand correctly framing empty responses.Unrelated S3-aware routing, TLS policy, proxy authentication, redirect, logging, and general cache-revalidation changes are intentionally excluded.
Related Issue
Fixes #1821
Motivation and Context
Multipart S3 clients such as s5cmd sign each
Rangerequest. dfdaemon normally rewrites ranges into Dragonfly piece ranges, which changes the canonical request and causes S3 to reject it with403 SignatureDoesNotMatch.For requests that do not explicitly sign
Range, the existing download path remains unchanged.Tests
Validated on commit
1ef00b966b55a0cf4696edc4873dffb3e6d49de2againstmainat6a9b8c184961ff1a9928d25356c27513b188d829:cargo fmt --all -- --checkcargo check --all --all-targetscargo clippy --all --all-targets -- -D warningsdragonfly-clientlibrary tests (66 tests)cargo test --all-features --workspace(461 tests, 0 failures; 4 doc tests ignored)The exact PR head was also exercised with a Linux binary built from that commit, two dfdaemons, S3-compatible MinIO, a recording relay, and s5cmd v2.3.0 using a 24 MiB object split into five signed ranges. Direct, cold-client, seed-cache, and warm-client outputs were byte-identical. The cold client received all bytes from the seed; later seed and client downloads were local-cache hits with no ranged origin requests. The five task IDs remained stable across fresh SigV4 dates and signatures, and every ranged origin GET preserved its exact range with
host;rangesigned. No signature or signed-response validation errors were observed.Validation Boundaries
HEAD.If-Rangerequests intentionally bypass P2P to preserve HTTP validator semantics.Varyprocessing.AI Assistance
AI assistance was used to review and refine the scope and implementation. The final patch was checked against the linked issue and validated with the commands listed above.
Screenshots (if appropriate)
N/A