Skip to content

Conversation

@mahithallu
Copy link

Summary

Fixes a false “Incomplete download” error when using http --download on responses with Content-Encoding (e.g., gzip).

Problem

For encoded responses, Content-Length represents the encoded payload size, but the HTTP client may transparently decode the body while streaming. HTTPie then counts decoded bytes written to disk and incorrectly compares them to the encoded Content-Length, resulting in a bogus “Incomplete download” error.

Fix

When Content-Encoding is present and not identity, treat the total size as unknown (do not use Content-Length for download size validation). Unencoded responses retain the existing strict size validation.

Reproduction

Run against a server that returns Content-Encoding: gzip with Content-Length set to the compressed size:

http --download GET http://127.0.0.1:3000/download

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.

1 participant