Skip to content

fix: skip Content-Length validation when Content-Encoding is present (#1642)#1717

Open
bibekmhj wants to merge 3 commits intohttpie:masterfrom
bibekmhj:fix/gzip-content-length-false-incomplete
Open

fix: skip Content-Length validation when Content-Encoding is present (#1642)#1717
bibekmhj wants to merge 3 commits intohttpie:masterfrom
bibekmhj:fix/gzip-content-length-false-incomplete

Conversation

@bibekmhj
Copy link

When a response has Content-Encoding (e.g. gzip), the requests library
transparently decompresses the body. This means the bytes written to disk
are the uncompressed size, which exceeds Content-Length (the compressed
size per RFC 9110 §8.6). Comparing the two causes a false 'Incomplete
download' error.

Fix: set total_size=None when Content-Encoding is present, skipping the
completeness check — consistent with curl, wget, and browser behaviour.

Fixes #1642
Fixes #1554
Related: #1701"

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 httpie -d does not work with gzip compressed content

1 participant