cli
cli copied to clipboard
Do not hang when deciding not to compress a file upload
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.)