You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
docs: record the 204/304 Content-Length divergence from upstream - #138
Closes#111. Documents the fork's deliberate 204/304 Content-Length behavior and links the parser comments and existing regressions to that decision.
For responses to non-HEAD requests without Transfer-Encoding, when reuse is otherwise allowed:
A 304 with nonzero Content-Length succeeds and permits connection reuse; bytes after its headers are parsed as the next pipelined response.
A 204 with nonzero Content-Length fails with ResponseContentLengthMismatchError.
Upstream nodejs/undici#5864 instead accepts both responses and closes their connections.
The README separately states that non-HEAD 204/304 responses carrying Transfer-Encoding close the connection. The table's qualification excludes HEAD's default reset and the Transfer-Encoding close guard. Runtime behavior is preserved.
Validation on exact head 5809d5bf561fbe13254671a78fd8ca53003299a8:
macOS Node.js 26.7.0 and Linux/amd64 Node.js 26.11.1: 889 unit tests passed, two skipped; all 163 node-test tests passed.
TypeScript declaration tests and ESLint passed on both platforms.
Package dry-run and git diff --check passed locally.
Linux ran in a disposable container on root@tv2k-srv4.bmux, limited to two CPUs, 2 GiB and 512 processes, using nxtedition/node@sha256:a56a3f12c2bd3572cef35f9dc6c4637cff970f6a8d70e049098cf44841dd7a75.
This client deliberately keeps a 304's connection when the response
carries Content-Length, parses bytes after a 304 as the next pipelined
response, and rejects a 204 with a non-zero Content-Length (RFC 9110
§8.6, RFC 9112 §6.3). Upstream undici's nodejs#5864 closes the
connection in the first two cases and accepts the third.
Document that in README.md, and point the code and the tests that pin
it at that section, so a future upstream audit doesn't reopen it.
nodejs#5864 also resets the parsed length for HEAD/204/304. That isn't needed
here: nxtedition#136's hasCompleteBody() covers the paused/reset case, the HEAD
and 304 checks in onMessageComplete() already ignore the length, and a
stale length could only change the error type of a request already
aborted from onHeaders().
Closesnxtedition#111.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Table overgeneralizes outcomes across request and response conditions
README.md:17
The table states these outcomes for all requests, but they depend on the request and response headers. onMessageComplete() skips the length-mismatch check for HEAD, so a HEAD 204 with a non-zero Content-Length does not fail; HEAD also normally resets its connection, so the 304 reuse and pipelining claims do not hold by default. For non-HEAD 304s, onHeadersComplete() closes the connection when Transfer-Encoding is present, as the paragraph below notes. Limit the 304 rows to non-HEAD responses without Transfer-Encoding, and the 204 row to non-HEAD requests.
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
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.
Closes #111. Documents the fork's deliberate 204/304 Content-Length behavior and links the parser comments and existing regressions to that decision.
For responses to non-HEAD requests without Transfer-Encoding, when reuse is otherwise allowed:
The README separately states that non-HEAD 204/304 responses carrying Transfer-Encoding close the connection. The table's qualification excludes HEAD's default reset and the Transfer-Encoding close guard. Runtime behavior is preserved.
Validation on exact head
5809d5bf561fbe13254671a78fd8ca53003299a8:git diff --checkpassed locally.root@tv2k-srv4.bmux, limited to two CPUs, 2 GiB and 512 processes, usingnxtedition/node@sha256:a56a3f12c2bd3572cef35f9dc6c4637cff970f6a8d70e049098cf44841dd7a75.