-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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: send implicit headers on HEAD with no body #48108
http: send implicit headers on HEAD with no body #48108
Conversation
If we respond to a HEAD request with a body, we ignore all writes. However, we must still include all implicit headers. Fixes a regressions introduced in nodejs#47732. Signed-off-by: Matteo Collina <hello@matteocollina.com>
Review requested:
|
@@ -29,7 +29,7 @@ const http = require('http'); | |||
|
|||
const server = http.createServer(function(req, res) { | |||
res.writeHead(200); | |||
res.end(); | |||
res.end('FAIL'); // broken: sends FAIL from hot path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a spurious change introduced by the previous PR.
test/parallel/test-http-head-response-has-no-body-end-implicit-headers.js
Outdated
Show resolved
Hide resolved
…-headers.js Co-authored-by: cjihrig <cjihrig@gmail.com>
Appreciate the fix, sorry for not catching that. |
Commit Queue failed- Loading data for nodejs/node/pull/48108 ✔ Done loading data for nodejs/node/pull/48108 ----------------------------------- PR info ------------------------------------ Title http: send implicit headers on HEAD with no body (#48108) Author Matteo Collina (@mcollina) Branch mcollina:fix-regression-from-47732 -> nodejs:main Labels http, author ready, commit-queue-squash Commits 2 - http: send implicit headers on HEAD with no body - Update test/parallel/test-http-head-response-has-no-body-end-implicit… Committers 2 - Matteo Collina - GitHub PR-URL: https://github.com/nodejs/node/pull/48108 Reviewed-By: Colin Ihrig Reviewed-By: Robert Nagy Reviewed-By: Paolo Insogna Reviewed-By: Marco Ippolito ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/48108 Reviewed-By: Colin Ihrig Reviewed-By: Robert Nagy Reviewed-By: Paolo Insogna Reviewed-By: Marco Ippolito -------------------------------------------------------------------------------- ⚠ Commits were pushed since the last review: ⚠ - Update test/parallel/test-http-head-response-has-no-body-end-implicit… ℹ This PR was created on Sun, 21 May 2023 23:17:45 GMT ✔ Approvals: 4 ✔ - Colin Ihrig (@cjihrig) (TSC): https://github.com/nodejs/node/pull/48108#pullrequestreview-1435613010 ✔ - Robert Nagy (@ronag) (TSC): https://github.com/nodejs/node/pull/48108#pullrequestreview-1435740161 ✔ - Paolo Insogna (@ShogunPanda): https://github.com/nodejs/node/pull/48108#pullrequestreview-1435797038 ✔ - Marco Ippolito (@marco-ippolito): https://github.com/nodejs/node/pull/48108#pullrequestreview-1436063447 ✔ Last GitHub CI successful ℹ Last Full PR CI on 2023-05-24T13:41:56Z: https://ci.nodejs.org/job/node-test-pull-request/51947/ - Querying data for job/node-test-pull-request/51947/ ✔ Last Jenkins CI successful -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncuhttps://github.com/nodejs/node/actions/runs/5089120647 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but I would prefer that if kRejectNonStandardBodyWrites
is true we throw before sending headers as that can give a falls sense of success. While if kRejectNonStandardBodyWrites
false we have the previous behaviour where we ignore the body but send the headers.
I do not have time for further changes to this PR and we should fix the breaking change. Do you prefer a revert of the original PR? |
(@ronag you did not approve this PR) |
@mcolline approved |
Landed in 38b82b0 |
If we respond to a HEAD request with a body, we ignore all writes. However, we must still include all implicit headers. Fixes a regressions introduced in #47732. Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: #48108 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
If we respond to a HEAD request with a body, we ignore all writes. However, we must still include all implicit headers. Fixes a regressions introduced in #47732. Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: #48108 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
If we respond to a HEAD request with a body, we ignore all writes. However, we must still include all implicit headers. Fixes a regressions introduced in nodejs#47732. Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: nodejs#48108 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
If we respond to a HEAD request with a body, we ignore all writes. However, we must still include all implicit headers. Fixes a regressions introduced in nodejs#47732. Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: nodejs#48108 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
If we respond to a HEAD request with a body, we ignore all writes. However, we must still include all implicit headers. Fixes a regressions introduced in nodejs#47732. Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: nodejs#48108 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
If we respond to a HEAD request with a body, we ignore all writes. However, we must still include all implicit headers.
Fixes a regressions introduced in
#47732.