Skip to content

http: send implicit headers on HEAD with no body - #48108

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
mcollina:fix-regression-from-47732
May 26, 2023
Merged

http: send implicit headers on HEAD with no body#48108
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
mcollina:fix-regression-from-47732

Conversation

@mcollina

Copy link
Copy Markdown
Member

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.

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>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net

@nodejs-github-botnodejs-github-bot added http Issues or PRs related to the http subsystem. needs-ci PRs that need a full CI run. labels May 21, 2023
const server = http.createServer(function(req, res) {
res.writeHead(200);
res.end();
res.end('FAIL'); // broken: sends FAIL from hot path.

Copy link
Copy Markdown
MemberAuthor

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.

@mcollina
mcollina requested review from ShogunPanda and ronagMay 21, 2023 23:18
@mcollinamcollina added the request-ci Add this label to start a Jenkins CI on a PR. label May 21, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 21, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment threadtest/parallel/test-http-head-response-has-no-body-end-implicit-headers.js Outdated
…-headers.js
Co-authored-by: cjihrig <cjihrig@gmail.com>
@mcollinamcollina added the request-ci Add this label to start a Jenkins CI on a PR. label May 22, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 22, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@gerrard00

Copy link
Copy Markdown
Contributor

Appreciate the fix, sorry for not catching that.

@mcollinamcollina added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed needs-ci PRs that need a full CI run. labels May 26, 2023
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label May 26, 2023
@nodejs-github-botnodejs-github-bot added the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label May 26, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator
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/.ncu
https://github.com/nodejs/node/actions/runs/5089120647

@ronagronag left a comment

Copy link
Copy Markdown
Member

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.

@mcollina

Copy link
Copy Markdown
MemberAuthor

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?

@mcollina

Copy link
Copy Markdown
MemberAuthor

(@ronag you did not approve this PR)

@ronag

Copy link
Copy Markdown
Member

@MCOLLINE approved

@mcollinamcollina added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels May 26, 2023
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label May 26, 2023
@nodejs-github-bot
nodejs-github-bot merged commit 38b82b0 into nodejs:mainMay 26, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 38b82b0

@mcollina
mcollina deleted the fix-regression-from-47732 branch May 26, 2023 12:38
targos pushed a commit that referenced this pull request May 30, 2023
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>
@targostargos mentioned this pull request Jun 4, 2023
danielleadams pushed a commit that referenced this pull request Jul 6, 2023
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>
MoLow pushed a commit to MoLow/node that referenced this pull request Jul 6, 2023
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>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
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>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Aug 14, 2023
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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.commit-queue-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.httpIssues or PRs related to the http subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@mcollina@nodejs-github-bot@gerrard00@ronag@ShogunPanda@cjihrig@marco-ippolito