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

A 204 response results in timeouts if connection is kept-alive... #70

Open
delta-one opened this issue Sep 15, 2023 · 0 comments
Open

Comments

@delta-one
Copy link

Hi,

I've noticed that a response with status 204 to, e.g., a POST request always results in a timeout if the connection is kept alive. RFC9110 specifies in 8.6 (https://www.rfc-editor.org/rfc/rfc9110.html#name-content-length) that A server MUST NOT send a Content-Length header field in any response with a status code of 1xx (Informational) or 204 (No Content).

It seems that the library is still trying to parse the body of a 204 response. But since the header of such a response does not contain a Content-Length field, contentLengthReceived stays false and the library tries to receive more data via the socket. If the server closes the connection, we won't receive any more data from the socket and the function returns the response. But if the connection is kept-alive, the socket.recv()-call will timeout as the server is not sending any more data but the socket is still open.

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

No branches or pull requests

1 participant