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 — quic: handle application-specific no-error codes by efekrskl · Pull Request #67094 · nodejs/node

quic: handle application-specific no-error codes #67094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
nodejs-github-bot merged 6 commits into nodejs:main from efekrskl:quic/error-mismatch
Nov 18, 2026

Uh oh!

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

Merged

quic: handle application-specific no-error codes #67094

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit Hold shift + click to select a range
2d656bb
quic: handle application-specific no-error codes
efekrskl Oct 28, 2026
b7b03a8
quic: fmt
efekrskl Oct 28, 2026
45adede
quic: revert incorrect adjustment and fix docs
efekrskl Nov 13, 2026
d8ceea3
quic: handle stop sending
efekrskl Nov 13, 2026
79b615f
quic: lint
efekrskl Nov 13, 2026
a8c0f42
quic: fix no crypto build
efekrskl Nov 16, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

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

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

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

Diff view
Diff view
Prev Previous commit
Next Next commit
quic: handle stop sending
  • Loading branch information

Uh oh!

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

@efekrskl
efekrskl committed Nov 13, 2026
commit d8ceea383244f9e4f80bc4e92b29b954d46107ec

There are no files selected for viewing

4 changes: 2 additions & 2 deletions 4 doc/api/quic.md
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3496,8 +3496,8 @@ selects how the stream's async iterator reports this:

* `'ignore'` - The truncation itself is ignored: only a stream or connection
error is reported, and any clean abort/cancellation or similar simply ends
the stream. A peer reset whose application code represents an error, a
non-zero local stop-sending, or a connection error still fails. A truncation
the stream. A peer reset or local stop-sending with an application code that
represents an error, or a connection error, still fails, but a truncation
with no error at all (an idle timeout, a graceful close, or a plain
`stopSending()`) ends the read cleanly with the data received. This matches
`stream.closed`, which rejects only on an error.
Expand Down
5 changes: 3 additions & 2 deletions 5 lib/internal/quic/quic.js
Show comments Show annotations
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@
* Called when the underlying session C++ handle is closed either normally
* or with an error.
* @param {Array} [error] Raw `[type, code, reason, errorName]` data.
* `errorName` is the symbolic name for a recognized transport error,

Check failure on line 771 in lib/internal/quic/quic.js

View workflow job for this annotation

GitHub Actions / lint-js-and-md

Expected wrap indent
* including a decoded TLS alert for CRYPTO_ERROR; otherwise undefined.
*/
onSessionClose(error) {
Expand Down Expand Up @@ -1617,6 +1617,7 @@
pendingClose: undefined,
destroyError: undefined,
stopSendingCode: undefined,
stopSendingCodeIsError: undefined,
truncatedReads: undefined,
reader: undefined,
destroying: false,
Expand Down Expand Up @@ -1729,7 +1730,7 @@

// If we cancelled ourselves, check our own stop-sending code (not the
// result mirrored by the remote peer)
if (inner.stopSendingCode > 0n) {
if (inner.stopSendingCodeIsError) {
throw new QuicError('Stream aborted before FIN was received',
{ __proto__: null,
errorCode: inner.stopSendingCode });
Expand Down Expand Up @@ -2589,7 +2590,7 @@
if (this.destroyed) return;
const abortCode = validateQuicErrorCode(code, 'code');
this.#inner.stopSendingCode = abortCode;
this.#handle.stopSending(abortCode);
this.#inner.stopSendingCodeIsError = this.#handle.stopSending(abortCode);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion 2 src/quic/application.h
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Session::Application : public MemoryRetainer {
// and is not necessarily 0.
virtual error_code GetNoErrorCode() const = 0;

// Returns whether a received application error code means "no error".
// Returns whether an application error code means "no error".
// Applications may override this when unknown codes have special semantics.
virtual bool IsNoErrorCode(error_code code) const {
return code == GetNoErrorCode();
Expand Down
4 changes: 4 additions & 0 deletions 4 src/quic/streams.cc
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,12 @@ struct Stream::Impl {
ASSIGN_OR_RETURN_UNWRAP(&stream, args.This());
CHECK(args[0]->IsBigInt());
error_code code = args[0].As<BigInt>()->Uint64Value();
const auto error = QuicError::ForApplication(code);
const bool is_error = !stream->session().IsNoError(error);

stream->SendStopSending(code);

args.GetReturnValue().Set(is_error);
}

// Sends a reset stream to the peer to tell it we will not be sending any
Expand Down
37 changes: 37 additions & 0 deletions 37 test/parallel/test-quic-h3-error-codes.mjs
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,40 @@ const decoder = new TextDecoder();
await clientSession.close();
await serverEndpoint.close();
}

// A locally sent STOP_SENDING with H3_NO_ERROR is a clean application-level
// truncation. With truncatedReads: 'ignore', the nonzero code does not fail
// the read.
{
const H3_NO_ERROR = 0x100n;

const serverEndpoint = await listen(mustCall(), {
sni: { '*': { keys: [key], certs: [cert] } },
onheaders: mustCall(),
});

const clientSession = await connect(serverEndpoint.address, {
servername: 'localhost',
verifyPeer: 'manual',
truncatedReads: 'ignore',
});
await clientSession.opened;

const stream = await clientSession.createBidirectionalStream({
headers: {
':method': 'GET',
':path': '/',
':scheme': 'https',
':authority': 'localhost',
},
});
stream.writer.endSync();

stream.stopSending(H3_NO_ERROR);
const body = await bytes(stream);
assert.strictEqual(body.byteLength, 0);
await stream.closed;

await clientSession.close();
await serverEndpoint.close();
}
Loading
Oops, something went wrong.

Uh oh!

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

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 01402792 — 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.