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

HTTP does not allow content for 204 anymore #36146

Open
JannisBush opened this issue Oct 1, 2024 · 4 comments · May be fixed by #37928
Open

HTTP does not allow content for 204 anymore #36146

JannisBush opened this issue Oct 1, 2024 · 4 comments · May be fixed by #37928
Assignees
Labels
Content:HTTP HTTP docs help wanted If you know something about this topic, we would love your help!

Comments

@JannisBush
Copy link
Contributor

MDN URL

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204

What specific section or headline is this issue about?

Compatibility notes

What information was incorrect, unhelpful, or incomplete?

The HTTP protocol allows browsers to handle such responses differently (there is an ongoing discussion regarding the specification text in the HTTPWG http-core GitHub repository).

What did you expect to see?

The issue was closed with the most recent HTTP specifications that now do not allow any content (except CRLF?) for 204 anymore, if I understood the spec correctly.

Do you have any supporting links, references, or citations?

httpwg/http-core#26

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@JannisBush JannisBush added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Oct 1, 2024
@github-actions github-actions bot added the Content:HTTP HTTP docs label Oct 1, 2024
@Josh-Cena Josh-Cena changed the title HTTP Protocal does not allow content for 204 anymore HTTP does not allow content for 204 anymore Oct 1, 2024
@Josh-Cena Josh-Cena added help wanted If you know something about this topic, we would love your help! and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Oct 1, 2024
@bsmth
Copy link
Member

bsmth commented Nov 29, 2024

Thanks for raising this one. You are right in saying that there should be no content. The specs have been more and more consistent / explicit, as far as I see, in saying 204 (No Content) doesn't have a message body( and doesn't have a Content-Length: 0, either).

From RFC9110:

A 204 response is terminated by the end of the header section; it cannot contain content or trailers.

The note at the end of the MDN page is covering unspecified behavior, essentially: what browsers have done when they receive malformed responses. Sending garbage data as a message body in 204 responses may have happened in buggy server software versions in the past, possibly due to compression configuration. I'm not sure if that info really belongs on the article itself, though, as this might not be useful for readers.

@bsmth
Copy link
Member

bsmth commented Dec 17, 2024

See also some context how this landed on these pages: https://bugzilla.mozilla.org/show_bug.cgi?id=1356614

@hamishwillee
Copy link
Collaborator

@bsmth Might be worth you assigning yourself the issue, given your other work in the area?

@bsmth bsmth self-assigned this Dec 20, 2024
@bsmth
Copy link
Member

bsmth commented Dec 20, 2024

I already started to draft some changes earlier in the week, so what I think we need is:

@bsmth bsmth linked a pull request Feb 3, 2025 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:HTTP HTTP docs help wanted If you know something about this topic, we would love your help!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants