Closed mcepl closed 1 year ago
this is caused by the new version of urllib. I will see what we can do to fix it ASAP
@markstory I found the issue. Basically, in new urllib3 incorrect content length is not allowed: https://github.com/urllib3/urllib3/blob/b234aaf7ccbcb64012d8b33d21eb8bc9f768935d/src/urllib3/response.py#L546
Rationale you can find here: https://github.com/urllib3/urllib3/pull/2514
I propose to bump urllib dependency and on the side of responses
always enforce auto_calculate_content_length=True
I feel it to be a backwards incompatible change. But at the same time urllib3 is also backwards incompatible from now on
what do you think? if you give +1 then I have an almost ready to go PR for this
I admit requests
has nicer API than what’s in the standard library, but otherwise as a distro package maintainer I dislike it (and urllib3) with a passion.
Which is to say: thank you, this is probably the best we can do.
Describe the bug
When running test suite of 0.23.1 while packaging this on openSUSE/Tumbleweed (with urllib3 2.0.1, and requests 2.30.0) the test case test_auto_calculate_content_length_doesnt_override_existing_value fails:
Additional context
Complete build log with all details about packages used and steps taken to reproduce.
Version of
responses
0.23.1
Steps to Reproduce
Run the test suite
Expected Result
Test passes
Actual Result
It doesn’t (see above).
Actually, I was trying to make responses work with the new urllib3, so I have added these two patches:
and
a bit larger one (I assumed, that it is better to deal with the upgraded urllib3 head on instead of pretending to use the bundled one):
However, even the second one didn’t prevent this failed test from happening.
Any ideas, what’s wrong?