Title: HTTP Upgrade IncomingMessage does not parse body · Issue #58394 · nodejs/node · GitHub
Open Graph Title: HTTP Upgrade IncomingMessage does not parse body · Issue #58394 · nodejs/node
X Title: HTTP Upgrade IncomingMessage does not parse body · Issue #58394 · nodejs/node
Description: Version 22.15.0 Platform Linux Subsystem http What steps will reproduce the bug? 'use strict'; const { createServer, request } = require('http'); createServer((req, res) => { res.writeHead(200).end(); }).on('upgrade', (req, reqSocket, he...
Open Graph Description: Version 22.15.0 Platform Linux Subsystem http What steps will reproduce the bug? 'use strict'; const { createServer, request } = require('http'); createServer((req, res) => { res.writeHead(200).end...
X Description: Version 22.15.0 Platform Linux Subsystem http What steps will reproduce the bug? 'use strict'; const { createServer, request } = require('http'); createServer((req, res) => { res...
Opengraph URL: https://github.com/nodejs/node/issues/58394
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"HTTP Upgrade IncomingMessage does not parse body","articleBody":"### Version\n\n22.15.0\n\n### Platform\n\n```text\nLinux\n```\n\n### Subsystem\n\nhttp\n\n### What steps will reproduce the bug?\n\n```js\n'use strict';\n\nconst { createServer, request } = require('http');\n\ncreateServer((req, res) =\u003e {\n res.writeHead(200).end();\n}).on('upgrade', (req, reqSocket, head) =\u003e {\n console.log('Server Upgrade', req.headers);\n let buf = '';\n req.on('data', (str) =\u003e buf += str);\n req.on('close', () =\u003e {\n console.log(\n 'Request close',\n 'data', JSON.stringify(buf.trim()),\n 'head', Buffer.from(head)\n );\n });\n req.setEncoding('utf8');\n}).listen(0, '127.0.0.1', function() {\n const req = request({\n host: '127.0.0.1',\n port: this.address().port,\n method: 'POST',\n path: '/foo',\n headers: {\n Connection: 'Upgrade',\n Upgrade: 'db',\n },\n });\n req.on('upgrade', (res, socket, head) =\u003e {\n console.log(\n 'Client Upgrade',\n 'status', res.statusCode,\n 'head', Buffer.from(head)\n );\n });\n setTimeout(() =\u003e {\n req.write('2');\n setTimeout(() =\u003e req.end(), 1000);\n }, 1000);\n});\n```\n\nOutput:\n```\nServer Upgrade { \n connection: 'Upgrade', \n upgrade: 'db', \n host: '127.0.0.1:39511', \n 'transfer-encoding': 'chunked' \n} \nRequest close data \"\" head \u003cBuffer 31 0d 0a 32 0d 0a\u003e\n```\n\n### How often does it reproduce? Is there a required condition?\n\nReproduces every time.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nThe expected behavior is to have node parse the body like it normally would.\n\n### What do you see instead?\n\nNode ignores the content or potentially puts some of it (unparsed -- especially evident in the case of a chunked encoded body) in the `head` argument passed to the `'upgrade'` event.\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/mscdex","@type":"Person","name":"mscdex"},"datePublished":"2025-05-19T17:06:04.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/58394/node/issues/58394"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:61d81eb6-2d01-b213-ed02-7414e1844f90 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C908:281B19:1F8B022:2D9C88E:6A4D0603 |
| html-safe-nonce | 0a765559ebbedac3d082e195d3d6a65e11bc1726495fabaa43e88fcae888c16d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOTA4OjI4MUIxOToxRjhCMDIyOjJEOUM4OEU6NkE0RDA2MDMiLCJ2aXNpdG9yX2lkIjoiNzk0MDIyNjY2NjA1NTE0MDg2OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | cb5d48b56d2a223d2f670d5ce3e2721af1a8e1e15b304b64319ef8f13f41bd8b |
| hovercard-subject-tag | issue:3074500335 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/58394/issue_layout |
| twitter:image | https://opengraph.githubassets.com/527f40868c9c93696e8d0b2665da5cb5fd0cb7cea2ea64e7592923c5cb4cf738/nodejs/node/issues/58394 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/527f40868c9c93696e8d0b2665da5cb5fd0cb7cea2ea64e7592923c5cb4cf738/nodejs/node/issues/58394 |
| og:image:alt | Version 22.15.0 Platform Linux Subsystem http What steps will reproduce the bug? 'use strict'; const { createServer, request } = require('http'); createServer((req, res) => { res.writeHead(200).end... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mscdex |
| hostname | github.com |
| expected-hostname | github.com |
| None | 31e4db13a9e20081f2fac78f441659a6576e582bbb15e153f9c7fb6473aa29f5 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fb70bd3c4b2bec429781b65419e912c66e2d5581 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width