GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — http2: add callback to informational header methods by inoway46 · Pull Request #67470 · nodejs/node

Conversation

@inoway46

@inoway46 inoway46 commented Nov 14, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This adds an optional callback to http2stream.additionalHeaders() and to the compat writeContinue(), writeEarlyHints() and writeInformation(). As in HTTP/1, it is called once the informational headers have been written to the socket, or with an error if they could not be written. Until now the compat methods ignored the callback.

Without the callback, there is no reliable way to send Early Hints before starting blocking work. With a handler that sends hints and then renders for 500 ms, the client receives:

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.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot

nodejs-github-bot commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/http2
  • @nodejs/net
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. http2 Issues and PRs related to the http2 subsystem. needs-ci PRs that need a full CI run. labels Nov 14, 2026
@inoway46
inoway46 force-pushed the http2-write-continue-callback branch 4 times, most recently from be273bf to cfa6762 Compare November 14, 2026 18:22
@inoway46 inoway46 added the semver-minor PRs that contain new features and should be released in the next minor version. label Nov 14, 2026
@inoway46
inoway46 marked this pull request as ready for review November 14, 2026 18:25
@codecov

codecov Bot commented Nov 14, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.12346% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.67%. Comparing base (2e59a6d) to head (2af555e).
⚠️ Report is 111 commits behind head on main.

Files with missing lines Patch % Lines
src/node_http2.cc 81.39% 4 Missing and 4 partials ⚠️
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     
Files with missing lines Coverage Δ
lib/internal/http2/compat.js 97.26% <100.00%> (+<0.01%) ⬆️
lib/internal/http2/core.js 94.97% <100.00%> (+0.03%) ⬆️
src/node_http2.h 93.30% <ø> (ø)
src/node_http2.cc 82.04% <81.39%> (-0.03%) ⬇️

... and 39 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@inoway46
inoway46 force-pushed the http2-write-continue-callback branch 3 times, most recently from 2f29fbb to a24bd18 Compare November 15, 2026 16:35
@inoway46 inoway46 mentioned this pull request Nov 15, 2026
doc: fix http response.writeInformation() signature #67492
Merged
@inoway46
http2: add callback to informational header methods
2af555e
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
@inoway46
inoway46 force-pushed the http2-write-continue-callback branch from a24bd18 to 2af555e Compare November 16, 2026 01:09
Ethan-Arrowood
Ethan-Arrowood approved these changes Nov 17, 2026
View reviewed changes

@Ethan-Arrowood Ethan-Arrowood left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excellent work. LGTM!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

inoway46 reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@Ethan-Arrowood Ethan-Arrowood added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 17, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 17, 2026
@nodejs-github-bot

nodejs-github-bot commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/79225/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@inoway46 inoway46 added the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Nov 18, 2026
@github-actions github-actions Bot removed the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Nov 18, 2026
@nodejs-github-bot

nodejs-github-bot commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/79233/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@inoway46 inoway46 added the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Nov 18, 2026
@github-actions github-actions Bot removed the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Nov 18, 2026
@nodejs-github-bot

nodejs-github-bot commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/79234/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@inoway46 inoway46 added author ready PRs with CI started, the required approvals, and no outstanding review comments. and removed needs-ci PRs that need a full CI run. labels Nov 18, 2026
pimterry
pimterry approved these changes Nov 19, 2026
View reviewed changes
@pimterry pimterry added the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 19, 2026
@nodejs-github-bot
nodejs-github-bot merged commit f442b5a into nodejs:main Nov 19, 2026
76 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Landed in f442b5a

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 19, 2026
aduh95 pushed a commit that referenced this pull request Nov 20, 2026
@inoway46 @aduh95
http2: add callback to informational header methods
eb78e5b
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]>
This was referenced Nov 22, 2026
doc: fix http response.writeProcessing() description #67705
Merged
http2: add writeProcessing to compat response #67728
Merged
@github-actions github-actions Bot mentioned this pull request Nov 24, 2026
2026-11-25, Version 27.0.0-alpha.0.2.0 (Alpha) #67757
Merged
nodejs-github-bot added a commit that referenced this pull request Nov 24, 2026
@nodejs-github-bot
2026-11-25, Version 27.0.0-alpha.0.2.0 (Alpha)
0296c04
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
aduh95 pushed a commit that referenced this pull request Nov 24, 2026
@nodejs-github-bot @aduh95
2026-11-25, Version 27.0.0-alpha.0.2.0 (Alpha)
9d44b49
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
@inoway46 inoway46 mentioned this pull request Nov 25, 2026
test: cover closed stream in http2 compat 1xx methods #67777
Open
aduh95 added a commit that referenced this pull request Nov 25, 2026
@aduh95
2026-11-26, Version 27.0.0-alpha.0.2.0 (Alpha)
67d9357
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
aduh95 added a commit that referenced this pull request Nov 26, 2026
@aduh95
2026-11-26, Version 27.0.0-alpha.0.2.0 (Alpha)
4325ce0
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
gabylb pushed a commit to gabylb/node that referenced this pull request Nov 27, 2026
@inoway46 @gabylb
http2: add callback to informational header methods
950fb3c
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]>
gabylb pushed a commit to gabylb/node that referenced this pull request Nov 27, 2026
@aduh95 @gabylb
2026-11-26, Version 27.0.0-alpha.0.2.0 (Alpha)
369cdc7
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pimterry pimterry pimterry approved these changes
@Ethan-Arrowood Ethan-Arrowood Ethan-Arrowood approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. http2 Issues and PRs related to the http2 subsystem. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@inoway46 @nodejs-github-bot @pimterry @Ethan-Arrowood
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.