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

treq.collect() should close the HTTP transport when the collector function throws an exception #347

Closed
itamarst opened this issue Jul 15, 2022 · 0 comments · Fixed by #348
Labels

Comments

@itamarst
Copy link
Contributor

If the collector function throws an exception, that means there is no way to handle remaining body data. In some cases this may actually be a deliberate indication that the response is no good; for example, I implemented a length-constrained variant of treq.content(), and if the body exceeds that it's indication of a buggy or malicious server.

As such, the only reasonable thing to do in this situation is to close the transport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants