Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not hang when deciding not to compress a file upload #1613

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

blyxxyz
Copy link
Contributor

@blyxxyz blyxxyz commented Jan 22, 2025

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.)

This command would hang forever:

```console
$ 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.
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