Skip to content

Fix silent truncation of large HTTP downloads in cp/fileclient - #70006

Merged
dwoz merged 1 commit into
saltstack:3006.xfrom
twangboy:fix/69916/3006.x
Aug 11, 2026
Merged

dwoz merged 1 commit into
saltstack:3006.xfrom
twangboy:fix/69916/3006.x

Conversation

@twangboy

@twangboy twangboy commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Tornado's HTTPClient enforces a default max_buffer_size of 100MiB independently of max_body_size. When a server doesn't send a Content-Length header (as some winrepo_ng HTTP servers don't), Salt read the response until the connection closed and silently truncated downloads over 100MiB instead of raising an error. Pass max_buffer_size alongside max_body_size so both track http_max_body.

Also harden fileclient.get_url() to compare bytes received against any advertised Content-Length and raise MinionError on mismatch instead of caching a partial file, and fix the requests backend to stream via iter_content() and catch RequestException so connection failures surface as clean errors instead of unhandled exceptions.

What issues does this PR fix or reference?

Fixes #69916

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes

Tornado's HTTPClient enforces a default max_buffer_size of 100MiB
independently of max_body_size. When a server doesn't send a
Content-Length header (as some winrepo_ng HTTP servers don't), Salt
read the response until the connection closed and silently truncated
downloads over 100MiB instead of raising an error. Pass max_buffer_size
alongside max_body_size so both track http_max_body.

Also harden fileclient.get_url() to compare bytes received against any
advertised Content-Length and raise MinionError on mismatch instead of
caching a partial file, and fix the requests backend to stream via
iter_content() and catch RequestException so connection failures
surface as clean errors instead of unhandled exceptions.

Fixes saltstack#69916
@twangboy twangboy added this to the Sulphur v3006.28 milestone Aug 10, 2026
@twangboy twangboy self-assigned this Aug 10, 2026
@twangboy
twangboy requested a review from a team as a code owner August 10, 2026 16:50
@twangboy twangboy added the test:full Run the full test suite label Aug 10, 2026
@dwoz
dwoz merged commit 23178f0 into saltstack:3006.x Aug 11, 2026
439 of 444 checks passed

This branch was previously deployed

1 inactive deployment
ci — d7861017 Deployed Aug 10, 2026 by twangboy via Build Onedir Packages / RPM (arm64) #26184
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants