Skip to content

Conversation

@atulk-code
Copy link

…is present

When Content-Encoding (e.g., gzip) is set, Content-Length represents the compressed size, but requests library automatically decompresses the response. This caused a mismatch where downloaded bytes exceeded Content-Length, leading to false 'Incomplete download' errors.

The fix skips using Content-Length for progress tracking when Content-Encoding header is present, since the decoded size will differ from the encoded size.

Added test case to verify this behavior.

Fixes #1642

…is present

When Content-Encoding (e.g., gzip) is set, Content-Length represents the
compressed size, but requests library automatically decompresses the response.
This caused a mismatch where downloaded bytes exceeded Content-Length, leading
to false 'Incomplete download' errors.

The fix skips using Content-Length for progress tracking when Content-Encoding
header is present, since the decoded size will differ from the encoded size.

Added test case to verify this behavior.

Fixes httpie#1642
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.

🐛 Bug Report: http --download misinterprets Content-Length when Content-Encoding: gzip is set

1 participant