Repository navigation
feat(ext/node): select how OutgoingMessage#end() delivers finish per runtime - #36
Merged
Merged
Conversation
…runtime Node.js 24.21 and 26.8 (nodejs/node#65466) attach 'finish' to the final chunk of end(data) when that chunk can be the last write. Earlier releases write the chunk and then send a separate empty write that carries 'finish'. The socket sees one write in the new contract and two in the old one. Add HttpOutgoingEndPolicy so that an embedder can select the contract of the Node.js release that it targets. The default stays SeparateFinishWrite, which matches the Node.js release that Deno reports.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Node.js 24.21 and 26.8 (nodejs/node#65466) changed how
OutgoingMessage#end(data)delivers'finish'. When the chunk can be the final write,'finish'now rides on that write, and no separate empty write follows. Node.js 24.20, 26.7, and earlier send the chunk and then a separate empty write.This change adds
HttpOutgoingEndPolicyso that an embedder can select the contract of the Node.js version that it reports:SeparateFinishWrite(the default): Node.js 24.20, 26.7, and earlier. The default matches the reported Node.js v26.5.1.FinishWithFinalChunk: Node.js 24.21, 26.8, and later.The policy follows the existing pattern (
VtControlStripPolicy,BufferDetachedValidationPolicy): adeno_nodeoption, an op that JS reads at each call (snapshot safe), and positional defaults inruntime/worker.rs,runtime/web_worker.rs, andruntime/snapshot_info.rs.maybePrepareFinalChunk()in_http_outgoing.tsmirrors the Node.js guard: no final-chunk finish for a destroyed message, forstrictContentLength, for a chunked response, or for a non-string and non-Uint8Arraychunk.Tests
[node/http] end(data) sends a separate empty write for finish(default contract, two writes).test-http-server-response-standalone.jspasses under the default.FinishWithFinalChunkdefault passes the Node.js v24.21 fixture of the same test.test-http-*failure set (52 of 446, all not enabled inconfig.jsonc) is identical under both defaults.cargo test -p deno_node --lib policy(8 passed), clippy with-D warnings, rustfmt, dprint, andtools/lint.js --jsare clean.