Skip to content

http.Client: fix handling of 204 No Content responses - #25254

Open
jedisct1 wants to merge 1 commit into
ziglang:masterfrom
jedisct1:http204
Open

jedisct1 wants to merge 1 commit into
ziglang:masterfrom
jedisct1:http204

Conversation

@jedisct1

Copy link
Copy Markdown
Contributor

The HTTP client would hang when trying to read a response body for 204 No Content responses with keep-alive connections. This is because the client incorrectly attempted to read a body based solely on the request method, without considering the response status code.

Per RFC 9110 Section 6.3, responses with status codes 204 (No Content), 304 (Not Modified), and 1xx (Informational) must not contain a message body, regardless of what headers might suggest.

Fixes #25181

The HTTP client would hang when trying to read a response body for
204 No Content responses with keep-alive connections. This is because
the client incorrectly attempted to read a body based solely on the
request method, without considering the response status code.

Per RFC 9110 Section 6.3, responses with status codes 204 (No Content),
304 (Not Modified), and 1xx (Informational) must not contain a message
body, regardless of what headers might suggest.

Fixes ziglang#25181
@andrewrk
andrewrk self-requested a review September 18, 2025 02:50
@andrewrk

andrewrk commented Sep 18, 2025

Copy link
Copy Markdown
Member

Thanks for the additional test case. Bookmarking this for a morning when I've a fresh mind.

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

Successfully merging this pull request may close these issues.

HTTP client hangs trying to read a response body of 204 No Content

2 participants