Skip to content

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

@delta-one

Description

@delta-one

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions