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:
|
| 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.
This was a spurious change introduced by the previous PR.
β¦-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 |
ronag
left a comment
There was a problem hiding this comment.
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.