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

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

Merged
merged 2 commits into from
May 26, 2023

Conversation

mcollina
Copy link
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
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net

@nodejs-github-bot nodejs-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
@@ -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.
Copy link
Member Author

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 added the request-ci Add this label to start a Jenkins CI on a PR. label May 21, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 21, 2023
@nodejs-github-bot
Copy link
Collaborator

…-headers.js

Co-authored-by: cjihrig <cjihrig@gmail.com>
@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label May 22, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 22, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@gerrard00
Copy link
Contributor

Appreciate the fix, sorry for not catching that.

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

Copy link
Member

@ronag ronag left a 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.

@mcollina
Copy link
Member Author

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
Member Author

(@ronag you did not approve this PR)

@ronag
Copy link
Member

ronag commented May 26, 2023

@mcolline approved

@mcollina mcollina 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-bot nodejs-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:main May 26, 2023
@nodejs-github-bot
Copy link
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>
@targos targos 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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants