GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — http2: add callback to informational header methods by inoway46 · Pull Request #67470 · nodejs/node Conversation
|
| Server code | 103 | 200 |
|---|---|---|
res.writeEarlyHints(hints); res.end(renderSync()) |
504 ms | 505 ms |
res.writeEarlyHints(hints, () => res.end(renderSync())) |
4 ms | 505 ms |
It also fixes code that relies on the callback and currently never responds over HTTP/2. For example, Fastify's documented reply.writeEarlyHints(hints, callback) passes the callback straight to res.writeEarlyHints() (https://github.com/fastify/fastify/blob/main/lib/reply.js), so with http2: true a handler that responds from the callback never responds (reproduced with Fastify 5.12.8 on Node.js 26.13.1).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Review requested:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
be273bf to
cfa6762
Compare
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@ ## main #67470 +/- ## ========================================== - Coverage 90.67% 90.67% -0.01% ========================================== Files 799 799 Lines 280239 280313 +74 Branches 54126 54148 +22 ========================================== + Hits 254116 254167 +51 - Misses 16240 16273 +33 + Partials 9883 9873 -10
🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
2f29fbb to
a24bd18
Compare
In the HTTP/1 server, writeContinue(), writeEarlyHints() and writeInformation() accept a callback that is called once the response has been written to the socket. The HTTP/2 compat versions did not, so code moving to the compat API had its callback ignored. Accept an optional callback in http2stream.additionalHeaders() and in the three compat methods. The request for the HEADERS frame is tracked until nghttp2 serializes the frame, and completed together with the write to the underlying stream that carries it. Signed-off-by: inoway46 <[email protected]> Assisted-by: claude:opus-5.5
a24bd18 to
2af555e
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
excellent work. LGTM!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Landed in f442b5a |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
In the HTTP/1 server, writeContinue(), writeEarlyHints() and writeInformation() accept a callback that is called once the response has been written to the socket. The HTTP/2 compat versions did not, so code moving to the compat API had its callback ignored. Accept an optional callback in http2stream.additionalHeaders() and in the three compat methods. The request for the HEADERS frame is tracked until nghttp2 serializes the frame, and completed together with the write to the underlying stream that carries it. Signed-off-by: inoway46 <[email protected]> Assisted-by: claude:opus-5.5 PR-URL: #67470 Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Tim Perry <[email protected]>
Notable changes: doc: * swap `util.TextDecoder` and `util.TextEncoder` with globals (LiviaMedeiros) #67461 * use global `TextDecoder` and `TextEncoder` instead of `util` (LiviaMedeiros) #67461 * deprecate `util.TextDecoder` and `util.TextEncoder` (LiviaMedeiros) #67461 http2: * (SEMVER-MINOR) add missing setHeaders (jakecastelli) #67597 * (SEMVER-MINOR) add callback to informational header methods (Yuya Inoue) #67470 lib: * (SEMVER-MINOR) graduate the --process-timeout option (James M Snell) #67506 module: * remove async module customization hooks (Geoffrey Booth) #67090 os: * (SEMVER-MINOR) expose `guessFileDescriptorType` (Vlad Frangu) #58060 sqlite: * mark as stable (Christian Aurich Zanettini Martins) #67654 src: * (SEMVER-MINOR) restore tty state on exit only if changed (Matteo Collina) #66753 test: * update Intl tests for CLDR 49 (Renegade334) #66992 * remove unnecessary imports for `TextDecoder` and `TextEncoder` (LiviaMedeiros) #67461 tls: * (SEMVER-MINOR) docs-deprecate TLS renegotiation, add allowRenegotiation opt-in (Tim Perry) #67532 PR-URL: #67757
Notable changes: doc: * deprecate `util.TextDecoder` and `util.TextEncoder` (LiviaMedeiros) #67461 http2: * (SEMVER-MINOR) add missing setHeaders (jakecastelli) #67597 * (SEMVER-MINOR) add callback to informational header methods (Yuya Inoue) #67470 lib: * (SEMVER-MINOR) graduate the `--process-timeout` option (James M Snell) #67506 module: * remove async module customization hooks (Geoffrey Booth) #67090 os: * (SEMVER-MINOR) expose `guessFileDescriptorType` (Vlad Frangu) #58060 sqlite: * mark as stable (Christian Aurich Zanettini Martins) #67654 src: * (SEMVER-MINOR) restore tty state on exit only if changed (Matteo Collina) #66753 tls: * (SEMVER-MINOR) docs-deprecate TLS renegotiation, add allowRenegotiation opt-in (Tim Perry) #67532 PR-URL: #67757
Notable changes: doc: * deprecate `util.TextDecoder` and `util.TextEncoder` (LiviaMedeiros) #67461 http2: * (SEMVER-MINOR) add writeProcessing to compat response (Yuya Inoue) #67728 * (SEMVER-MINOR) add missing setHeaders (jakecastelli) #67597 * (SEMVER-MINOR) add callback to informational header methods (Yuya Inoue) #67470 lib: * (SEMVER-MINOR) graduate the --process-timeout option (James M Snell) #67506 os: * (SEMVER-MINOR) expose `guessFileDescriptorType` (Vlad Frangu) #58060 sqlite: * (SEMVER-MINOR) throw ERR_NO_SQLITE without SQLite support (Christian Aurich Zanettini Martins) #67727 * (SEMVER-MINOR) add statement.columnCount getter (Guilherme Araújo) #67658 * mark as stable (Christian Aurich Zanettini Martins) #67654 src: * (SEMVER-MINOR) expand --process-timeout output to include workers (James M Snell) #67712 * (SEMVER-MINOR) restore tty state on exit only if changed (Matteo Collina) #66753 tls: * (SEMVER-MINOR) docs-deprecate TLS renegotiation, add allowRenegotiation opt-in (Tim Perry) #67532 PR-URL: #67757
Notable changes: doc: * deprecate `util.TextDecoder` and `util.TextEncoder` (LiviaMedeiros) #67461 http2: * (SEMVER-MINOR) add writeProcessing to compat response (Yuya Inoue) #67728 * (SEMVER-MINOR) add missing setHeaders (jakecastelli) #67597 * (SEMVER-MINOR) add callback to informational header methods (Yuya Inoue) #67470 lib: * (SEMVER-MINOR) graduate the --process-timeout option (James M Snell) #67506 os: * (SEMVER-MINOR) expose `guessFileDescriptorType` (Vlad Frangu) #58060 sqlite: * (SEMVER-MINOR) throw ERR_NO_SQLITE without SQLite support (Christian Aurich Zanettini Martins) #67727 * (SEMVER-MINOR) add statement.columnCount getter (Guilherme Araújo) #67658 * mark as stable (Christian Aurich Zanettini Martins) #67654 src: * (SEMVER-MINOR) expand --process-timeout output to include workers (James M Snell) #67712 * (SEMVER-MINOR) restore tty state on exit only if changed (Matteo Collina) #66753 tls: * (SEMVER-MINOR) docs-deprecate TLS renegotiation, add allowRenegotiation opt-in (Tim Perry) #67532 PR-URL: #67757
In the HTTP/1 server, writeContinue(), writeEarlyHints() and writeInformation() accept a callback that is called once the response has been written to the socket. The HTTP/2 compat versions did not, so code moving to the compat API had its callback ignored. Accept an optional callback in http2stream.additionalHeaders() and in the three compat methods. The request for the HEADERS frame is tracked until nghttp2 serializes the frame, and completed together with the write to the underlying stream that carries it. Signed-off-by: inoway46 <[email protected]> Assisted-by: claude:opus-5.5 PR-URL: nodejs#67470 Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Tim Perry <[email protected]>
Notable changes: doc: * deprecate `util.TextDecoder` and `util.TextEncoder` (LiviaMedeiros) nodejs#67461 http2: * (SEMVER-MINOR) add writeProcessing to compat response (Yuya Inoue) nodejs#67728 * (SEMVER-MINOR) add missing setHeaders (jakecastelli) nodejs#67597 * (SEMVER-MINOR) add callback to informational header methods (Yuya Inoue) nodejs#67470 lib: * (SEMVER-MINOR) graduate the --process-timeout option (James M Snell) nodejs#67506 os: * (SEMVER-MINOR) expose `guessFileDescriptorType` (Vlad Frangu) nodejs#58060 sqlite: * (SEMVER-MINOR) throw ERR_NO_SQLITE without SQLite support (Christian Aurich Zanettini Martins) nodejs#67727 * (SEMVER-MINOR) add statement.columnCount getter (Guilherme Araújo) nodejs#67658 * mark as stable (Christian Aurich Zanettini Martins) nodejs#67654 src: * (SEMVER-MINOR) expand --process-timeout output to include workers (James M Snell) nodejs#67712 * (SEMVER-MINOR) restore tty state on exit only if changed (Matteo Collina) nodejs#66753 tls: * (SEMVER-MINOR) docs-deprecate TLS renegotiation, add allowRenegotiation opt-in (Tim Perry) nodejs#67532 PR-URL: nodejs#67757
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.