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

strict content length does not apply if content length header is set after body #46602

Closed
ronag opened this issue Feb 10, 2023 · 4 comments
Closed
Labels
confirmed-bug Issues with confirmed bugs. help wanted Issues that need assistance from volunteers or PRs that need help to proceed. http Issues or PRs related to the http subsystem.

Comments

@ronag
Copy link
Member

ronag commented Feb 10, 2023

If the content length is set after data has been written to the OutgoingMessage, but before headers have been flushed, then the strict content length check is bypassed.

@ronag ronag added confirmed-bug Issues with confirmed bugs. help wanted Issues that need assistance from volunteers or PRs that need help to proceed. http Issues or PRs related to the http subsystem. labels Feb 10, 2023
@marco-ippolito
Copy link
Member

marco-ippolito commented Feb 10, 2023

I can work on this

@marco-ippolito
Copy link
Member

this is the pr where res.strictContentLength the #44378 but it has not been documented in http.md. I'll add it

@marco-ippolito
Copy link
Member

@ronag could you please provide an example? I'm not sure how to set headers after a res.write since it will always throw ERR_HTTP_HEADERS_SENT

@ronag
Copy link
Member Author

ronag commented Feb 13, 2023

You are right. My mistake.

@ronag ronag closed this as completed Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. help wanted Issues that need assistance from volunteers or PRs that need help to proceed. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

No branches or pull requests

2 participants