Skip to content

http.ServerResponse#sendDate makes overly definitive claim about HTTP standards #42619

Description

@wolfgang42

Affected URL(s)

https://nodejs.org/docs/latest-v16.x/api/http.html#responsesenddate

Description of the problem

From the docs on this parameter:

This should only be disabled for testing; HTTP requires the Date header in responses.

However, the story seems to be a bit more complicated than that; RFC 7231 has a rather dense paragraph which can be summarized as:

  • Server MUST NOT send Date if it doesn't have a suitable clock
  • Server MAY send Date for 1xx or 5xx statuses
  • Server MUST send Date otherwise (i.e. it has a clock and is sending 2/3/4xx)

This note appears to have been added along with the setting itself in 1e425e3, which doesn't provide any insight on where this claim originated.

I'm not an expert on either Node or HTTP, but it seems like maybe the docs should be updated to something like the below?

This should generally be left enabled; the Date header is mandatory in most cases. (See RFC 7231 for details.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to Node.js documentation.httpIssues and PRs related to the http subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions