Commit Graph

81 Commits

Author SHA1 Message Date
Tim Perry 4cd8e1914a http2: add raw header array support to h2Session.request()
This also notably changes error handling for request(). Previously some
invalid header values (but not all) would cause the session to be
unnecessarily destroyed automatically, e.g. passing an unparseable
header name to request(). This is no longer the case: header validation
failures will throw an error, but will not destroy the session or emit
'error' events.

PR-URL: https://github.com/nodejs/node/pull/57917
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2025-04-26 09:27:27 -07:00
jakecastelli 10cff7b33d
quic: fix debug log
PR-URL: https://github.com/nodejs/node/pull/57689
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2025-04-03 10:36:56 +00:00
James M Snell 85c0f7aef3 lib: fixup more incorrect ERR_INVALID_ARG_VALUE uses
PR-URL: https://github.com/nodejs/node/pull/57177
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2025-02-24 23:23:32 +00:00
James M Snell 062ae6f3cb src, quic: refine more of the quic implementation
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/56328
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-01-06 10:47:36 -08:00
James M Snell 4cf6fabce2 quic: update more QUIC implementation
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/55986
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2024-11-28 09:53:50 -08:00
James M Snell 3511c5c831 quic: multiple updates to quic impl
* separate stats and symbols into separate files
* quic: rename `EndpointStats` and `SessionStats` to be consistent
  * s/EndpointStats/QuicEndpointStats/
  * s/SessionStats/QuicSessionStats/
* separate state into separate files and other cleanups
* extend tls options validations
* rename classes for consistency and other cleanups

PR-URL: https://github.com/nodejs/node/pull/55971
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2024-11-25 16:21:20 -08:00
James M Snell cdae315706 quic: start adding in the internal quic js api
While the external API for QUIC is expected to be
the WebTransport API primarily, this provides the
internal API for QUIC that aligns with the native
C++ QUIC components.

PR-URL: https://github.com/nodejs/node/pull/53256
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2024-09-29 11:41:03 -07:00
James M Snell c3d6d50309
quic: remove quic
PR-URL: https://github.com/nodejs/node/pull/37067
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2021-01-30 07:49:28 -08:00
ZiJian Liu 064a7070c7 lib: refactor to use validateFunction
add validateFunction and refactor to use validateFunction

PR-URL: https://github.com/nodejs/node/pull/37045
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-01-27 20:46:54 +02:00
ZiJian Liu 0e7e91f397 quic: remove duplicate checks
PR-URL: https://github.com/nodejs/node/pull/37017
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-01-23 04:19:01 -08:00
ZiJian Liu 4905501741 quic,timers: refactor to use validateAbortSignal
PR-URL: https://github.com/nodejs/node/pull/36604
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2020-12-27 06:37:30 -08:00
Antoine du Hamel 866b1e67cc quic: refactor to use more primordials
PR-URL: https://github.com/nodejs/node/pull/36211
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-11-25 05:24:28 -08:00
Leko cef144421c tools: add new ESLint rule: prefer-primordials
I added a new custom ESLint rule to fix these problems.

We have a lot of replaceable codes with primordials.
Accessing built-in objects is restricted by existing rule
(no-restricted-globals), but accessing property in the built-in objects
is not restricted right now. We manually review codes that can be
replaced by primordials, but there's a lot of code that actually needs
to be fixed. We have often made pull requests to replace the primordials
with.

Restrict accessing global built-in objects such as `Promise`.
Restrict calling static methods such as `Array.from` or `Symbol.for`.
Don't restrict prototype methods to prevent false-positive.

PR-URL: https://github.com/nodejs/node/pull/35448
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
2020-11-07 18:28:14 +08:00
Rich Trott 186230527b quic: fix error message on invalid connection ID
If Buffer.from() throws, it does not return a value, so the error
message is always going to report `undefined`. Use the value passed to
Buffer.from() instead.

PR-URL: https://github.com/nodejs/node/pull/35026
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-09-04 22:09:07 -07:00
Rich Trott e5116b304f quic: remove unused function arguments
validateTransportParams() only takes (and only uses) one argument.

PR-URL: https://github.com/nodejs/node/pull/35010
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-09-03 19:54:10 -07:00
Rich Trott 449f73e05f quic: remove undefined variable
The `reason` variable never gets defined. It's use in a template string
will always end up as the string `'undefined'`.

PR-URL: https://github.com/nodejs/node/pull/35007
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2020-09-03 05:25:06 -07:00
James M Snell c855c3e8ca quic: use net.BlockList for limiting access to a QuicSocket
PR-URL: https://github.com/nodejs/node/pull/34741
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-08-17 11:31:28 -07:00
James M Snell 442968c92a quic: check setSocket natRebinding argument, extend test
PR-URL: https://github.com/nodejs/node/pull/34669
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-08-17 11:27:32 -07:00
James M Snell 10d5047a4f quic: fixup set_socket, fix skipped test
PR-URL: https://github.com/nodejs/node/pull/34669
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-08-17 11:27:30 -07:00
James M Snell 344c5e4e50 quic: limit push check to http/3
PR-URL: https://github.com/nodejs/node/pull/34655
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-08-17 11:23:28 -07:00
James M Snell 34165f03aa quic: resolve some minor TODOs
PR-URL: https://github.com/nodejs/node/pull/34655
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-08-17 11:23:25 -07:00
Anna Henningsen ba5c64bf45 quic: use AbortController with correct name/message
On the web, `AbortError` is the error name, not the error
message. Change the code to match that.

