Since 0.21.0 httpx behaves differently if it just receives a 304 response and no other data (hangs indefinitely) #2130
Unanswered
johtso
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've just been updating httpx-caching to work with httpx 0.22 and came across a strange issue where a test was hanging indefinitely.
With 0.20 it works fine, but with 0.21 that specific test hangs.
My test server is just responding with a 304 status.
Is this change in behaviour just httpx now being stricter? Possibly there's no newline being returned after the 304 header?
https://github.com/johtso/httpx-caching/blob/httpx-v0.22/tests/_async/test_expires_heuristics.py#L59
https://github.com/johtso/httpx-caching/blob/httpx-v0.22/tests/conftest.py#L66
EDIT:
I've confirmed that the server is responding with this:
b'HTTP/1.1 304 Not Modified\r\nDate: Wed, 16 Mar 2022 22:27:30 GMT\r\nServer: 127.0.0.1\r\n\r\n'Don't see why this would cause the client to hang..
EDIT2:
I've tried unsuccessfully to isolate the problem in a test case..
The above works fine..
EDIT3:
It seems to be caused by this in the httpx-caching transport:
https://github.com/johtso/httpx-caching/blob/httpx-v0.22/httpx_caching/_async/_transport.py#L110
Previously this worked fine, now it seems to hang indefinitely if the response doesn't have any body..
Beta Was this translation helpful? Give feedback.
All reactions