cli icon indicating copy to clipboard operation
cli copied to clipboard

Do not hang when deciding not to compress a file upload

Open blyxxyz opened this issue 11 months ago • 0 comments

This command would hang forever:

$ echo test > test.txt
$ http -x httpbin.org/post @test.txt

HTTPie would read the file, compress it, then discard the compressed data because it's larger than the original. This made request.body an exhausted file handle, which requests doesn't seem to like.

(Maybe it would be better in this case to do unconditional streaming compression to avoid buffering large files. We might do that in xh. But that would be a bigger change.)

blyxxyz avatar Jan 22 '25 12:01 blyxxyz