Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
quic: fix bug in setSNIContexts that lost ALPN config
  • Loading branch information
pimterry committed Oct 7, 2026
commit ca63d860221e13e8f601fbe4734dad0705c9ed24
6 changes: 5 additions & 1 deletion lib/internal/quic/quic.js
Original file line number Diff line number Diff line change
Expand Up @@ -4515,6 +4515,8 @@ class QuicEndpoint {
truncatedReads: undefined,
onsession: undefined,
sessionCallbacks: undefined,
// The encoded ALPN this endpoint listens with.
alpn: undefined,
};

static {
Expand Down Expand Up @@ -4823,6 +4825,7 @@ class QuicEndpoint {
} = options;

inner.truncatedReads = truncatedReads;
inner.alpn = rest.tls.alpn;

// Store session and stream callbacks to apply to each new incoming session.
inner.sessionCallbacks = {
Expand Down Expand Up @@ -5030,7 +5033,8 @@ class QuicEndpoint {
if (identity.certs === undefined) {
throw new ERR_MISSING_ARGS(`entries['${hostname}'].certs`);
}
processed[hostname] = identity;
// These identities offer the same protocols as the ones given to listen():
processed[hostname] = { __proto__: null, ...identity, alpn: this.#inner.alpn };
}

this.#handle.setSNIContexts(processed, replace);
Expand Down
5 changes: 4 additions & 1 deletion test/parallel/test-quic-sni-setcontexts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ const serverEndpoint = await listen(mustCall(async (serverSession) => {
}

endpoint.setSNIContexts(
{ '*': { keys: [key2], certs: [cert2] } },
{
'*': { keys: [key2], certs: [cert2] },
'localhost': { keys: [key2], certs: [cert2] },
},
{ replace: true },
);

Expand Down
Loading