PR-URL: https://github.com/nodejs/node/pull/34763
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-08-15 14:48:05 -07:00
James M Snell 5b6cd6fa1a quic: use the SocketAddressLRU to track validation status
PR-URL: https://github.com/nodejs/node/pull/34618
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-08-10 07:52:09 -07:00
James M Snell 6b0b33cd4c quic: cleanup some outstanding todo items
PR-URL: https://github.com/nodejs/node/pull/34618
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-08-10 07:52:01 -07:00
James M Snell 6e65f26b73 quic: use QuicCallbackScope consistently for QuicSession
PR-URL: https://github.com/nodejs/node/pull/34541
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
2020-08-03 12:03:06 +00:00
James M Snell 4b0275ab87 quic: refactor clientHello
Refactor the `'clientHello'` event into a `clientHelloHandler`
configuration option and async function. Remove the addContext
API as it's not needed.

PR-URL: https://github.com/nodejs/node/pull/34541
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
2020-08-03 12:03:00 +00:00
James M Snell 1f94b89309 quic: refactor ocsp to use async function rather than event/callback
PR-URL: https://github.com/nodejs/node/pull/34498
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-27 13:33:14 -07:00
James M Snell 06664298fa quic: remove no-longer relevant TODO statements
PR-URL: https://github.com/nodejs/node/pull/34498
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-27 13:33:12 -07:00
James M Snell 2fb92f4cc6 quic: remove extraneous unused debug property
PR-URL: https://github.com/nodejs/node/pull/34498
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-27 13:33:10 -07:00
James M Snell b06fe33de1 quic: use async _construct for QuicStream
PR-URL: https://github.com/nodejs/node/pull/34351
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-23 06:52:59 -07:00
James M Snell 086c916997 quic: extensive refactoring of QuicStream lifecycle
This one was a bit of a rabbit hole... but, with this set of
changes, `QuicStream` should now work with autoDestroy, supports
a promisified `close()`, and fixes a number of other internal
bugs that were spotted trying to get it to work.

PR-URL: https://github.com/nodejs/node/pull/34351
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-23 06:52:53 -07:00
James M Snell 83bf0d7e8c quic: remove unneeded quicstream.aborted and fixup docs
PR-URL: https://github.com/nodejs/node/pull/34351
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-23 06:52:47 -07:00
James M Snell a65296db2c quic: remove stream pending code
Removing no longer needed code

PR-URL: https://github.com/nodejs/node/pull/34351
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-23 06:52:45 -07:00
James M Snell da20287e1a quic: simplify QuicStream construction logic
PR-URL: https://github.com/nodejs/node/pull/34351
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-23 06:52:42 -07:00
James M Snell 6e30fe7a7f quic: convert openStream to Promise
Although most of the time openStream will be able to create the stream
immediately, when a stream is opened before the handshake is complete
we have to wait for the handshake to be complete before continuing.

PR-URL: https://github.com/nodejs/node/pull/34351
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-23 06:52:40 -07:00
James M Snell ed4882241c quic: properly pass readable/writable constructor options
PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-15 17:17:04 -07:00
James M Snell 57c1129508 quic: implement QuicSession close as promise
PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-15 17:17:01 -07:00
James M Snell 8e5c5b16ab quic: cleanup QuicClientSession constructor
PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-15 17:16:59 -07:00
James M Snell fe4e7e4598 quic: use promisified dns lookup
PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-15 17:16:57 -07:00
James M Snell 346aeaf874 quic: eliminate "ready"/"not ready" states for QuicSession
QuicClientSession and QuicServerSessions are now always immediately
ready for use when they are created, so no more need to track
ready state.

PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-15 17:16:55 -07:00
James M Snell 6665dda9f6 quic: implement QuicSocket Promise API, part 2
PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-15 17:16:52 -07:00
James M Snell 79c0e892dd quic: implement QuicSocket Promise API, part 1
PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-15 17:16:50 -07:00
James M Snell 53b12f0c7b quic: implement QuicEndpoint Promise API
This is the start of a conversion over to a fully Promise-centric API
for the QUIC implementation.

PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-15 17:16:48 -07:00
James M Snell 16b32eae3e quic: handle unhandled rejections on QuicSession
PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-15 17:16:45 -07:00
James M Snell e5d963e24d quic: fixup kEndpointClose
Ensure that the QuicSocket is properly destroyed if the QuicEndpoint
is destroyed directly rather than through QuicSocket destroy

PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-15 17:16:43 -07:00
James M Snell 9f552df5b4 quic: fix endpointClose error handling, document
PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-15 17:16:41 -07:00
James M Snell b80108c033 quic: restrict addEndpoint to before QuicSocket bind
Restricting this to pre-bind keeps things simple

PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-15 17:16:39 -07:00
James M Snell 81c01bbdba quic: use a getter for stream options
Doesn't need to be a function

PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-15 17:16:37 -07:00
James M Snell b8945ba2ab quic: clarifying code comments
PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-15 17:16:35 -07:00
James M Snell 429ab1dce6 quic: minor reduction in code duplication
PR-URL: https://github.com/nodejs/node/pull/34283
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-07-15 17:16:32 -07:00