Repository navigation
Conversation
Collaborator
|
Review requested:
|
inoway46
force-pushed
the
http2-write-continue-callback
branch
4 times, most recently
from
November 14, 2026 18:22
be273bf to
cfa6762
Compare
inoway46
marked this pull request as ready for review
November 14, 2026 18:25
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:
|
inoway46
force-pushed
the
http2-write-continue-callback
branch
3 times, most recently
from
November 15, 2026 16:35
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 <inoueyuya416@gmail.com> Assisted-by: claude:opus-5.5
inoway46
force-pushed
the
http2-write-continue-callback
branch
from
November 16, 2026 01:09
a24bd18 to
2af555e
Compare
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.
This adds an optional callback to
http2stream.additionalHeaders()and to the compatwriteContinue(),writeEarlyHints()andwriteInformation(). 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:
res.writeEarlyHints(hints); res.end(renderSync())res.writeEarlyHints(hints, () => res.end(renderSync()))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 tores.writeEarlyHints()(https://github.com/fastify/fastify/blob/main/lib/reply.js), so withhttp2: truea handler that responds from the callback never responds (reproduced with Fastify 5.12.8 on Node.js 26.13.1).