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

fix(http): Clarify content length in 204 responses #37928

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bsmth
Copy link
Member

@bsmth bsmth commented Feb 3, 2025

Description

The example has a Content-Length: 0 in a 204, which is not allowed:

https://datatracker.ietf.org/doc/html/rfc9110#section-8.6-8

A server MUST NOT send a Content-Length header field in any response with a status code of 1xx (Informational) or 204 (No Content).

Also removing compat info which is maybe not useful for readers. There's an interesting history behind this:

servers may erroneously include data after the headers

and browsers deviate in how lenient they are with this erroneous behavior.
The details were added to prose in https://bugzilla.mozilla.org/show_bug.cgi?id=1356614

I think we can put this in BCD, but open to reviewer feedback.

depends on:

  • TODO capture browser behavior in BCD

Related issues and pull requests

Fixes #36146

@bsmth bsmth requested a review from a team as a code owner February 3, 2025 12:01
@bsmth bsmth requested review from hamishwillee and removed request for a team February 3, 2025 12:01
@github-actions github-actions bot added Content:HTTP HTTP docs size/s [PR only] 6-50 LoC changed labels Feb 3, 2025
Copy link
Contributor

github-actions bot commented Feb 3, 2025

Preview URLs

Flaws (1)

Note! 1 document with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/HTTP/Status/205
Title: 205 Reset Content
Flaw count: 1

  • unknown:
    • No generic content config found

(comment last updated: 2025-02-18 11:53:07)

Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the spec now explicitly states that there can be no content or trailers after the headers, and that Content-Length may not be specified, this should be mentioned in the description.

Removing the compatibility notes to BCD makes sense, but only once that corresponding BCD item has merged. Can you create it?

@bsmth
Copy link
Member Author

bsmth commented Feb 5, 2025

Removing the compatibility notes to BCD makes sense, but only once that corresponding BCD item has merged. Can you create it?

Sounds good to me, I've added it as a subtask / checklist item

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:HTTP HTTP docs size/s [PR only] 6-50 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTP does not allow content for 204 anymore
2 participants