Skip to content

node:http: don't leave the server socket Duplex corked across kept-alive requests - #35664

Closed
robobun wants to merge 8 commits into
mainfrom
farm/9db0935b/fix-connect-corked-socket
Closed

robobun wants to merge 8 commits into
mainfrom
farm/9db0935b/fix-connect-corked-socket

lint: read _writableState once in ServerResponse.end

ef4471e
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 25, 2026 in 23m 8s

Code review found 1 important issue

Found 1 candidates, confirmed 2. See review comments for details.

Details

Severity Count
🔴 Important 1
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/js/node/_http_server.ts:3229-3235 ServerResponse.end uncorks via req.socket, which stream.pipeline nulls

Annotations

Check warning on line 3235 in src/js/node/_http_server.ts

See this annotation in the file changed.

@claude claude / Claude Code Review

ServerResponse.end uncorks via req.socket, which stream.pipeline nulls

The new uncork block reads the connection via `req?.socket`, but `stream.pipeline`/`compose`'s destroyer nulls `req.socket` for server IncomingMessages (destroy.ts:311-313), while `res.cork()` corked via `this.socket` — so after `res.cork(); stream.pipeline(req, sink, () => res.end())` the uncork is silently skipped. `emitResponseFinish` at line 2459 already handles exactly this case with `this.req?.socket ?? this.socket` (and Node's `OutgoingMessage.end` uncorks via `this.socket`, not `req.sock