diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md index d3af8e681917a0..51f8a326531ed4 100644 --- a/.github/SUPPORT.md +++ b/.github/SUPPORT.md @@ -16,7 +16,7 @@ resources: * [Questions tagged 'node.js' on Stack Overflow](https://stackoverflow.com/questions/tagged/node.js) * [#nodejs](https://openjs-foundation.slack.com/archives/CK9Q4MB53) channel on the OpenJS Foundation Slack ([join here](https://slack-invite.openjsf.org/)) -* [#node.js channel on chat.freenode.net](https://webchat.freenode.net?channels=node.js&uio=d4) +* [#node.js channel on libera.chat](https://web.libera.chat?channels=node.js&uio=d4) * [Node.js Slack Community](https://node-js.slack.com/) * To register: [nodeslackers.com](https://www.nodeslackers.com/) diff --git a/CHANGELOG.md b/CHANGELOG.md index b29eff0a250675..90b7ce0d1788ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,7 +38,8 @@ release. 16.0.0
-14.17.0
+14.17.1
+14.17.0
14.16.1
14.16.0
14.15.5
diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 8bd28d20b0c6ee..123e6c42f75dd2 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -3863,7 +3863,7 @@ The supplied `callback` function is called with two arguments: `err` and `derivedKey`. If an errors occurs while deriving the key, `err` will be set; otherwise `err` will be `null`. The successfully generated `derivedKey` will be passed to the callback as an {ArrayBuffer}. An error will be thrown if any -of the input aguments specify invalid values or types. +of the input arguments specify invalid values or types. ```mjs const { @@ -3911,7 +3911,7 @@ given `key`, `salt` and `info` are used with the `digest` to derive a key of The successfully generated `derivedKey` will be returned as an {ArrayBuffer}. -An error will be thrown if any of the input aguments specify invalid values or +An error will be thrown if any of the input arguments specify invalid values or types, or if the derived key cannot be generated. ```mjs diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index b9e1d90f0006a2..695d938b842189 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2502,7 +2502,7 @@ is flushed. Use [`response.writableFinished`][] or [`response.writableEnded`][] accordingly instead to avoid the ambiguity. -To maintain existing behaviour `response.finished` should be replaced with +To maintain existing behavior `response.finished` should be replaced with `response.writableEnded`. ### DEP0137: Closing fs.FileHandle on garbage collection diff --git a/doc/api/errors.md b/doc/api/errors.md index 0a2823db057977..7ac741bba68737 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -717,12 +717,16 @@ STDERR/STDOUT, and the data's length is longer than the `maxBuffer` option. ### `ERR_CLOSED_MESSAGE_PORT` @@ -1003,6 +1007,22 @@ added: v15.0.0 An attempt to invoke an unsupported crypto operation was made. + +### `ERR_DEBUGGER_ERROR` + + +An error occurred with the [debugger][]. + + +### `ERR_DEBUGGER_STARTUP_ERROR` + + +The [debugger][] timed out waiting for the required host/port to be free. + ### `ERR_DLOPEN_FAILED` > Stability: 0 - Deprecated: Use [`outgoingMessage.socket`][] instead. diff --git a/doc/api/http2.md b/doc/api/http2.md index 83b80150ade554..5c18c2663d5b6d 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -3843,7 +3843,7 @@ for instance). The compatibility API falls back to `host` if `:authority` is not present. See [`request.authority`][] for more information. However, if you don't use the compatibility API (or use `req.headers` directly), -you need to implement any fall-back behaviour yourself. +you need to implement any fall-back behavior yourself. [ALPN Protocol ID]: https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids [ALPN negotiation]: #http2_alpn_negotiation diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 58b0aedeb4f2f1..dca306b83cdede 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -5228,7 +5228,7 @@ avoid introducing causing memory leaks. However, if the `async_resource` is garbage collected by JavaScript engine before the `napi_async_context` was destroyed by `napi_async_destroy`, calling `napi_async_context` related APIs like [`napi_open_callback_scope`][] and [`napi_make_callback`][] can cause -problems like loss of async context when using the `AsyncLocalStoage` API. +problems like loss of async context when using the `AsyncLocalStorage` API. In order to retain ABI compatibility with previous versions, passing `NULL` for `async_resource` does not result in an error. However, this is not @@ -5731,7 +5731,7 @@ after receiving a return value of `napi_closing` in response to a call to `napi_threadsafe_function` can be freed in its `napi_finalize` callback which was passed to `napi_create_threadsafe_function()`. The parameter `initial_thread_count` of `napi_create_threadsafe_function` marks the initial -number of aquisitions of the thread-safe functions, instead of calling +number of acquisitions of the thread-safe functions, instead of calling `napi_acquire_threadsafe_function` multiple times at creation. Once the number of threads making use of a `napi_threadsafe_function` reaches diff --git a/doc/changelogs/CHANGELOG_V14.md b/doc/changelogs/CHANGELOG_V14.md index b479e7b56c00e9..4ffeefe14cfce1 100644 --- a/doc/changelogs/CHANGELOG_V14.md +++ b/doc/changelogs/CHANGELOG_V14.md @@ -11,6 +11,7 @@ +14.17.1
14.17.0
14.16.1
14.16.0
@@ -61,6 +62,269 @@ * [io.js](CHANGELOG_IOJS.md) * [Archive](CHANGELOG_ARCHIVE.md) + +## 2021-06-15, Version 14.17.1 'Fermium' (LTS), @targos + +### Notable Changes + +* [[`6035492c8f`](https://github.com/nodejs/node/commit/6035492c8f)] - **deps**: update ICU to 69.1 (Michaël Zasso) [#38178](https://github.com/nodejs/node/pull/38178) +* [[`9417fd0bc8`](https://github.com/nodejs/node/commit/9417fd0bc8)] - **errors**: align source-map stacks with spec (Benjamin Coe) [#37252](https://github.com/nodejs/node/pull/37252) + +### Commits + +* [[`87fa636953`](https://github.com/nodejs/node/commit/87fa636953)] - **assert**: refactor to use more primordials (Antoine du Hamel) [#36234](https://github.com/nodejs/node/pull/36234) +* [[`cfff3b4462`](https://github.com/nodejs/node/commit/cfff3b4462)] - **assert**: refactor to avoid unsafe array iteration (Antoine du Hamel) [#37344](https://github.com/nodejs/node/pull/37344) +* [[`dd18def7db`](https://github.com/nodejs/node/commit/dd18def7db)] - **async_hooks**: refactor to avoid unsafe array iteration (Antoine du Hamel) [#37125](https://github.com/nodejs/node/pull/37125) +* [[`5f3e96b570`](https://github.com/nodejs/node/commit/5f3e96b570)] - **async_hooks,doc**: replace process.stdout.fd with 1 (Darshan Sen) [#38382](https://github.com/nodejs/node/pull/38382) +* [[`f4cb8b8281`](https://github.com/nodejs/node/commit/f4cb8b8281)] - **benchmark**: avoid using `console.log()` (Antoine du Hamel) [#38370](https://github.com/nodejs/node/pull/38370) +* [[`9e4c1f2f2c`](https://github.com/nodejs/node/commit/9e4c1f2f2c)] - **benchmark**: use `process.hrtime.bigint()` (Antoine du Hamel) [#38369](https://github.com/nodejs/node/pull/38369) +* [[`3c886e0ad6`](https://github.com/nodejs/node/commit/3c886e0ad6)] - **buffer**: remove TODOs in `atob` / `btoa` (Khaidi Chu) [#38548](https://github.com/nodejs/node/pull/38548) +* [[`c5b86f8c2f`](https://github.com/nodejs/node/commit/c5b86f8c2f)] - **buffer**: remove unreachable code (Rongjian Zhang) [#38537](https://github.com/nodejs/node/pull/38537) +* [[`9ae2a27d44`](https://github.com/nodejs/node/commit/9ae2a27d44)] - **buffer**: make FastBuffer safe to construct (Antoine du Hamel) [#36587](https://github.com/nodejs/node/pull/36587) +* [[`ff546ff744`](https://github.com/nodejs/node/commit/ff546ff744)] - **buffer**: refactor to use primordials instead of Array#reduce (Antoine du Hamel) [#36392](https://github.com/nodejs/node/pull/36392) +* [[`5acf0a5ba3`](https://github.com/nodejs/node/commit/5acf0a5ba3)] - **buffer**: refactor to use more primordials (Antoine du Hamel) [#36166](https://github.com/nodejs/node/pull/36166) +* [[`52fd42ec46`](https://github.com/nodejs/node/commit/52fd42ec46)] - **build**: work around bug in MSBuild v16.10.0 (Michaël Zasso) [#38873](https://github.com/nodejs/node/pull/38873) +* [[`5df0f35bf6`](https://github.com/nodejs/node/commit/5df0f35bf6)] - **build**: add workaround for V8 builds (Richard Lau) [#38632](https://github.com/nodejs/node/pull/38632) +* [[`754aa384e0`](https://github.com/nodejs/node/commit/754aa384e0)] - **build**: remove dependency on `distutils.spawn` (Richard Lau) [#38600](https://github.com/nodejs/node/pull/38600) +* [[`5de7e64f3a`](https://github.com/nodejs/node/commit/5de7e64f3a)] - **build**: fix make test-npm (Ruy Adorno) [#36369](https://github.com/nodejs/node/pull/36369) +* [[`e5fae63108`](https://github.com/nodejs/node/commit/e5fae63108)] - **child_process**: reduce abort handler code duplication (Rich Trott) [#36644](https://github.com/nodejs/node/pull/36644) +* [[`598d2bdf09`](https://github.com/nodejs/node/commit/598d2bdf09)] - **child_process**: treat already-aborted controller as aborting (Rich Trott) [#36644](https://github.com/nodejs/node/pull/36644) +* [[`8d7708bdef`](https://github.com/nodejs/node/commit/8d7708bdef)] - **child_process**: refactor to use more primordials (Antoine du Hamel) [#36003](https://github.com/nodejs/node/pull/36003) +* [[`b8c4d30e77`](https://github.com/nodejs/node/commit/b8c4d30e77)] - **deps**: update to cjs-module-lexer@1.2.1 (Guy Bedford) [#38450](https://github.com/nodejs/node/pull/38450) +* [[`6035492c8f`](https://github.com/nodejs/node/commit/6035492c8f)] - **deps**: update ICU to 69.1 (Michaël Zasso) [#38178](https://github.com/nodejs/node/pull/38178) +* [[`51dad8cabb`](https://github.com/nodejs/node/commit/51dad8cabb)] - **deps**: V8: cherry-pick 035c305ce776 (Michaël Zasso) [#38497](https://github.com/nodejs/node/pull/38497) +* [[`a467125c8d`](https://github.com/nodejs/node/commit/a467125c8d)] - **deps**: V8: cherry-pick dfcdf7837e23 (Benjamin Coe) [#36573](https://github.com/nodejs/node/pull/36573) +* [[`acc9fad2ba`](https://github.com/nodejs/node/commit/acc9fad2ba)] - **deps**: V8: cherry-pick 86991d0587a1 (Benjamin Coe) [#36254](https://github.com/nodejs/node/pull/36254) +* [[`d67827744b`](https://github.com/nodejs/node/commit/d67827744b)] - **deps**: V8: cherry-pick 530080c44af2 (Milad Fa) [#38508](https://github.com/nodejs/node/pull/38508) +* [[`bac9ba4f8a`](https://github.com/nodejs/node/commit/bac9ba4f8a)] - **dgram**: extract cluster lazy loading method to make it testable (Rongjian Zhang) [#38563](https://github.com/nodejs/node/pull/38563) +* [[`f5b2115b76`](https://github.com/nodejs/node/commit/f5b2115b76)] - **dgram**: refactor to use more primordials (Antoine du Hamel) [#36286](https://github.com/nodejs/node/pull/36286) +* [[`cd7cf0547a`](https://github.com/nodejs/node/commit/cd7cf0547a)] - **dns**: refactor to use more primordials (Antoine du Hamel) [#36314](https://github.com/nodejs/node/pull/36314) +* [[`9f67c0852c`](https://github.com/nodejs/node/commit/9f67c0852c)] - **doc**: cleanup events.md structure (James M Snell) [#36100](https://github.com/nodejs/node/pull/36100) +* [[`41cfe645c0`](https://github.com/nodejs/node/commit/41cfe645c0)] - **doc**: fix JS flavor selection (Antoine du Hamel) [#37791](https://github.com/nodejs/node/pull/37791) +* [[`7c4748b0dc`](https://github.com/nodejs/node/commit/7c4748b0dc)] - **doc**: use `HEAD` instead of `master` for links (Antoine du Hamel) [#38518](https://github.com/nodejs/node/pull/38518) +* [[`26426577ff`](https://github.com/nodejs/node/commit/26426577ff)] - **doc**: remove import.meta.resolve parent URL type (Kevin Locke) [#38585](https://github.com/nodejs/node/pull/38585) +* [[`88055abf19`](https://github.com/nodejs/node/commit/88055abf19)] - **doc**: document buffer.kStringMaxLength (Tobias Nießen) [#38688](https://github.com/nodejs/node/pull/38688) +* [[`2e8dfee165`](https://github.com/nodejs/node/commit/2e8dfee165)] - **doc**: clarify synchronous blocking of Worker stdio (James M Snell) [#38658](https://github.com/nodejs/node/pull/38658) +* [[`212cd5cf05`](https://github.com/nodejs/node/commit/212cd5cf05)] - **doc**: update contact info (Gabriel Schulhof) [#38689](https://github.com/nodejs/node/pull/38689) +* [[`fa35c0662b`](https://github.com/nodejs/node/commit/fa35c0662b)] - **doc**: change color of doctag on night mode (Qingyu Deng) [#38652](https://github.com/nodejs/node/pull/38652) +* [[`4c67437c53`](https://github.com/nodejs/node/commit/4c67437c53)] - **doc**: clarify DiffieHellmanGroup class docs (Nitzan Uziely) [#38363](https://github.com/nodejs/node/pull/38363) +* [[`e90c60b1e3`](https://github.com/nodejs/node/commit/e90c60b1e3)] - **doc**: use AIX instead of Aix in fs.md (Rich Trott) [#38535](https://github.com/nodejs/node/pull/38535) +* [[`dc67fec1b4`](https://github.com/nodejs/node/commit/dc67fec1b4)] - **doc**: remove extraneous dash from flag prefix (Rodolfo Carvalho) [#38532](https://github.com/nodejs/node/pull/38532) +* [[`4c54d81a59`](https://github.com/nodejs/node/commit/4c54d81a59)] - **doc**: document `'secureConnect'` event limitation (James M Snell) [#38447](https://github.com/nodejs/node/pull/38447) +* [[`839e8d1672`](https://github.com/nodejs/node/commit/839e8d1672)] - **doc**: mark querystring api as legacy (James M Snell) [#38436](https://github.com/nodejs/node/pull/38436) +* [[`a75b7af9bd`](https://github.com/nodejs/node/commit/a75b7af9bd)] - **doc**: add arguments for stream event of Http2Server and Http2SecureServer (Qingyu Deng) [#37892](https://github.com/nodejs/node/pull/37892) +* [[`cf0007edc4`](https://github.com/nodejs/node/commit/cf0007edc4)] - **doc**: indicate that abort tests do not generate core files (Rich Trott) [#38422](https://github.com/nodejs/node/pull/38422) +* [[`945450b5cf`](https://github.com/nodejs/node/commit/945450b5cf)] - **doc**: add try/catch in http2 respondWithFile example (Matteo Collina) [#38410](https://github.com/nodejs/node/pull/38410) +* [[`1f7cd7148a`](https://github.com/nodejs/node/commit/1f7cd7148a)] - **doc**: note the system requirements for V8 tests (DeeDeeG) [#38319](https://github.com/nodejs/node/pull/38319) +* [[`cd54834854`](https://github.com/nodejs/node/commit/cd54834854)] - **doc**: minor clarification to pathObject (James M Snell) [#38437](https://github.com/nodejs/node/pull/38437) +* [[`ba117c2c6f`](https://github.com/nodejs/node/commit/ba117c2c6f)] - **doc**: document new TCP\_KEEPCNT and TCP\_KEEPINTVL socket option defaults (Arnold Zokas) [#38313](https://github.com/nodejs/node/pull/38313) +* [[`dcdbaffced`](https://github.com/nodejs/node/commit/dcdbaffced)] - **doc**: do not mention TCP in the allowHalfOpen option description (Luigi Pinca) [#38360](https://github.com/nodejs/node/pull/38360) +* [[`fe8003e5de`](https://github.com/nodejs/node/commit/fe8003e5de)] - **doc**: update message to match actual output (Rich Trott) [#35271](https://github.com/nodejs/node/pull/35271) +* [[`c03f23e126`](https://github.com/nodejs/node/commit/c03f23e126)] - **doc**: request default snap track be updated for LTS (Rod Vagg) [#37708](https://github.com/nodejs/node/pull/37708) +* [[`a9f7aeed12`](https://github.com/nodejs/node/commit/a9f7aeed12)] - **doc**: mark `process.hrtime()` as legacy (Antoine du Hamel) [#38371](https://github.com/nodejs/node/pull/38371) +* [[`cede0c57b8`](https://github.com/nodejs/node/commit/cede0c57b8)] - **doc**: fix version history for `"exports"` patterns (Antoine du Hamel) [#38355](https://github.com/nodejs/node/pull/38355) +* [[`9702f22397`](https://github.com/nodejs/node/commit/9702f22397)] - **doc**: fix `package.json` `"imports"` field history (Antoine du Hamel) [#38356](https://github.com/nodejs/node/pull/38356) +* [[`2d96da875e`](https://github.com/nodejs/node/commit/2d96da875e)] - **doc**: fix typo in buffer.md (divlo) [#38323](https://github.com/nodejs/node/pull/38323) +* [[`6b58f28472`](https://github.com/nodejs/node/commit/6b58f28472)] - **doc**: add nodejs-sec email template (Daniel Bevenius) [#38290](https://github.com/nodejs/node/pull/38290) +* [[`5a532e4725`](https://github.com/nodejs/node/commit/5a532e4725)] - **doc**: update TSC members list with three new members (Rich Trott) [#38352](https://github.com/nodejs/node/pull/38352) +* [[`e994d6a27c`](https://github.com/nodejs/node/commit/e994d6a27c)] - **doc**: use `foo.prototype.bar` notation in buffer.md (Voltrex) [#38032](https://github.com/nodejs/node/pull/38032) +* [[`c61f363d66`](https://github.com/nodejs/node/commit/c61f363d66)] - **doc**: internal/test/binding for testing (Bradley Meck) [#38026](https://github.com/nodejs/node/pull/38026) +* [[`0bb6fe31b3`](https://github.com/nodejs/node/commit/0bb6fe31b3)] - **doc**: add missing events.on metadata (Anna Henningsen) [#37965](https://github.com/nodejs/node/pull/37965) +* [[`30c82b2745`](https://github.com/nodejs/node/commit/30c82b2745)] - **doc**: fix wording in outgoingMessage.write (Tobias Nießen) [#37894](https://github.com/nodejs/node/pull/37894) +* [[`932000020a`](https://github.com/nodejs/node/commit/932000020a)] - **doc**: fix grammar errors in http document (Qingyu Deng) [#37265](https://github.com/nodejs/node/pull/37265) +* [[`19e8ae44c4`](https://github.com/nodejs/node/commit/19e8ae44c4)] - **doc**: add document for http.OutgoingMessage (Qingyu Deng) [#37265](https://github.com/nodejs/node/pull/37265) +* [[`a6c123363d`](https://github.com/nodejs/node/commit/a6c123363d)] - **doc**: remove generated from dsaEncoding description (Marko Kaznovac) [#37459](https://github.com/nodejs/node/pull/37459) +* [[`bc6ea63e48`](https://github.com/nodejs/node/commit/bc6ea63e48)] - **doc**: document how to register external bindings for snapshot (Joyee Cheung) [#37463](https://github.com/nodejs/node/pull/37463) +* [[`2168e954aa`](https://github.com/nodejs/node/commit/2168e954aa)] - **doc**: document the NO\_COLOR and FORCE\_COLOR env vars (James M Snell) [#37477](https://github.com/nodejs/node/pull/37477) +* [[`2907848fc9`](https://github.com/nodejs/node/commit/2907848fc9)] - **doc**: clarify event.isTrusted text (Rich Trott) [#36827](https://github.com/nodejs/node/pull/36827) +* [[`7efa020892`](https://github.com/nodejs/node/commit/7efa020892)] - **doc**: expand openssl instructions (Michael Dawson) [#36554](https://github.com/nodejs/node/pull/36554) +* [[`b197a44152`](https://github.com/nodejs/node/commit/b197a44152)] - **doc**: document ABORT\_ERR code (Benjamin Gruenbaum) [#36319](https://github.com/nodejs/node/pull/36319) +* [[`1d80f89442`](https://github.com/nodejs/node/commit/1d80f89442)] - **doc**: document changes for `*/promises` alias modules (ExE Boss) [#34002](https://github.com/nodejs/node/pull/34002) +* [[`9417fd0bc8`](https://github.com/nodejs/node/commit/9417fd0bc8)] - **errors**: align source-map stacks with spec (Benjamin Coe) [#37252](https://github.com/nodejs/node/pull/37252) +* [[`dcd221ce69`](https://github.com/nodejs/node/commit/dcd221ce69)] - **errors**: refactor to use more primordials (Antoine du Hamel) [#36651](https://github.com/nodejs/node/pull/36651) +* [[`ee444473e9`](https://github.com/nodejs/node/commit/ee444473e9)] - **errors**: display original symbol name (Benjamin Coe) [#36042](https://github.com/nodejs/node/pull/36042) +* [[`83d28374d6`](https://github.com/nodejs/node/commit/83d28374d6)] - **errors**: refactor to use more primordials (Antoine du Hamel) [#36167](https://github.com/nodejs/node/pull/36167) +* [[`7d7e34c15a`](https://github.com/nodejs/node/commit/7d7e34c15a)] - **errors**: refactor to use more primordials (Antoine du Hamel) [#35944](https://github.com/nodejs/node/pull/35944) +* [[`18e5c0f3e2`](https://github.com/nodejs/node/commit/18e5c0f3e2)] - **events**: refactor to use optional chaining (ZiJian Liu) [#36763](https://github.com/nodejs/node/pull/36763) +* [[`4fdcbae583`](https://github.com/nodejs/node/commit/4fdcbae583)] - **events**: refactor to use more primordials (Antoine du Hamel) [#36304](https://github.com/nodejs/node/pull/36304) +* [[`c4e7dca8f3`](https://github.com/nodejs/node/commit/c4e7dca8f3)] - **fs**: fix error when writing buffers \> INT32\_MAX (Zach Bjornson) [#38546](https://github.com/nodejs/node/pull/38546) +* [[`07c55d2844`](https://github.com/nodejs/node/commit/07c55d2844)] - ***Revert*** "**http**: make HEAD method to work with keep-alive" (Michaël Zasso) [#38949](https://github.com/nodejs/node/pull/38949) +* [[`d8da265c81`](https://github.com/nodejs/node/commit/d8da265c81)] - **http2**: treat non-EOF empty frames like other invalid frames (Anna Henningsen) [#37875](https://github.com/nodejs/node/pull/37875) +* [[`c3bd0fdb73`](https://github.com/nodejs/node/commit/c3bd0fdb73)] - **http2**: fix setting options before handle exists (Anna Henningsen) [#37875](https://github.com/nodejs/node/pull/37875) +* [[`74fe1d8f0c`](https://github.com/nodejs/node/commit/74fe1d8f0c)] - **http2**: add support for TypedArray to getUnpackedSettings (Antoine du Hamel) [#36141](https://github.com/nodejs/node/pull/36141) +* [[`c90f1dbeb3`](https://github.com/nodejs/node/commit/c90f1dbeb3)] - **https**: refactor to use more primordials (Antoine du Hamel) [#36195](https://github.com/nodejs/node/pull/36195) +* [[`8258799472`](https://github.com/nodejs/node/commit/8258799472)] - **inspector**: remove redundant method for connection check (Yash Ladha) [#37986](https://github.com/nodejs/node/pull/37986) +* [[`ba19313e1e`](https://github.com/nodejs/node/commit/ba19313e1e)] - **inspector**: refactor to use more primordials (Antoine du Hamel) [#36356](https://github.com/nodejs/node/pull/36356) +* [[`eb8f7ee634`](https://github.com/nodejs/node/commit/eb8f7ee634)] - **lib**: revert primordials in a hot path (Antoine du Hamel) [#38248](https://github.com/nodejs/node/pull/38248) +* [[`cea8b4265c`](https://github.com/nodejs/node/commit/cea8b4265c)] - **lib**: make `IterableWeakMap` safe to iterate (Antoine du Hamel) [#38523](https://github.com/nodejs/node/pull/38523) +* [[`490bc58229`](https://github.com/nodejs/node/commit/490bc58229)] - **lib**: fix and improve os typings (Akhil Marsonya) [#38316](https://github.com/nodejs/node/pull/38316) +* [[`af39df6d03`](https://github.com/nodejs/node/commit/af39df6d03)] - **lib**: add URI handling functions to primordials (Antoine du Hamel) [#37394](https://github.com/nodejs/node/pull/37394) +* [[`16691be80e`](https://github.com/nodejs/node/commit/16691be80e)] - **lib**: fix WebIDL `object` and dictionary type conversion (ExE Boss) [#37047](https://github.com/nodejs/node/pull/37047) +* [[`47ed512312`](https://github.com/nodejs/node/commit/47ed512312)] - **lib**: refactor to use optional chaining in internal/options.js (raisinten) [#36939](https://github.com/nodejs/node/pull/36939) +* [[`346fc0ac21`](https://github.com/nodejs/node/commit/346fc0ac21)] - **lib**: support returning Safe collections from C++ (ExE Boss) [#36989](https://github.com/nodejs/node/pull/36989) +* [[`8912caba64`](https://github.com/nodejs/node/commit/8912caba64)] - **lib**: expose primordials object (Antoine du Hamel) [#36872](https://github.com/nodejs/node/pull/36872) +* [[`46c019b988`](https://github.com/nodejs/node/commit/46c019b988)] - **lib**: refactor source\_map to use more primordials (Antoine du Hamel) [#36733](https://github.com/nodejs/node/pull/36733) +* [[`cf9556d8f7`](https://github.com/nodejs/node/commit/cf9556d8f7)] - **lib**: refactor source\_map to avoid unsafe array iteration (Antoine du Hamel) [#36734](https://github.com/nodejs/node/pull/36734) +* [[`6eaf357f49`](https://github.com/nodejs/node/commit/6eaf357f49)] - **lib**: simplify `primordials.uncurryThis` (ExE Boss) [#36866](https://github.com/nodejs/node/pull/36866) +* [[`9338759b01`](https://github.com/nodejs/node/commit/9338759b01)] - **lib**: remove v8\_prof\_polyfill from eslint ignore list (Antoine du Hamel) [#36537](https://github.com/nodejs/node/pull/36537) +* [[`c9861a344a`](https://github.com/nodejs/node/commit/c9861a344a)] - **lib**: remove unused code (Brian White) [#36632](https://github.com/nodejs/node/pull/36632) +* [[`01a71dd393`](https://github.com/nodejs/node/commit/01a71dd393)] - **lib**: refactor to use more primordials in internal/encoding.js (raisinten) [#36480](https://github.com/nodejs/node/pull/36480) +* [[`e6c0877604`](https://github.com/nodejs/node/commit/e6c0877604)] - **lib**: refactor to use primordials in internal/priority\_queue.js (ZiJian Liu) [#36560](https://github.com/nodejs/node/pull/36560) +* [[`6e3a2ffb98`](https://github.com/nodejs/node/commit/6e3a2ffb98)] - **lib**: add primordials.SafeStringIterator (Antoine du Hamel) [#36526](https://github.com/nodejs/node/pull/36526) +* [[`bf0738bc07`](https://github.com/nodejs/node/commit/bf0738bc07)] - **lib**: make safe primordials safe to construct (Antoine du Hamel) [#36428](https://github.com/nodejs/node/pull/36428) +* [[`7ebc18f293`](https://github.com/nodejs/node/commit/7ebc18f293)] - **lib**: make safe primordials safe to iterate (Antoine du Hamel) [#36391](https://github.com/nodejs/node/pull/36391) +* [[`e12dbc8519`](https://github.com/nodejs/node/commit/e12dbc8519)] - **lib**: refactor to use more primordials in internal/histogram.js (raisinten) [#36455](https://github.com/nodejs/node/pull/36455) +* [[`5daeac64a4`](https://github.com/nodejs/node/commit/5daeac64a4)] - **lib**: add uncurried accessor properties to `primordials` (ExE Boss) [#36329](https://github.com/nodejs/node/pull/36329) +* [[`bb4900d9eb`](https://github.com/nodejs/node/commit/bb4900d9eb)] - **lib**: refactor primordials.uncurryThis (Antoine du Hamel) [#36221](https://github.com/nodejs/node/pull/36221) +* [[`0fbe945ebb`](https://github.com/nodejs/node/commit/0fbe945ebb)] - **lib**: refactor to use more primordials (Antoine du Hamel) [#36140](https://github.com/nodejs/node/pull/36140) +* [[`24d4d63308`](https://github.com/nodejs/node/commit/24d4d63308)] - **lib**: add %TypedArray% abstract constructor to primordials (ExE Boss) [#36016](https://github.com/nodejs/node/pull/36016) +* [[`e2395b0f3b`](https://github.com/nodejs/node/commit/e2395b0f3b)] - **lib**: use Object static properties from primordials (Michaël Zasso) [#35380](https://github.com/nodejs/node/pull/35380) +* [[`b3e22e1612`](https://github.com/nodejs/node/commit/b3e22e1612)] - **lib,tools**: enforce access to prototype from primordials (Antoine du Hamel) [#36025](https://github.com/nodejs/node/pull/36025) +* [[`e94e0b488e`](https://github.com/nodejs/node/commit/e94e0b488e)] - **meta**: add v8 team (Jiawen Geng) [#38566](https://github.com/nodejs/node/pull/38566) +* [[`fcc6a00f1a`](https://github.com/nodejs/node/commit/fcc6a00f1a)] - **meta**: post comment when pr labeled fast-track (James M Snell) [#38446](https://github.com/nodejs/node/pull/38446) +* [[`bd0d9647ca`](https://github.com/nodejs/node/commit/bd0d9647ca)] - **module**: clarify CJS global-like variables not defined error message (Antoine du Hamel) [#37852](https://github.com/nodejs/node/pull/37852) +* [[`0fdb5d59f7`](https://github.com/nodejs/node/commit/0fdb5d59f7)] - **module**: refactor NativeModule to avoid unsafe array iteration (Antoine du Hamel) [#37656](https://github.com/nodejs/node/pull/37656) +* [[`77c7d979b6`](https://github.com/nodejs/node/commit/77c7d979b6)] - **module**: simplify tryStatSync with throwIfNoEntry option (Antoine du Hamel) [#36971](https://github.com/nodejs/node/pull/36971) +* [[`1aae572220`](https://github.com/nodejs/node/commit/1aae572220)] - **module**: refactor to use more primordials (Antoine du Hamel) [#36348](https://github.com/nodejs/node/pull/36348) +* [[`9e7f166161`](https://github.com/nodejs/node/commit/9e7f166161)] - **module**: refactor to use more primordials (Antoine du Hamel) [#36024](https://github.com/nodejs/node/pull/36024) +* [[`eee1d291cf`](https://github.com/nodejs/node/commit/eee1d291cf)] - **module**: refactor to use iterable-weak-map (Benjamin Coe) [#35915](https://github.com/nodejs/node/pull/35915) +* [[`52cbe89f7f`](https://github.com/nodejs/node/commit/52cbe89f7f)] - **net**: refactor to use more primordials (Antoine du Hamel) [#36303](https://github.com/nodejs/node/pull/36303) +* [[`779ad54078`](https://github.com/nodejs/node/commit/779ad54078)] - **node-api**: faster threadsafe\_function (Fedor Indutny) [#38506](https://github.com/nodejs/node/pull/38506) +* [[`5995221ced`](https://github.com/nodejs/node/commit/5995221ced)] - **node-api**: fix shutdown crashes (Michael Dawson) [#38492](https://github.com/nodejs/node/pull/38492) +* [[`d8acec4cb1`](https://github.com/nodejs/node/commit/d8acec4cb1)] - **node-api**: make reference weak parameter an indirect link to references (Chengzhong Wu) [#38000](https://github.com/nodejs/node/pull/38000) +* [[`c442d89ad6`](https://github.com/nodejs/node/commit/c442d89ad6)] - **os**: refactor to use more primordials (Antoine du Hamel) [#36284](https://github.com/nodejs/node/pull/36284) +* [[`daeb6fcd78`](https://github.com/nodejs/node/commit/daeb6fcd78)] - **path**: inline conditions (Voltrex) [#38613](https://github.com/nodejs/node/pull/38613) +* [[`e2f531f646`](https://github.com/nodejs/node/commit/e2f531f646)] - **path**: refactor to use more primordials (Akhil Marsonya) [#37893](https://github.com/nodejs/node/pull/37893) +* [[`c1364d15a2`](https://github.com/nodejs/node/commit/c1364d15a2)] - **path**: refactor to use more primordials (Antoine du Hamel) [#36302](https://github.com/nodejs/node/pull/36302) +* [[`726ef40fcb`](https://github.com/nodejs/node/commit/726ef40fcb)] - **perf_hooks**: throw ERR\_INVALID\_ARG\_VALUE if histogram.percentile param is NaN (ZiJian Liu) [#36937](https://github.com/nodejs/node/pull/36937) +* [[`4686f4f41b`](https://github.com/nodejs/node/commit/4686f4f41b)] - **perf_hooks**: refactor to avoid unsafe array iteration (Antoine du Hamel) [#36723](https://github.com/nodejs/node/pull/36723) +* [[`6adec6351e`](https://github.com/nodejs/node/commit/6adec6351e)] - **perf_hooks**: refactor to use more primordials (Antoine du Hamel) [#36297](https://github.com/nodejs/node/pull/36297) +* [[`bf9aa425c0`](https://github.com/nodejs/node/commit/bf9aa425c0)] - **policy**: refactor to use more primordials (Antoine du Hamel) [#36210](https://github.com/nodejs/node/pull/36210) +* [[`0f6c3f76b3`](https://github.com/nodejs/node/commit/0f6c3f76b3)] - **querystring**: refactor to use more primordials (Antoine du Hamel) [#36315](https://github.com/nodejs/node/pull/36315) +* [[`b5b8a996f3`](https://github.com/nodejs/node/commit/b5b8a996f3)] - **readline**: refactor to use more primordials (Antoine du Hamel) [#36296](https://github.com/nodejs/node/pull/36296) +* [[`cd981808b4`](https://github.com/nodejs/node/commit/cd981808b4)] - **repl**: document top level await limitation with const/let (James M Snell) [#38449](https://github.com/nodejs/node/pull/38449) +* [[`a4eb5571eb`](https://github.com/nodejs/node/commit/a4eb5571eb)] - **repl**: display prompt once after error callback (Anna Henningsen) [#38314](https://github.com/nodejs/node/pull/38314) +* [[`163fcecb69`](https://github.com/nodejs/node/commit/163fcecb69)] - **src**: fix multiple AddLinkedBinding() calls (Anna Henningsen) [#39012](https://github.com/nodejs/node/pull/39012) +* [[`8809ef98f9`](https://github.com/nodejs/node/commit/8809ef98f9)] - **src**: update cares\_wrap OpenBSD defines (Anna Henningsen) [#38670](https://github.com/nodejs/node/pull/38670) +* [[`d66f88ce97`](https://github.com/nodejs/node/commit/d66f88ce97)] - **src**: remove extra semi after member fn (Shelley Vohr) [#38686](https://github.com/nodejs/node/pull/38686) +* [[`bc2111c7e6`](https://github.com/nodejs/node/commit/bc2111c7e6)] - **src**: make workers messaging more resilient (Juan José Arboleda) [#38510](https://github.com/nodejs/node/pull/38510) +* [[`378e0e778b`](https://github.com/nodejs/node/commit/378e0e778b)] - **src**: fix validation of negative offset to avoid abort (James M Snell) [#38421](https://github.com/nodejs/node/pull/38421) +* [[`c170026b7b`](https://github.com/nodejs/node/commit/c170026b7b)] - **src**: use %progbits instead of @progbits (Stephen Gallagher) [#38312](https://github.com/nodejs/node/pull/38312) +* [[`d177541b0e`](https://github.com/nodejs/node/commit/d177541b0e)] - **src**: fix setting Converter sub char length (James M Snell) [#38331](https://github.com/nodejs/node/pull/38331) +* [[`e279b029c0`](https://github.com/nodejs/node/commit/e279b029c0)] - **src**: avoid deferred gc/cleanup for Buffer.from (James M Snell) [#38337](https://github.com/nodejs/node/pull/38337) +* [[`006c7b78da`](https://github.com/nodejs/node/commit/006c7b78da)] - **src**: indent long help text properly (David Glasser) [#37911](https://github.com/nodejs/node/pull/37911) +* [[`f5541ddea3`](https://github.com/nodejs/node/commit/f5541ddea3)] - **src**: fix ETW\_WRITE\_EMPTY\_EVENT macro (Michaël Zasso) [#37334](https://github.com/nodejs/node/pull/37334) +* [[`6b1052d034`](https://github.com/nodejs/node/commit/6b1052d034)] - **src**: disable unfixable MSVC warnings (Michaël Zasso) [#37334](https://github.com/nodejs/node/pull/37334) +* [[`38afa3fa79`](https://github.com/nodejs/node/commit/38afa3fa79)] - **src**: avoid implicit type conversions (take 2) (Michaël Zasso) [#37334](https://github.com/nodejs/node/pull/37334) +* [[`8a60ae2161`](https://github.com/nodejs/node/commit/8a60ae2161)] - **src**: fix compiler warnings in node\_buffer.cc (Darshan Sen) [#38722](https://github.com/nodejs/node/pull/38722) +* [[`78cde14c45`](https://github.com/nodejs/node/commit/78cde14c45)] - **src**: fix compiler warning in env.cc (Anna Henningsen) [#35547](https://github.com/nodejs/node/pull/35547) +* [[`ea311a41cc`](https://github.com/nodejs/node/commit/ea311a41cc)] - **src**: add check against non-weak BaseObjects at process exit (Anna Henningsen) [#35490](https://github.com/nodejs/node/pull/35490) +* [[`a1b4681efc`](https://github.com/nodejs/node/commit/a1b4681efc)] - **src**: use transferred consistently (Daniel Bevenius) [#36340](https://github.com/nodejs/node/pull/36340) +* [[`29c623e5cb`](https://github.com/nodejs/node/commit/29c623e5cb)] - **src**: fix label indentation (Rich Trott) [#36213](https://github.com/nodejs/node/pull/36213) +* [[`dbb0d2612c`](https://github.com/nodejs/node/commit/dbb0d2612c)] - **stream**: fix multiple Writable.destroy() calls (Robert Nagy) [#38221](https://github.com/nodejs/node/pull/38221) +* [[`a18b1ff80b`](https://github.com/nodejs/node/commit/a18b1ff80b)] - **stream**: the position of \_read() is wrong (helloyou2012) [#38292](https://github.com/nodejs/node/pull/38292) +* [[`ab130e929a`](https://github.com/nodejs/node/commit/ab130e929a)] - **stream**: only use legacy close listeners if not willEmitClose (Robert Nagy) [#36649](https://github.com/nodejs/node/pull/36649) +* [[`c31e2f6b0f`](https://github.com/nodejs/node/commit/c31e2f6b0f)] - **stream**: fix legacy pipe error handling (Robert Nagy) [#35257](https://github.com/nodejs/node/pull/35257) +* [[`1dc4dea215`](https://github.com/nodejs/node/commit/1dc4dea215)] - **string_decoder**: throw ERR\_STRING\_TOO\_LONG for UTF-8 (Michaël Zasso) [#36661](https://github.com/nodejs/node/pull/36661) +* [[`0db9101922`](https://github.com/nodejs/node/commit/0db9101922)] - **string_decoder**: refactor to use more primordials (Antoine du Hamel) [#36358](https://github.com/nodejs/node/pull/36358) +* [[`8a44ee478e`](https://github.com/nodejs/node/commit/8a44ee478e)] - **test**: improve coverage of lib/\_http\_client.js (Rongjian Zhang) [#38599](https://github.com/nodejs/node/pull/38599) +* [[`8a45b85dbd`](https://github.com/nodejs/node/commit/8a45b85dbd)] - **test**: improve coverage of lib/os.js (Rongjian Zhang) [#38653](https://github.com/nodejs/node/pull/38653) +* [[`d7c6a3eb03`](https://github.com/nodejs/node/commit/d7c6a3eb03)] - **test**: call functions internally (Voltrex) [#38560](https://github.com/nodejs/node/pull/38560) +* [[`726cb48bd8`](https://github.com/nodejs/node/commit/726cb48bd8)] - **test**: complete coverage of querystring (Rongjian Zhang) [#38520](https://github.com/nodejs/node/pull/38520) +* [[`4f1ba79eb8`](https://github.com/nodejs/node/commit/4f1ba79eb8)] - **test**: increase coverage for AbortController (ZiJian Liu) [#38514](https://github.com/nodejs/node/pull/38514) +* [[`d98b355336`](https://github.com/nodejs/node/commit/d98b355336)] - **test**: run message and pseudo-tty tests in parallel (Richard Lau) [#38502](https://github.com/nodejs/node/pull/38502) +* [[`7938af6565`](https://github.com/nodejs/node/commit/7938af6565)] - **test**: move test-net-connect-econnrefused from pummel to sequential (Rich Trott) [#38462](https://github.com/nodejs/node/pull/38462) +* [[`52f3837518`](https://github.com/nodejs/node/commit/52f3837518)] - **test**: fix `common.mustCall` `length` and `name` properties (Antoine du Hamel) [#38464](https://github.com/nodejs/node/pull/38464) +* [[`fdfb39e692`](https://github.com/nodejs/node/commit/fdfb39e692)] - **test**: address deprecation warning (Rich Trott) [#38448](https://github.com/nodejs/node/pull/38448) +* [[`25e5afe3be`](https://github.com/nodejs/node/commit/25e5afe3be)] - **test**: move abort test from pummel to abort directory (Rich Trott) [#38396](https://github.com/nodejs/node/pull/38396) +* [[`296b969e0a`](https://github.com/nodejs/node/commit/296b969e0a)] - **test**: skip some pummel tests on slower machines (Rich Trott) [#38394](https://github.com/nodejs/node/pull/38394) +* [[`a9ff9c0918`](https://github.com/nodejs/node/commit/a9ff9c0918)] - **test**: add ancestor package.json checks for tmpdir (Richard Lau) [#38285](https://github.com/nodejs/node/pull/38285) +* [[`c9ce98c377`](https://github.com/nodejs/node/commit/c9ce98c377)] - **test**: replace function with arrow function and remove unused argument (Andres) [#38235](https://github.com/nodejs/node/pull/38235) +* [[`c77abf5a89`](https://github.com/nodejs/node/commit/c77abf5a89)] - **test**: use .test domain for not found address (Richard Lau) [#38286](https://github.com/nodejs/node/pull/38286) +* [[`d9eb8b3ed0`](https://github.com/nodejs/node/commit/d9eb8b3ed0)] - **test**: increase fs promise coverage (Emil Sivervik) [#36813](https://github.com/nodejs/node/pull/36813) +* [[`d85b70fffa`](https://github.com/nodejs/node/commit/d85b70fffa)] - **test**: increase timeout on ASAN Action (Antoine du Hamel) [#37007](https://github.com/nodejs/node/pull/37007) +* [[`836fba52ea`](https://github.com/nodejs/node/commit/836fba52ea)] - **test**: improve coverage of `SourceTextModule` getters (Juan José Arboleda) [#37013](https://github.com/nodejs/node/pull/37013) +* [[`f43fc6b6cc`](https://github.com/nodejs/node/commit/f43fc6b6cc)] - **test**: improve coverage for `Module` getters (Juan José Arboleda) [#36950](https://github.com/nodejs/node/pull/36950) +* [[`a45d280c18`](https://github.com/nodejs/node/commit/a45d280c18)] - **test**: improve coverage on worker threads (Juan José Arboleda) [#36910](https://github.com/nodejs/node/pull/36910) +* [[`ec4d79e259`](https://github.com/nodejs/node/commit/ec4d79e259)] - **test**: improve coverage at `lib/internal/vm/module.js` (Juan José Arboleda) [#36898](https://github.com/nodejs/node/pull/36898) +* [[`c34de75687`](https://github.com/nodejs/node/commit/c34de75687)] - **test**: guard large string decoder allocation (Michaël Zasso) [#36795](https://github.com/nodejs/node/pull/36795) +* [[`3215a58843`](https://github.com/nodejs/node/commit/3215a58843)] - **test**: add already-aborted-controller test for spawn() (Rich Trott) [#36644](https://github.com/nodejs/node/pull/36644) +* [[`c3b116795b`](https://github.com/nodejs/node/commit/c3b116795b)] - **test**: add test for reused AbortController with execfile() (Rich Trott) [#36644](https://github.com/nodejs/node/pull/36644) +* [[`219ed0ba4c`](https://github.com/nodejs/node/commit/219ed0ba4c)] - **test**: add Actions annotation output (Mary Marchini) [#34590](https://github.com/nodejs/node/pull/34590) +* [[`89ee6abae0`](https://github.com/nodejs/node/commit/89ee6abae0)] - **test**: use `.then(common.mustCall())` for all async IIFEs (Anna Henningsen) [#34363](https://github.com/nodejs/node/pull/34363) +* [[`294b3e60a5`](https://github.com/nodejs/node/commit/294b3e60a5)] - **test,doc,lib**: adjust object literal newlines for lint rule (Rich Trott) [#37040](https://github.com/nodejs/node/pull/37040) +* [[`bfe02b8808`](https://github.com/nodejs/node/commit/bfe02b8808)] - **test,readline**: improve tab completion coverage (Antoine du Hamel) [#38465](https://github.com/nodejs/node/pull/38465) +* [[`1dc7fd238c`](https://github.com/nodejs/node/commit/1dc7fd238c)] - **timers**: fix unsafe array iteration (Darshan Sen) [#37223](https://github.com/nodejs/node/pull/37223) +* [[`679973866d`](https://github.com/nodejs/node/commit/679973866d)] - **timers**: reject with AbortError on cancellation (Benjamin Gruenbaum) [#36317](https://github.com/nodejs/node/pull/36317) +* [[`dec3610a31`](https://github.com/nodejs/node/commit/dec3610a31)] - **timers**: refactor to use more primordials (Antoine du Hamel) [#36132](https://github.com/nodejs/node/pull/36132) +* [[`d84b05a619`](https://github.com/nodejs/node/commit/d84b05a619)] - **timers**: cleanup abort listener on awaitable timers (James M Snell) [#36006](https://github.com/nodejs/node/pull/36006) +* [[`f6e4dbb779`](https://github.com/nodejs/node/commit/f6e4dbb779)] - **tls**: validate ticket keys buffer (Antoine du Hamel) [#38308](https://github.com/nodejs/node/pull/38308) +* [[`661e9809bd`](https://github.com/nodejs/node/commit/661e9809bd)] - **tls**: fix session and keylog add listener segfault (Nitzan Uziely) [#38180](https://github.com/nodejs/node/pull/38180) +* [[`de44e90523`](https://github.com/nodejs/node/commit/de44e90523)] - **tools**: refloat 7 Node.js patches to cpplint.py (Rich Trott) [#36324](https://github.com/nodejs/node/pull/36324) +* [[`37bc7d5945`](https://github.com/nodejs/node/commit/37bc7d5945)] - **tools**: bump cpplint to 1.5.4 (Rich Trott) [#36324](https://github.com/nodejs/node/pull/36324) +* [[`84e918858e`](https://github.com/nodejs/node/commit/84e918858e)] - **tools**: refloat 7 Node.js patches to cpplint.py (Rich Trott) [#36235](https://github.com/nodejs/node/pull/36235) +* [[`fb2bb93f95`](https://github.com/nodejs/node/commit/fb2bb93f95)] - **tools**: bump cpplint to 1.5.3 (Rich Trott) [#36235](https://github.com/nodejs/node/pull/36235) +* [[`3351910f97`](https://github.com/nodejs/node/commit/3351910f97)] - **tools**: refloat 7 Node.js patches to cpplint.py (Rich Trott) [#36213](https://github.com/nodejs/node/pull/36213) +* [[`193b18effa`](https://github.com/nodejs/node/commit/193b18effa)] - **tools**: bump cpplint.py to 1.5.2 (Rich Trott) [#36213](https://github.com/nodejs/node/pull/36213) +* [[`8a6c35d735`](https://github.com/nodejs/node/commit/8a6c35d735)] - **tools**: update ESLint to 7.27.0 (Luigi Pinca) [#38764](https://github.com/nodejs/node/pull/38764) +* [[`f8753b6299`](https://github.com/nodejs/node/commit/f8753b6299)] - **tools**: update ESLint to 7.26.0 (Colin Ihrig) [#38605](https://github.com/nodejs/node/pull/38605) +* [[`1098aec40b`](https://github.com/nodejs/node/commit/1098aec40b)] - **tools**: update ESLint to 7.25.0 (Colin Ihrig) [#38378](https://github.com/nodejs/node/pull/38378) +* [[`3fbabfa94d`](https://github.com/nodejs/node/commit/3fbabfa94d)] - **tools**: update ESLint to 7.24.0 (Colin Ihrig) [#38179](https://github.com/nodejs/node/pull/38179) +* [[`6ce779cd8b`](https://github.com/nodejs/node/commit/6ce779cd8b)] - **tools**: update ESLint to 7.23.0 (Luigi Pinca) [#37979](https://github.com/nodejs/node/pull/37979) +* [[`77f88e7725`](https://github.com/nodejs/node/commit/77f88e7725)] - **tools**: update ESLint to 7.22.0 (Colin Ihrig) [#37734](https://github.com/nodejs/node/pull/37734) +* [[`5de911eeaf`](https://github.com/nodejs/node/commit/5de911eeaf)] - **tools**: make update-eslint.sh work with npm@7 (Luigi Pinca) [#37566](https://github.com/nodejs/node/pull/37566) +* [[`839976669f`](https://github.com/nodejs/node/commit/839976669f)] - **tools**: add support for mjs and cjs JS snippet linting (Antoine du Hamel) [#37311](https://github.com/nodejs/node/pull/37311) +* [[`2463bd0689`](https://github.com/nodejs/node/commit/2463bd0689)] - **tools**: update eslint-plugin-markdown configuration (Colin Ihrig) [#37549](https://github.com/nodejs/node/pull/37549) +* [[`f868fac455`](https://github.com/nodejs/node/commit/f868fac455)] - **tools**: enable object-curly-newline in ESLint rules (Rich Trott) [#37040](https://github.com/nodejs/node/pull/37040) +* [[`d13508d219`](https://github.com/nodejs/node/commit/d13508d219)] - **tools**: make GH Actions workflows work if default branch is not master (Antoine du Hamel) [#38516](https://github.com/nodejs/node/pull/38516) +* [[`7021c31d06`](https://github.com/nodejs/node/commit/7021c31d06)] - **tools**: use mktemp to create the workspace directory (Luigi Pinca) [#38432](https://github.com/nodejs/node/pull/38432) +* [[`16a3e555ba`](https://github.com/nodejs/node/commit/16a3e555ba)] - **tools**: use a shallow clone of the npm/cli repository (Luigi Pinca) [#38463](https://github.com/nodejs/node/pull/38463) +* [[`3484a23140`](https://github.com/nodejs/node/commit/3484a23140)] - **tools**: remove fixer for non-ascii-character ESLint custom rule (Rich Trott) [#38413](https://github.com/nodejs/node/pull/38413) +* [[`aec4b295e4`](https://github.com/nodejs/node/commit/aec4b295e4)] - **tools**: fix doc generation when version info is not available (Antoine du Hamel) [#38398](https://github.com/nodejs/node/pull/38398) +* [[`0172b110a3`](https://github.com/nodejs/node/commit/0172b110a3)] - **tools**: add \_depot\_tools to PATH (for V8 tests) (DeeDeeG) [#38299](https://github.com/nodejs/node/pull/38299) +* [[`d0eed18c87`](https://github.com/nodejs/node/commit/d0eed18c87)] - **tools**: fix type mismatch in test runner (Richard Lau) [#38289](https://github.com/nodejs/node/pull/38289) +* [[`11ca018db9`](https://github.com/nodejs/node/commit/11ca018db9)] - **tools**: simplify eslint comma-dangle configuration (tools) (Rich Trott) [#37883](https://github.com/nodejs/node/pull/37883) +* [[`f7c14e86a7`](https://github.com/nodejs/node/commit/f7c14e86a7)] - **tools**: simplify eslint comma-dangle configuration (Rich Trott) [#37850](https://github.com/nodejs/node/pull/37850) +* [[`241e05795b`](https://github.com/nodejs/node/commit/241e05795b)] - **tools**: run doctool tests on GitHub Actions CI (Antoine du Hamel) [#37398](https://github.com/nodejs/node/pull/37398) +* [[`a4dd50f8f9`](https://github.com/nodejs/node/commit/a4dd50f8f9)] - **tools**: refactor prefer-primordials (Antoine du Hamel) [#36018](https://github.com/nodejs/node/pull/36018) +* [[`4af3906e72`](https://github.com/nodejs/node/commit/4af3906e72)] - **tools**: update ESLint to 7.21.0 (Luigi Pinca) [#37546](https://github.com/nodejs/node/pull/37546) +* [[`955880de1a`](https://github.com/nodejs/node/commit/955880de1a)] - **tools**: update ESLint to 7.20.0 (Colin Ihrig) [#37339](https://github.com/nodejs/node/pull/37339) +* [[`42c1f98a31`](https://github.com/nodejs/node/commit/42c1f98a31)] - **tools**: update ESLint to 7.19.0 (Colin Ihrig) [#37159](https://github.com/nodejs/node/pull/37159) +* [[`25eb720b4d`](https://github.com/nodejs/node/commit/25eb720b4d)] - **tools**: update ESLint to 7.18.0 (Colin Ihrig) [#36955](https://github.com/nodejs/node/pull/36955) +* [[`4983ef205e`](https://github.com/nodejs/node/commit/4983ef205e)] - **tools**: update gyp-next to v0.7.0 (Michaël Zasso) [#36580](https://github.com/nodejs/node/pull/36580) +* [[`613378da1e`](https://github.com/nodejs/node/commit/613378da1e)] - **tools**: update ESLint to 7.17.0 (Colin Ihrig) [#36726](https://github.com/nodejs/node/pull/36726) +* [[`e6d01f6545`](https://github.com/nodejs/node/commit/e6d01f6545)] - **tools**: update ESLint to 7.16.0 (Yongsheng Zhang) [#36579](https://github.com/nodejs/node/pull/36579) +* [[`98806da810`](https://github.com/nodejs/node/commit/98806da810)] - **tools**: enable no-unsafe-optional-chaining lint rule (Colin Ihrig) [#36411](https://github.com/nodejs/node/pull/36411) +* [[`7d411920f6`](https://github.com/nodejs/node/commit/7d411920f6)] - **tools**: update ESLint to 7.15.0 (Colin Ihrig) [#36411](https://github.com/nodejs/node/pull/36411) +* [[`226a86c3b5`](https://github.com/nodejs/node/commit/226a86c3b5)] - **tools**: enable no-unused-expressions lint rule (Michaël Zasso) [#36248](https://github.com/nodejs/node/pull/36248) +* [[`24a81c7d6c`](https://github.com/nodejs/node/commit/24a81c7d6c)] - **tools**: enable no-nonoctal-decimal-escape lint rule (Colin Ihrig) [#36217](https://github.com/nodejs/node/pull/36217) +* [[`19d4eb17b9`](https://github.com/nodejs/node/commit/19d4eb17b9)] - **tools**: update ESLint to 7.14.0 (Colin Ihrig) [#36217](https://github.com/nodejs/node/pull/36217) +* [[`9fa8d2037f`](https://github.com/nodejs/node/commit/9fa8d2037f)] - **tools**: add linting rule for async IIFEs (Anna Henningsen) [#34363](https://github.com/nodejs/node/pull/34363) +* [[`55fc206d13`](https://github.com/nodejs/node/commit/55fc206d13)] - **tools**: update ESLint to 7.13.0 (Luigi Pinca) [#36031](https://github.com/nodejs/node/pull/36031) +* [[`937fc0a30c`](https://github.com/nodejs/node/commit/937fc0a30c)] - **tools**: update ESLint to 7.12.1 (Colin Ihrig) [#35799](https://github.com/nodejs/node/pull/35799) +* [[`29d0840a90`](https://github.com/nodejs/node/commit/29d0840a90)] - **tools**: update ESLint to 7.12.0 (Colin Ihrig) [#35799](https://github.com/nodejs/node/pull/35799) +* [[`dcbd44758c`](https://github.com/nodejs/node/commit/dcbd44758c)] - **tools**: update ESLint to 7.11.0 (Colin Ihrig) [#35578](https://github.com/nodejs/node/pull/35578) +* [[`c7751b4e69`](https://github.com/nodejs/node/commit/c7751b4e69)] - **tools**: add new ESLint rule: prefer-primordials (Leko) [#35448](https://github.com/nodejs/node/pull/35448) +* [[`9a5411a2b4`](https://github.com/nodejs/node/commit/9a5411a2b4)] - **tools,doc**: add support for several flavors of JS code snippets (Antoine du Hamel) [#37162](https://github.com/nodejs/node/pull/37162) +* [[`e19478aa76`](https://github.com/nodejs/node/commit/e19478aa76)] - **tools,lib**: recommend using safe primordials (Antoine du Hamel) [#36026](https://github.com/nodejs/node/pull/36026) +* [[`5f848a612d`](https://github.com/nodejs/node/commit/5f848a612d)] - **tools,lib**: tighten prefer-primordials rules for Error statics (Antoine du Hamel) [#36017](https://github.com/nodejs/node/pull/36017) +* [[`716076e389`](https://github.com/nodejs/node/commit/716076e389)] - **tty**: refactor to avoid unsafe array iteration (Antoine du Hamel) [#36771](https://github.com/nodejs/node/pull/36771) +* [[`41d74a4d9a`](https://github.com/nodejs/node/commit/41d74a4d9a)] - **tty**: refactor to use more primordials (Zijian Liu) [#36272](https://github.com/nodejs/node/pull/36272) +* [[`e35a3543fd`](https://github.com/nodejs/node/commit/e35a3543fd)] - **typings**: add JSDoc typings for util (Rohit Gohri) [#38213](https://github.com/nodejs/node/pull/38213) +* [[`c8b22185f7`](https://github.com/nodejs/node/commit/c8b22185f7)] - **url**: refactor to use more primordials (Antoine du Hamel) [#36316](https://github.com/nodejs/node/pull/36316) +* [[`e113035c9a`](https://github.com/nodejs/node/commit/e113035c9a)] - **util**: simplify constructor retrieval in inspect() (Rich Trott) [#36466](https://github.com/nodejs/node/pull/36466) +* [[`1551b40d01`](https://github.com/nodejs/node/commit/1551b40d01)] - **v8**: refactor to use more primordials (Antoine du Hamel) [#36527](https://github.com/nodejs/node/pull/36527) +* [[`6c1bbb5caf`](https://github.com/nodejs/node/commit/6c1bbb5caf)] - **v8**: refactor to use more primordials (Antoine du Hamel) [#36285](https://github.com/nodejs/node/pull/36285) +* [[`3aee77d279`](https://github.com/nodejs/node/commit/3aee77d279)] - **vm**: refactor to avoid unsafe array iteration (Antoine du Hamel) [#36752](https://github.com/nodejs/node/pull/36752) +* [[`0dea86634d`](https://github.com/nodejs/node/commit/0dea86634d)] - **wasi**: refactor to avoid unsafe array iteration (Antoine du Hamel) [#36724](https://github.com/nodejs/node/pull/36724) +* [[`2c66305ac4`](https://github.com/nodejs/node/commit/2c66305ac4)] - ***Revert*** "**worker**: remove `ERR_CLOSED_MESSAGE_PORT`" (Juan José Arboleda) [#38510](https://github.com/nodejs/node/pull/38510) +* [[`698bffaa90`](https://github.com/nodejs/node/commit/698bffaa90)] - **worker**: refactor to avoid unsafe array iteration (Antoine du Hamel) [#37346](https://github.com/nodejs/node/pull/37346) +* [[`3d4785c174`](https://github.com/nodejs/node/commit/3d4785c174)] - **worker**: refactor to use more primordials (Antoine du Hamel) [#36267](https://github.com/nodejs/node/pull/36267) +* [[`8702b045a4`](https://github.com/nodejs/node/commit/8702b045a4)] - **zlib**: fix brotli flush range (Khaidi Chu) [#38408](https://github.com/nodejs/node/pull/38408) +* [[`459fe6864e`](https://github.com/nodejs/node/commit/459fe6864e)] - **zlib**: refactor to avoid unsafe array iteration (Antoine du Hamel) [#36722](https://github.com/nodejs/node/pull/36722) +* [[`740638de0f`](https://github.com/nodejs/node/commit/740638de0f)] - **zlib**: refactor to use primordial instead of \.startsWith (Rohan Chougule) [#36718](https://github.com/nodejs/node/pull/36718) +* [[`32e10f388c`](https://github.com/nodejs/node/commit/32e10f388c)] - **zlib**: refactor to use more primordials (Antoine du Hamel) [#36347](https://github.com/nodejs/node/pull/36347) + ## 2021-05-11, Version 14.17.0 'Fermium' (LTS), @danielleadams diff --git a/doc/guides/collaborator-guide.md b/doc/guides/collaborator-guide.md index 2791d2a2e508ed..ae860f6446eb6f 100644 --- a/doc/guides/collaborator-guide.md +++ b/doc/guides/collaborator-guide.md @@ -726,7 +726,6 @@ git push upstream master ### I made a mistake * Ping a TSC member. -* `#node-dev` on freenode. * With `git`, there's a way to override remote trees by force pushing (`git push -f`). This is generally forbidden as it creates conflicts in other people's forks. It is permissible for simpler slip-ups such as typos in commit @@ -735,7 +734,6 @@ git push upstream master 10-minute period passes, consider the commit final. * Use `--force-with-lease` to reduce the chance of overwriting someone else's change. - * Post to `#node-dev` (IRC) if you force push. ### Long Term Support diff --git a/doc/guides/contributing/pull-requests.md b/doc/guides/contributing/pull-requests.md index 32411eb96b5010..5f31bab0cfa9a7 100644 --- a/doc/guides/contributing/pull-requests.md +++ b/doc/guides/contributing/pull-requests.md @@ -51,11 +51,8 @@ help, questions and discussions. [#nodejs-dev](https://openjs-foundation.slack.com/archives/C019Y2T6STH) for development of Node.js core specifically. -Node.js also has two IRC channels: -[#Node.js](https://webchat.freenode.net/?channels=node.js) for general help and -questions, and -[#node-dev](https://webchat.freenode.net/?channels=node-dev) for development of -Node.js core specifically. +Node.js also has an unofficial IRC channel: +[#Node.js](https://web.libera.chat/?channels=node.js). ## Setting up your local environment @@ -298,8 +295,7 @@ $ git push --force-with-lease origin my-branch **Important:** The `git push --force-with-lease` command is one of the few ways to delete history in `git`. Before you use it, make sure you understand the -risks. If in doubt, you can always ask for guidance in the Pull Request or on -[IRC in the #node-dev channel][]. +risks. If in doubt, you can always ask for guidance in the Pull Request. If you happen to make a mistake in any of your commits, do not worry. You can amend the last commit (for example if you want to change the commit log). @@ -593,7 +589,6 @@ More than one subsystem may be valid for any particular issue or pull request. [CI (Continuous Integration) test run]: #ci-testing [Code of Conduct]: https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md [Collaborator Guide]: ../collaborator-guide.md -[IRC in the #node-dev channel]: https://webchat.freenode.net?channels=node-dev&uio=d4 [Onboarding guide]: ../../../onboarding.md [approved]: #getting-approvals-for-your-pull-request [benchmark results]: ../writing-and-running-benchmarks.md diff --git a/doc/guides/releases.md b/doc/guides/releases.md index eac14469a09a2f..832b8c8eda0680 100644 --- a/doc/guides/releases.md +++ b/doc/guides/releases.md @@ -128,7 +128,7 @@ Build is essential to make sure that the CI works, release files are published, and the release blog post is available on the project website. Build can be contacted best by opening up an issue on the [Build issue -tracker][], and by posting in `#node-build` on [webchat.freenode.net][]. +tracker][]. When preparing a security release, contact Build at least two weekdays in advance of the expected release. To ensure that the security patch(es) can be @@ -912,4 +912,3 @@ take place once a new LTS line has been released. [Snap]: https://snapcraft.io/node [nodejs.org release-post.js script]: https://github.com/nodejs/nodejs.org/blob/HEAD/scripts/release-post.js [nodejs.org repository]: https://github.com/nodejs/nodejs.org -[webchat.freenode.net]: https://webchat.freenode.net/ diff --git a/doc/node.1 b/doc/node.1 index a65ec7451a88cc..a0bbb2b781b7ba 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -703,13 +703,9 @@ GitHub repository & Issue Tracker: . .Pp IRC (general questions): -.Sy "chat.freenode.net #node.js" +.Sy "libera.chat #node.js" (unofficial) . -.Pp -IRC (Node.js core development): -.Sy "chat.freenode.net #node-dev" -. .\"====================================================================== .Sh AUTHORS Written and maintained by 1000+ contributors: diff --git a/lib/_http_client.js b/lib/_http_client.js index f3b88b62730175..fde7fde86bbf25 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -53,6 +53,7 @@ const { prepareError, } = require('_http_common'); const { OutgoingMessage } = require('_http_outgoing'); +const { kDestroy } = require('internal/streams/destroy'); const Agent = require('_http_agent'); const { Buffer } = require('buffer'); const { defaultTriggerAsyncIdScope } = require('internal/async_hooks'); @@ -609,6 +610,7 @@ function parserOnIncomingClient(res, shouldKeepAlive) { DTRACE_HTTP_CLIENT_RESPONSE(socket, req); req.res = res; res.req = req; + res[kDestroy] = null; // Add our listener first, so that we guarantee socket cleanup res.on('end', responseOnEnd); diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js index e0f1354e6c969c..3961b583de9ddc 100644 --- a/lib/_http_incoming.js +++ b/lib/_http_incoming.js @@ -31,6 +31,7 @@ const { } = primordials; const { Readable, finished } = require('stream'); +const { kDestroy } = require('internal/streams/destroy'); const kHeaders = Symbol('kHeaders'); const kHeadersCount = Symbol('kHeadersCount'); @@ -188,13 +189,18 @@ IncomingMessage.prototype._destroy = function _destroy(err, cb) { this.socket.destroy(err); const cleanup = finished(this.socket, (e) => { cleanup(); - onError(this, e || err, cb); + process.nextTick(onError, this, e || err, cb); }); } else { - onError(this, err, cb); + process.nextTick(onError, this, err, cb); } }; +IncomingMessage.prototype[kDestroy] = function(err) { + this.socket = null; + this.destroy(err); +}; + IncomingMessage.prototype._addHeaderLines = _addHeaderLines; function _addHeaderLines(headers, n) { if (headers && headers.length) { diff --git a/lib/_http_server.js b/lib/_http_server.js index 97df58a007daba..946394f9add754 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -231,9 +231,7 @@ function onServerResponseClose() { // where the ServerResponse object has already been deconstructed. // Fortunately, that requires only a single if check. :-) if (this._httpMessage) { - this._httpMessage.destroyed = true; - this._httpMessage._closed = true; - this._httpMessage.emit('close'); + emitCloseNT(this._httpMessage); } } @@ -837,9 +835,11 @@ function resOnFinish(req, res, socket, state, server) { } function emitCloseNT(self) { - self.destroyed = true; - self._closed = true; - self.emit('close'); + if (!self.destroyed) { + self.destroyed = true; + self._closed = true; + self.emit('close'); + } } // The following callback is issued after the headers have been read on a diff --git a/lib/child_process.js b/lib/child_process.js index 73268b05a85740..62c552d567eaad 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -89,6 +89,28 @@ const { const MAX_BUFFER = 1024 * 1024; +/** + * Spawns a new Node.js process + fork. + * @param {string} modulePath + * @param {string[]} [args] + * @param {{ + * cwd?: string; + * detached?: boolean; + * env?: Object; + * execPath?: string; + * execArgv?: string[]; + * gid?: number; + * serialization?: string; + * signal?: AbortSignal; + * killSignal?: string | number; + * silent?: boolean; + * stdio?: Array | string; + * uid?: number; + * windowsVerbatimArguments?: boolean; + * timeout?: number; + * }} [options] + * @returns {ChildProcess} + */ function fork(modulePath /* , args, options */) { validateString(modulePath, 'modulePath'); @@ -176,7 +198,29 @@ function normalizeExecArgs(command, options, callback) { }; } - +/** + * Spawns a shell executing the given command. + * @param {string} command + * @param {{ + * cmd?: string; + * env?: Object; + * encoding?: string; + * shell?: string; + * signal?: AbortSignal; + * timeout?: number; + * maxBuffer?: number; + * killSignal?: string | number; + * uid?: number; + * gid?: number; + * windowsHide?: boolean; + * }} [options] + * @param {( + * error?: Error, + * stdout?: string | Buffer, + * stderr?: string | Buffer + * ) => any} [callback] + * @returns {ChildProcess} + */ function exec(command, options, callback) { const opts = normalizeExecArgs(command, options, callback); return module.exports.execFile(opts.file, @@ -207,6 +251,31 @@ ObjectDefineProperty(exec, promisify.custom, { value: customPromiseExecFunction(exec) }); +/** + * Spawns the specified file as a shell. + * @param {string} file + * @param {string[]} [args] + * @param {{ + * cwd?: string; + * env?: Object; + * encoding?: string; + * timeout?: number; + * maxBuffer?: number; + * killSignal?: string | number; + * uid?: number; + * gid?: number; + * windowsHide?: boolean; + * windowsVerbatimArguments?: boolean; + * shell?: boolean | string; + * signal?: AbortSignal; + * }} [options] + * @param {( + * error?: Error, + * stdout?: string | Buffer, + * stderr?: string | Buffer + * ) => any} [callback] + * @returns {ChildProcess} + */ function execFile(file /* , args, options, callback */) { let args = []; let callback; @@ -596,7 +665,28 @@ function abortChildProcess(child, killSignal) { } } - +/** + * Spawns a new process using the given `file`. + * @param {string} file + * @param {string[]} [args] + * @param {{ + * cwd?: string; + * env?: Object; + * argv0?: string; + * stdio?: Array | string; + * detached?: boolean; + * uid?: number; + * gid?: number; + * serialization?: string; + * shell?: boolean | string; + * windowsVerbatimArguments?: boolean; + * windowsHide?: boolean; + * signal?: AbortSignal; + * timeout?: number; + * killSignal?: string | number; + * }} [options] + * @returns {ChildProcess} + */ function spawn(file, args, options) { options = normalizeSpawnArguments(file, args, options); validateTimeout(options.timeout); @@ -645,6 +735,36 @@ function spawn(file, args, options) { return child; } +/** + * Spawns a new process synchronously using the given `file`. + * @param {string} file + * @param {string[]} [args] + * @param {{ + * cwd?: string; + * input?: string | Buffer | TypedArray | DataView; + * argv0?: string; + * stdio?: string | Array; + * env?: Object; + * uid?: number; + * gid?: number; + * timeout?: number; + * killSignal?: string | number; + * maxBuffer?: number; + * encoding?: string; + * shell?: boolean | string; + * windowsVerbatimArguments?: boolean; + * windowsHide?: boolean; + * }} [options] + * @returns {{ + * pid: number; + * output: Array; + * stdout: Buffer | string; + * stderr: Buffer | string; + * status: number | null; + * signal: string | null; + * error: Error; + * }} + */ function spawnSync(file, args, options) { options = { maxBuffer: MAX_BUFFER, @@ -711,7 +831,26 @@ function checkExecSyncError(ret, args, cmd) { return err; } - +/** + * Spawns a file as a shell synchronously. + * @param {string} command + * @param {string[]} [args] + * @param {{ + * cwd?: string; + * input?: string | Buffer | TypedArray | DataView; + * stdio?: string | Array; + * env?: Object; + * uid?: number; + * gid?: number; + * timeout?: number; + * killSignal?: string | number; + * maxBuffer?: number; + * encoding?: string; + * windowsHide?: boolean; + * shell?: boolean | string; + * }} [options] + * @returns {Buffer | string} + */ function execFileSync(command, args, options) { options = normalizeSpawnArguments(command, args, options); @@ -730,7 +869,25 @@ function execFileSync(command, args, options) { return ret.stdout; } - +/** + * Spawns a shell executing the given `command` synchronously. + * @param {string} command + * @param {{ + * cwd?: string; + * input?: string | Buffer | TypedArray | DataView; + * stdio?: string | Array; + * env?: Object; + * shell?: string; + * uid?: number; + * gid?: number; + * timeout?: number; + * killSignal?: string | number; + * maxBuffer?: number; + * encoding?: string; + * windowsHide?: boolean; + * }} [options] + * @returns {Buffer | string} + */ function execSync(command, options) { const opts = normalizeExecArgs(command, options, null); const inheritStderr = !opts.options.stdio; diff --git a/lib/internal/errors.js b/lib/internal/errors.js index a226b2d6898d4c..13b56311d370b8 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -890,6 +890,8 @@ E('ERR_CRYPTO_SCRYPT_INVALID_PARAMETER', 'Invalid scrypt parameter', Error); E('ERR_CRYPTO_SCRYPT_NOT_SUPPORTED', 'Scrypt algorithm not supported', Error); // Switch to TypeError. The current implementation does not seem right. E('ERR_CRYPTO_SIGN_KEY_REQUIRED', 'No key provided to sign', Error); +E('ERR_DEBUGGER_ERROR', '%s', Error); +E('ERR_DEBUGGER_STARTUP_ERROR', '%s', Error); E('ERR_DIR_CLOSED', 'Directory handle was closed', Error); E('ERR_DIR_CONCURRENT_OPERATION', 'Cannot do synchronous work on directory handle with concurrent ' + diff --git a/lib/internal/inspector/_inspect.js b/lib/internal/inspector/_inspect.js index 204e037064daf2..e2309fcc68c268 100644 --- a/lib/internal/inspector/_inspect.js +++ b/lib/internal/inspector/_inspect.js @@ -8,7 +8,6 @@ const { ArrayPrototypePop, ArrayPrototypeShift, ArrayPrototypeSlice, - Error, FunctionPrototypeBind, Number, Promise, @@ -46,12 +45,7 @@ const { 0: InspectClient, 1: createRepl } = const debuglog = util.debuglog('inspect'); -class StartupError extends Error { - constructor(message) { - super(message); - this.name = 'StartupError'; - } -} +const { ERR_DEBUGGER_STARTUP_ERROR } = require('internal/errors').codes; async function portIsFree(host, port, timeout = 9999) { if (port === 0) return; // Binding to a random port. @@ -66,7 +60,7 @@ async function portIsFree(host, port, timeout = 9999) { while (true) { await asyncIterator.next(); if (signal.aborted) { - throw new StartupError( // eslint-disable-line no-restricted-syntax + throw new ERR_DEBUGGER_STARTUP_ERROR( `Timeout (${timeout}) waiting for ${host}:${port} to be free`); } const error = await new Promise((resolve) => { @@ -342,7 +336,7 @@ function startInspect(argv = ArrayPrototypeSlice(process.argv, 2), stdin.resume(); function handleUnexpectedError(e) { - if (!(e instanceof StartupError)) { + if (e.code !== 'ERR_DEBUGGER_STARTUP_ERROR') { console.error('There was an internal error in Node.js. ' + 'Please report this bug.'); console.error(e.message); diff --git a/lib/internal/inspector/inspect_client.js b/lib/internal/inspector/inspect_client.js index 4c89c56af93ef6..cd277a4cf5a946 100644 --- a/lib/internal/inspector/inspect_client.js +++ b/lib/internal/inspector/inspect_client.js @@ -1,11 +1,7 @@ -// TODO(aduh95): use errors exported by the internal/errors module -/* eslint-disable no-restricted-syntax */ - 'use strict'; const { ArrayPrototypePush, - Error, ErrorCaptureStackTrace, FunctionPrototypeBind, JSONParse, @@ -15,6 +11,7 @@ const { } = primordials; const Buffer = require('buffer').Buffer; +const { ERR_DEBUGGER_ERROR } = require('internal/errors').codes; const { EventEmitter } = require('events'); const http = require('http'); const URL = require('url'); @@ -39,7 +36,7 @@ const kEightBytePayloadLengthField = 127; const kMaskingKeyWidthInBytes = 4; function unpackError({ code, message, data }) { - const err = new Error(`${message} - ${data}`); + const err = new ERR_DEBUGGER_ERROR(`${message} - ${data}`); err.code = code; ErrorCaptureStackTrace(err, unpackError); return err; @@ -101,14 +98,14 @@ function decodeFrameHybi17(data) { const masked = (secondByte & kMaskBit) !== 0; const compressed = reserved1; if (compressed) { - throw new Error('Compressed frames not supported'); + throw new ERR_DEBUGGER_ERROR('Compressed frames not supported'); } if (!final || reserved2 || reserved3) { - throw new Error('Only compression extension is supported'); + throw new ERR_DEBUGGER_ERROR('Only compression extension is supported'); } if (masked) { - throw new Error('Masked server frame - not supported'); + throw new ERR_DEBUGGER_ERROR('Masked server frame - not supported'); } let closed = false; @@ -119,7 +116,7 @@ function decodeFrameHybi17(data) { case kOpCodeText: break; default: - throw new Error(`Unsupported op code ${opCode}`); + throw new ERR_DEBUGGER_ERROR(`Unsupported op code ${opCode}`); } let payloadLength = secondByte & kPayloadLengthMask; @@ -183,7 +180,7 @@ class Client extends EventEmitter { debuglog('< %s', payloadStr); const lastChar = payloadStr[payloadStr.length - 1]; if (payloadStr[0] !== '{' || lastChar !== '}') { - throw new Error(`Payload does not look like JSON: ${payloadStr}`); + throw new ERR_DEBUGGER_ERROR(`Payload does not look like JSON: ${payloadStr}`); } let payload; try { @@ -204,7 +201,7 @@ class Client extends EventEmitter { this.emit('debugEvent', method, params); this.emit(method, params); } else { - throw new Error(`Unsupported response: ${payloadStr}`); + throw new ERR_DEBUGGER_ERROR(`Unsupported response: ${payloadStr}`); } } } @@ -226,7 +223,7 @@ class Client extends EventEmitter { callMethod(method, params) { return new Promise((resolve, reject) => { if (!this._socket) { - reject(new Error('Use `run` to start the app again.')); + reject(new ERR_DEBUGGER_ERROR('Use `run` to start the app again.')); return; } const data = { id: ++this._lastId, method, params }; @@ -254,13 +251,13 @@ class Client extends EventEmitter { function parseChunks() { const resBody = Buffer.concat(chunks).toString(); if (httpRes.statusCode !== 200) { - reject(new Error(`Unexpected ${httpRes.statusCode}: ${resBody}`)); + reject(new ERR_DEBUGGER_ERROR(`Unexpected ${httpRes.statusCode}: ${resBody}`)); return; } try { resolve(JSONParse(resBody)); } catch { - reject(new Error(`Response didn't contain JSON: ${resBody}`)); + reject(new ERR_DEBUGGER_ERROR(`Response didn't contain JSON: ${resBody}`)); } } diff --git a/lib/internal/inspector/inspect_repl.js b/lib/internal/inspector/inspect_repl.js index 3cb4d52f43aaf1..5393cb32718300 100644 --- a/lib/internal/inspector/inspect_repl.js +++ b/lib/internal/inspector/inspect_repl.js @@ -1,5 +1,5 @@ // TODO(trott): enable ESLint -/* eslint-disable getter-return, no-restricted-syntax */ +/* eslint-disable getter-return */ 'use strict'; @@ -18,7 +18,6 @@ const { ArrayPrototypeSome, ArrayPrototypeSplice, Date, - Error, FunctionPrototypeCall, JSONStringify, MathMax, @@ -47,9 +46,12 @@ const { StringPrototypeStartsWith, StringPrototypeToUpperCase, StringPrototypeTrim, - TypeError, } = primordials; +const { ERR_DEBUGGER_ERROR } = require('internal/errors').codes; + +const { validateString } = require('internal/validators'); + const FS = require('fs'); const Path = require('path'); const Repl = require('repl'); @@ -176,7 +178,7 @@ function extractErrorMessage(stack) { function convertResultToError(result) { const { className, description } = result; - const err = new Error(extractErrorMessage(description)); + const err = new ERR_DEBUGGER_ERROR(extractErrorMessage(description)); err.stack = description; ObjectDefineProperty(err, 'name', { value: className }); return err; @@ -357,7 +359,7 @@ function createRepl(inspector) { function getCurrentLocation() { if (!selectedFrame) { - throw new Error('Requires execution to be paused'); + throw new ERR_DEBUGGER_ERROR('Requires execution to be paused'); } return selectedFrame.location; } @@ -543,7 +545,7 @@ function createRepl(inspector) { // Repl asked for scope variables if (code === '.scope') { if (!selectedFrame) { - throw new Error('Requires execution to be paused'); + throw new ERR_DEBUGGER_ERROR('Requires execution to be paused'); } const scopes = await selectedFrame.loadScopes(); return ArrayPrototypeMap(scopes, (scope) => scope.completionGroup); @@ -706,9 +708,7 @@ function createRepl(inspector) { registerBreakpoint); } - if (typeof script !== 'string') { - throw new TypeError(`setBreakpoint() expects a string, got ${script}`); - } + validateString(script, 'script'); // setBreakpoint('fn()'): Break when a function is called if (StringPrototypeEndsWith(script, '()')) { diff --git a/lib/internal/streams/destroy.js b/lib/internal/streams/destroy.js index a2892c67a0fcfa..4238e12074d769 100644 --- a/lib/internal/streams/destroy.js +++ b/lib/internal/streams/destroy.js @@ -5,6 +5,7 @@ const { codes: { ERR_MULTIPLE_CALLBACK, }, + AbortError, } = require('internal/errors'); const { Symbol, @@ -363,15 +364,65 @@ function isRequest(stream) { return stream && stream.setHeader && typeof stream.abort === 'function'; } +const kDestroyed = Symbol('kDestroyed'); + +function emitCloseLegacy(stream) { + stream.emit('close'); +} + +function emitErrorCloseLegacy(stream, err) { + stream.emit('error', err); + process.nextTick(emitCloseLegacy, stream); +} + +function isDestroyed(stream) { + return stream.destroyed || stream[kDestroyed]; +} + +function isReadable(stream) { + return stream.readable && !stream.readableEnded && !isDestroyed(stream); +} + +function isWritable(stream) { + return stream.writable && !stream.writableEnded && !isDestroyed(stream); +} + // Normalize destroy for legacy. function destroyer(stream, err) { - if (isRequest(stream)) return stream.abort(); - if (isRequest(stream.req)) return stream.req.abort(); - if (typeof stream.destroy === 'function') return stream.destroy(err); - if (typeof stream.close === 'function') return stream.close(); + if (isDestroyed(stream)) { + return; + } + + if (!err && (isReadable(stream) || isWritable(stream))) { + err = new AbortError(); + } + + // TODO: Remove isRequest branches. + if (typeof stream[kDestroy] === 'function') { + stream[kDestroy](err); + } else if (isRequest(stream)) { + stream.abort(); + } else if (isRequest(stream.req)) { + stream.req.abort(); + } else if (typeof stream.destroy === 'function') { + stream.destroy(err); + } else if (typeof stream.close === 'function') { + // TODO: Don't lose err? + stream.close(); + } else if (err) { + process.nextTick(emitErrorCloseLegacy, stream); + } else { + process.nextTick(emitCloseLegacy, stream); + } + + if (!stream.destroyed) { + stream[kDestroyed] = true; + } } module.exports = { + kDestroy, + isDestroyed, construct, destroyer, destroy, diff --git a/lib/internal/streams/pipeline.js b/lib/internal/streams/pipeline.js index 202a8cf9810d62..a522723b1ffd99 100644 --- a/lib/internal/streams/pipeline.js +++ b/lib/internal/streams/pipeline.js @@ -22,6 +22,7 @@ const { ERR_STREAM_DESTROYED, ERR_STREAM_PREMATURE_CLOSE, }, + AbortError, } = require('internal/errors'); const { validateCallback } = require('internal/validators'); @@ -34,6 +35,7 @@ const { isStream, } = require('internal/streams/utils'); const assert = require('internal/assert'); +const { AbortController } = require('internal/abort_controller'); let PassThrough; let Readable; @@ -176,10 +178,24 @@ function pipeline(...streams) { streams = streams[0]; } + return pipelineImpl(streams, callback); +} + +function pipelineImpl(streams, callback, opts) { if (streams.length < 2) { throw new ERR_MISSING_ARGS('streams'); } + const ac = new AbortController(); + const signal = ac.signal; + const outerSignal = opts?.signal; + + function abort () { + finishImpl(new AbortError()); + } + + outerSignal?.addEventListener('abort', abort); + let error; let value; const destroys = []; @@ -188,7 +204,10 @@ function pipeline(...streams) { function finish(err) { const final = --finishCount === 0; + finishImpl(err, final); + } + function finishImpl(err, final) { if (err && (!error || error.code === 'ERR_STREAM_PREMATURE_CLOSE')) { error = err; } @@ -201,6 +220,9 @@ function pipeline(...streams) { destroys.shift()(error); } + outerSignal?.removeEventListener('abort', abort); + ac.abort(); + if (final) { callback(error, value); } @@ -219,7 +241,7 @@ function pipeline(...streams) { if (i === 0) { if (typeof stream === 'function') { - ret = stream(); + ret = stream(signal); if (!isIterable(ret)) { throw new ERR_INVALID_RETURN_VALUE( 'Iterable, AsyncIterable or Stream', 'source', ret); @@ -233,7 +255,7 @@ function pipeline(...streams) { } } else if (typeof stream === 'function') { ret = makeAsyncIterable(ret); - ret = stream(ret); + ret = stream(ret, signal); if (reading) { if (!isIterable(ret, true)) { @@ -309,4 +331,4 @@ function pipeline(...streams) { return ret; } -module.exports = pipeline; +module.exports = { pipelineImpl, pipeline }; diff --git a/lib/stream.js b/lib/stream.js index 85adda81b32f29..3e4f3cf8288763 100644 --- a/lib/stream.js +++ b/lib/stream.js @@ -29,7 +29,8 @@ const { promisify: { custom: customPromisify }, } = require('internal/util'); -const pipeline = require('internal/streams/pipeline'); +const { pipeline } = require('internal/streams/pipeline'); +const { destroyer } = require('internal/streams/destroy'); const eos = require('internal/streams/end-of-stream'); const internalBuffer = require('internal/buffer'); @@ -45,6 +46,7 @@ Stream.pipeline = pipeline; const { addAbortSignal } = require('internal/streams/add-abort-signal'); Stream.addAbortSignal = addAbortSignal; Stream.finished = eos; +Stream.destroy = destroyer; ObjectDefineProperty(Stream, 'promises', { configurable: true, diff --git a/lib/stream/promises.js b/lib/stream/promises.js index f5d873197323e8..0c8d57c3e5a159 100644 --- a/lib/stream/promises.js +++ b/lib/stream/promises.js @@ -18,7 +18,7 @@ const { isStream, } = require('internal/streams/utils'); -const pl = require('internal/streams/pipeline'); +const { pipelineImpl: pl } = require('internal/streams/pipeline'); const eos = require('internal/streams/end-of-stream'); function pipeline(...streams) { @@ -32,13 +32,13 @@ function pipeline(...streams) { validateAbortSignal(signal, 'options.signal'); } - const pipe = pl(...streams, (err, value) => { + const pipe = pl(streams, (err, value) => { if (err) { reject(err); } else { resolve(value); } - }); + }, { signal }); if (signal) { addAbortSignalNoValidate(signal, pipe); } diff --git a/node.gyp b/node.gyp index 8fc93843789de8..3f674c978d2788 100644 --- a/node.gyp +++ b/node.gyp @@ -657,6 +657,7 @@ 'src/node_trace_events.cc', 'src/node_types.cc', 'src/node_url.cc', + 'src/node_url_tables.cc', 'src/node_util.cc', 'src/node_v8.cc', 'src/node_wasi.cc', diff --git a/node.gypi b/node.gypi index a3c927956ec53f..713ddbb74a1b8e 100644 --- a/node.gypi +++ b/node.gypi @@ -362,7 +362,7 @@ }], ] }, { - # Set 1.0.0 as the API compability level to avoid the + # Set 1.0.0 as the API compatibility level to avoid the # deprecation warnings when using OpenSSL 3.0. 'defines': [ 'OPENSSL_API_COMPAT=0x10000000L', ] }], diff --git a/onboarding.md b/onboarding.md index a70f2157eaefed..d1eca3a4c40f79 100644 --- a/onboarding.md +++ b/onboarding.md @@ -59,12 +59,6 @@ onboarding session. The project has two venues for real-time discussion: * [`#nodejs-dev`](https://openjs-foundation.slack.com/archives/C019Y2T6STH) on the [OpenJS Foundation](https://slack-invite.openjsf.org/) -* `#node-dev` on [webchat.freenode.net](https://webchat.freenode.net/) is a - great place to interact with the TSC and other Collaborators - * If there are any questions after the session, a good place to ask is - there! - * Presence is not mandatory, but please drop a note there if force-pushing - to `master` ## Project goals & values @@ -185,9 +179,6 @@ The project has two venues for real-time discussion: `7006` in the `PR_ID`. * The remaining elements on the form are typically unchanged. * If you need help with something CI-related: - * Use #node-dev (IRC) to talk to other Collaborators. - * Use #node-build (IRC) to talk to the Build WG members who maintain the CI - infrastructure. * Use the [Build WG repo](https://github.com/nodejs/build) to file issues for the Build WG members who maintain the CI infrastructure. diff --git a/src/node_url.cc b/src/node_url.cc index 09f0ff6d9bcc22..4343b672c6a982 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -14,6 +14,14 @@ namespace node { using errors::TryCatchScope; +using url::table_data::hex; +using url::table_data::C0_CONTROL_ENCODE_SET; +using url::table_data::FRAGMENT_ENCODE_SET; +using url::table_data::PATH_ENCODE_SET; +using url::table_data::USERINFO_ENCODE_SET; +using url::table_data::QUERY_ENCODE_SET_NONSPECIAL; +using url::table_data::QUERY_ENCODE_SET_SPECIAL; + using v8::Array; using v8::Context; using v8::Function; @@ -39,7 +47,6 @@ Local Utf8String(Isolate* isolate, const std::string& str) { } namespace url { - namespace { // https://url.spec.whatwg.org/#eof-code-point @@ -230,444 +237,6 @@ CHAR_TEST(16, IsUnicodeSurrogateTrail, (ch & 0x400) != 0) #undef CHAR_TEST #undef TWO_CHAR_STRING_TEST -const char* hex[256] = { - "%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07", - "%08", "%09", "%0A", "%0B", "%0C", "%0D", "%0E", "%0F", - "%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17", - "%18", "%19", "%1A", "%1B", "%1C", "%1D", "%1E", "%1F", - "%20", "%21", "%22", "%23", "%24", "%25", "%26", "%27", - "%28", "%29", "%2A", "%2B", "%2C", "%2D", "%2E", "%2F", - "%30", "%31", "%32", "%33", "%34", "%35", "%36", "%37", - "%38", "%39", "%3A", "%3B", "%3C", "%3D", "%3E", "%3F", - "%40", "%41", "%42", "%43", "%44", "%45", "%46", "%47", - "%48", "%49", "%4A", "%4B", "%4C", "%4D", "%4E", "%4F", - "%50", "%51", "%52", "%53", "%54", "%55", "%56", "%57", - "%58", "%59", "%5A", "%5B", "%5C", "%5D", "%5E", "%5F", - "%60", "%61", "%62", "%63", "%64", "%65", "%66", "%67", - "%68", "%69", "%6A", "%6B", "%6C", "%6D", "%6E", "%6F", - "%70", "%71", "%72", "%73", "%74", "%75", "%76", "%77", - "%78", "%79", "%7A", "%7B", "%7C", "%7D", "%7E", "%7F", - "%80", "%81", "%82", "%83", "%84", "%85", "%86", "%87", - "%88", "%89", "%8A", "%8B", "%8C", "%8D", "%8E", "%8F", - "%90", "%91", "%92", "%93", "%94", "%95", "%96", "%97", - "%98", "%99", "%9A", "%9B", "%9C", "%9D", "%9E", "%9F", - "%A0", "%A1", "%A2", "%A3", "%A4", "%A5", "%A6", "%A7", - "%A8", "%A9", "%AA", "%AB", "%AC", "%AD", "%AE", "%AF", - "%B0", "%B1", "%B2", "%B3", "%B4", "%B5", "%B6", "%B7", - "%B8", "%B9", "%BA", "%BB", "%BC", "%BD", "%BE", "%BF", - "%C0", "%C1", "%C2", "%C3", "%C4", "%C5", "%C6", "%C7", - "%C8", "%C9", "%CA", "%CB", "%CC", "%CD", "%CE", "%CF", - "%D0", "%D1", "%D2", "%D3", "%D4", "%D5", "%D6", "%D7", - "%D8", "%D9", "%DA", "%DB", "%DC", "%DD", "%DE", "%DF", - "%E0", "%E1", "%E2", "%E3", "%E4", "%E5", "%E6", "%E7", - "%E8", "%E9", "%EA", "%EB", "%EC", "%ED", "%EE", "%EF", - "%F0", "%F1", "%F2", "%F3", "%F4", "%F5", "%F6", "%F7", - "%F8", "%F9", "%FA", "%FB", "%FC", "%FD", "%FE", "%FF" -}; - -const uint8_t C0_CONTROL_ENCODE_SET[32] = { - // 00 01 02 03 04 05 06 07 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 08 09 0A 0B 0C 0D 0E 0F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 10 11 12 13 14 15 16 17 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 18 19 1A 1B 1C 1D 1E 1F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 20 21 22 23 24 25 26 27 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 28 29 2A 2B 2C 2D 2E 2F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 30 31 32 33 34 35 36 37 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 38 39 3A 3B 3C 3D 3E 3F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 40 41 42 43 44 45 46 47 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 48 49 4A 4B 4C 4D 4E 4F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 50 51 52 53 54 55 56 57 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 58 59 5A 5B 5C 5D 5E 5F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 60 61 62 63 64 65 66 67 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 68 69 6A 6B 6C 6D 6E 6F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 70 71 72 73 74 75 76 77 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 78 79 7A 7B 7C 7D 7E 7F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x80, - // 80 81 82 83 84 85 86 87 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 88 89 8A 8B 8C 8D 8E 8F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 90 91 92 93 94 95 96 97 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 98 99 9A 9B 9C 9D 9E 9F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // A0 A1 A2 A3 A4 A5 A6 A7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // A8 A9 AA AB AC AD AE AF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // B0 B1 B2 B3 B4 B5 B6 B7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // B8 B9 BA BB BC BD BE BF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // C0 C1 C2 C3 C4 C5 C6 C7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // C8 C9 CA CB CC CD CE CF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // D0 D1 D2 D3 D4 D5 D6 D7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // D8 D9 DA DB DC DD DE DF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // E0 E1 E2 E3 E4 E5 E6 E7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // E8 E9 EA EB EC ED EE EF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // F0 F1 F2 F3 F4 F5 F6 F7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // F8 F9 FA FB FC FD FE FF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80 -}; - -const uint8_t FRAGMENT_ENCODE_SET[32] = { - // 00 01 02 03 04 05 06 07 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 08 09 0A 0B 0C 0D 0E 0F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 10 11 12 13 14 15 16 17 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 18 19 1A 1B 1C 1D 1E 1F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 20 21 22 23 24 25 26 27 - 0x01 | 0x00 | 0x04 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 28 29 2A 2B 2C 2D 2E 2F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 30 31 32 33 34 35 36 37 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 38 39 3A 3B 3C 3D 3E 3F - 0x00 | 0x00 | 0x00 | 0x00 | 0x10 | 0x00 | 0x40 | 0x00, - // 40 41 42 43 44 45 46 47 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 48 49 4A 4B 4C 4D 4E 4F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 50 51 52 53 54 55 56 57 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 58 59 5A 5B 5C 5D 5E 5F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 60 61 62 63 64 65 66 67 - 0x01 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 68 69 6A 6B 6C 6D 6E 6F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 70 71 72 73 74 75 76 77 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 78 79 7A 7B 7C 7D 7E 7F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x80, - // 80 81 82 83 84 85 86 87 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 88 89 8A 8B 8C 8D 8E 8F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 90 91 92 93 94 95 96 97 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 98 99 9A 9B 9C 9D 9E 9F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // A0 A1 A2 A3 A4 A5 A6 A7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // A8 A9 AA AB AC AD AE AF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // B0 B1 B2 B3 B4 B5 B6 B7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // B8 B9 BA BB BC BD BE BF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // C0 C1 C2 C3 C4 C5 C6 C7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // C8 C9 CA CB CC CD CE CF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // D0 D1 D2 D3 D4 D5 D6 D7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // D8 D9 DA DB DC DD DE DF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // E0 E1 E2 E3 E4 E5 E6 E7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // E8 E9 EA EB EC ED EE EF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // F0 F1 F2 F3 F4 F5 F6 F7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // F8 F9 FA FB FC FD FE FF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80 -}; - - -const uint8_t PATH_ENCODE_SET[32] = { - // 00 01 02 03 04 05 06 07 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 08 09 0A 0B 0C 0D 0E 0F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 10 11 12 13 14 15 16 17 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 18 19 1A 1B 1C 1D 1E 1F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 20 21 22 23 24 25 26 27 - 0x01 | 0x00 | 0x04 | 0x08 | 0x00 | 0x00 | 0x00 | 0x00, - // 28 29 2A 2B 2C 2D 2E 2F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 30 31 32 33 34 35 36 37 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 38 39 3A 3B 3C 3D 3E 3F - 0x00 | 0x00 | 0x00 | 0x00 | 0x10 | 0x00 | 0x40 | 0x80, - // 40 41 42 43 44 45 46 47 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 48 49 4A 4B 4C 4D 4E 4F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 50 51 52 53 54 55 56 57 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 58 59 5A 5B 5C 5D 5E 5F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 60 61 62 63 64 65 66 67 - 0x01 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 68 69 6A 6B 6C 6D 6E 6F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 70 71 72 73 74 75 76 77 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 78 79 7A 7B 7C 7D 7E 7F - 0x00 | 0x00 | 0x00 | 0x08 | 0x00 | 0x20 | 0x00 | 0x80, - // 80 81 82 83 84 85 86 87 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 88 89 8A 8B 8C 8D 8E 8F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 90 91 92 93 94 95 96 97 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 98 99 9A 9B 9C 9D 9E 9F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // A0 A1 A2 A3 A4 A5 A6 A7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // A8 A9 AA AB AC AD AE AF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // B0 B1 B2 B3 B4 B5 B6 B7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // B8 B9 BA BB BC BD BE BF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // C0 C1 C2 C3 C4 C5 C6 C7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // C8 C9 CA CB CC CD CE CF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // D0 D1 D2 D3 D4 D5 D6 D7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // D8 D9 DA DB DC DD DE DF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // E0 E1 E2 E3 E4 E5 E6 E7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // E8 E9 EA EB EC ED EE EF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // F0 F1 F2 F3 F4 F5 F6 F7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // F8 F9 FA FB FC FD FE FF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80 -}; - -const uint8_t USERINFO_ENCODE_SET[32] = { - // 00 01 02 03 04 05 06 07 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 08 09 0A 0B 0C 0D 0E 0F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 10 11 12 13 14 15 16 17 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 18 19 1A 1B 1C 1D 1E 1F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 20 21 22 23 24 25 26 27 - 0x01 | 0x00 | 0x04 | 0x08 | 0x00 | 0x00 | 0x00 | 0x00, - // 28 29 2A 2B 2C 2D 2E 2F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x80, - // 30 31 32 33 34 35 36 37 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 38 39 3A 3B 3C 3D 3E 3F - 0x00 | 0x00 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 40 41 42 43 44 45 46 47 - 0x01 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 48 49 4A 4B 4C 4D 4E 4F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 50 51 52 53 54 55 56 57 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 58 59 5A 5B 5C 5D 5E 5F - 0x00 | 0x00 | 0x00 | 0x08 | 0x10 | 0x20 | 0x40 | 0x00, - // 60 61 62 63 64 65 66 67 - 0x01 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 68 69 6A 6B 6C 6D 6E 6F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 70 71 72 73 74 75 76 77 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 78 79 7A 7B 7C 7D 7E 7F - 0x00 | 0x00 | 0x00 | 0x08 | 0x10 | 0x20 | 0x00 | 0x80, - // 80 81 82 83 84 85 86 87 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 88 89 8A 8B 8C 8D 8E 8F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 90 91 92 93 94 95 96 97 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 98 99 9A 9B 9C 9D 9E 9F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // A0 A1 A2 A3 A4 A5 A6 A7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // A8 A9 AA AB AC AD AE AF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // B0 B1 B2 B3 B4 B5 B6 B7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // B8 B9 BA BB BC BD BE BF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // C0 C1 C2 C3 C4 C5 C6 C7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // C8 C9 CA CB CC CD CE CF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // D0 D1 D2 D3 D4 D5 D6 D7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // D8 D9 DA DB DC DD DE DF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // E0 E1 E2 E3 E4 E5 E6 E7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // E8 E9 EA EB EC ED EE EF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // F0 F1 F2 F3 F4 F5 F6 F7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // F8 F9 FA FB FC FD FE FF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80 -}; - -const uint8_t QUERY_ENCODE_SET_NONSPECIAL[32] = { - // 00 01 02 03 04 05 06 07 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 08 09 0A 0B 0C 0D 0E 0F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 10 11 12 13 14 15 16 17 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 18 19 1A 1B 1C 1D 1E 1F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 20 21 22 23 24 25 26 27 - 0x01 | 0x00 | 0x04 | 0x08 | 0x00 | 0x00 | 0x00 | 0x00, - // 28 29 2A 2B 2C 2D 2E 2F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 30 31 32 33 34 35 36 37 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 38 39 3A 3B 3C 3D 3E 3F - 0x00 | 0x00 | 0x00 | 0x00 | 0x10 | 0x00 | 0x40 | 0x00, - // 40 41 42 43 44 45 46 47 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 48 49 4A 4B 4C 4D 4E 4F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 50 51 52 53 54 55 56 57 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 58 59 5A 5B 5C 5D 5E 5F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 60 61 62 63 64 65 66 67 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 68 69 6A 6B 6C 6D 6E 6F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 70 71 72 73 74 75 76 77 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 78 79 7A 7B 7C 7D 7E 7F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x80, - // 80 81 82 83 84 85 86 87 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 88 89 8A 8B 8C 8D 8E 8F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 90 91 92 93 94 95 96 97 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 98 99 9A 9B 9C 9D 9E 9F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // A0 A1 A2 A3 A4 A5 A6 A7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // A8 A9 AA AB AC AD AE AF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // B0 B1 B2 B3 B4 B5 B6 B7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // B8 B9 BA BB BC BD BE BF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // C0 C1 C2 C3 C4 C5 C6 C7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // C8 C9 CA CB CC CD CE CF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // D0 D1 D2 D3 D4 D5 D6 D7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // D8 D9 DA DB DC DD DE DF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // E0 E1 E2 E3 E4 E5 E6 E7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // E8 E9 EA EB EC ED EE EF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // F0 F1 F2 F3 F4 F5 F6 F7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // F8 F9 FA FB FC FD FE FF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80 -}; - -// Same as QUERY_ENCODE_SET_NONSPECIAL, but with 0x27 (') encoded. -const uint8_t QUERY_ENCODE_SET_SPECIAL[32] = { - // 00 01 02 03 04 05 06 07 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 08 09 0A 0B 0C 0D 0E 0F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 10 11 12 13 14 15 16 17 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 18 19 1A 1B 1C 1D 1E 1F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 20 21 22 23 24 25 26 27 - 0x01 | 0x00 | 0x04 | 0x08 | 0x00 | 0x00 | 0x00 | 0x80, - // 28 29 2A 2B 2C 2D 2E 2F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 30 31 32 33 34 35 36 37 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 38 39 3A 3B 3C 3D 3E 3F - 0x00 | 0x00 | 0x00 | 0x00 | 0x10 | 0x00 | 0x40 | 0x00, - // 40 41 42 43 44 45 46 47 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 48 49 4A 4B 4C 4D 4E 4F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 50 51 52 53 54 55 56 57 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 58 59 5A 5B 5C 5D 5E 5F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 60 61 62 63 64 65 66 67 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 68 69 6A 6B 6C 6D 6E 6F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 70 71 72 73 74 75 76 77 - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, - // 78 79 7A 7B 7C 7D 7E 7F - 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x80, - // 80 81 82 83 84 85 86 87 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 88 89 8A 8B 8C 8D 8E 8F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 90 91 92 93 94 95 96 97 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // 98 99 9A 9B 9C 9D 9E 9F - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // A0 A1 A2 A3 A4 A5 A6 A7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // A8 A9 AA AB AC AD AE AF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // B0 B1 B2 B3 B4 B5 B6 B7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // B8 B9 BA BB BC BD BE BF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // C0 C1 C2 C3 C4 C5 C6 C7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // C8 C9 CA CB CC CD CE CF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // D0 D1 D2 D3 D4 D5 D6 D7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // D8 D9 DA DB DC DD DE DF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // E0 E1 E2 E3 E4 E5 E6 E7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // E8 E9 EA EB EC ED EE EF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // F0 F1 F2 F3 F4 F5 F6 F7 - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, - // F8 F9 FA FB FC FD FE FF - 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80 -}; bool BitAt(const uint8_t a[], const uint8_t i) { return !!(a[i >> 3] & (1 << (i & 7))); @@ -676,10 +245,10 @@ bool BitAt(const uint8_t a[], const uint8_t i) { // Appends ch to str. If ch position in encode_set is set, the ch will // be percent-encoded then appended. void AppendOrEscape(std::string* str, - const unsigned char ch, - const uint8_t encode_set[]) { + const unsigned char ch, + const uint8_t encode_set[]) { if (BitAt(encode_set, ch)) - *str += hex[ch]; + *str += hex + ch * 4; // "%XX\0" has a length of 4 else *str += ch; } diff --git a/src/node_url.h b/src/node_url.h index e42c2627179fcc..0de05e96e100fa 100644 --- a/src/node_url.h +++ b/src/node_url.h @@ -74,6 +74,16 @@ struct url_data { std::string href; }; +namespace table_data { +extern const char hex[1024]; +extern const uint8_t C0_CONTROL_ENCODE_SET[32]; +extern const uint8_t FRAGMENT_ENCODE_SET[32]; +extern const uint8_t PATH_ENCODE_SET[32]; +extern const uint8_t USERINFO_ENCODE_SET[32]; +extern const uint8_t QUERY_ENCODE_SET_NONSPECIAL[32]; +extern const uint8_t QUERY_ENCODE_SET_SPECIAL[32]; +} + class URL { public: static void Parse(const char* input, diff --git a/src/node_url_tables.cc b/src/node_url_tables.cc new file mode 100644 index 00000000000000..801badf838dc83 --- /dev/null +++ b/src/node_url_tables.cc @@ -0,0 +1,448 @@ +#include +#include "node_url.h" + +namespace node { +namespace url { +namespace table_data { + +const char hex[1024] = + "%00\0%01\0%02\0%03\0%04\0%05\0%06\0%07\0" + "%08\0%09\0%0A\0%0B\0%0C\0%0D\0%0E\0%0F\0" + "%10\0%11\0%12\0%13\0%14\0%15\0%16\0%17\0" + "%18\0%19\0%1A\0%1B\0%1C\0%1D\0%1E\0%1F\0" + "%20\0%21\0%22\0%23\0%24\0%25\0%26\0%27\0" + "%28\0%29\0%2A\0%2B\0%2C\0%2D\0%2E\0%2F\0" + "%30\0%31\0%32\0%33\0%34\0%35\0%36\0%37\0" + "%38\0%39\0%3A\0%3B\0%3C\0%3D\0%3E\0%3F\0" + "%40\0%41\0%42\0%43\0%44\0%45\0%46\0%47\0" + "%48\0%49\0%4A\0%4B\0%4C\0%4D\0%4E\0%4F\0" + "%50\0%51\0%52\0%53\0%54\0%55\0%56\0%57\0" + "%58\0%59\0%5A\0%5B\0%5C\0%5D\0%5E\0%5F\0" + "%60\0%61\0%62\0%63\0%64\0%65\0%66\0%67\0" + "%68\0%69\0%6A\0%6B\0%6C\0%6D\0%6E\0%6F\0" + "%70\0%71\0%72\0%73\0%74\0%75\0%76\0%77\0" + "%78\0%79\0%7A\0%7B\0%7C\0%7D\0%7E\0%7F\0" + "%80\0%81\0%82\0%83\0%84\0%85\0%86\0%87\0" + "%88\0%89\0%8A\0%8B\0%8C\0%8D\0%8E\0%8F\0" + "%90\0%91\0%92\0%93\0%94\0%95\0%96\0%97\0" + "%98\0%99\0%9A\0%9B\0%9C\0%9D\0%9E\0%9F\0" + "%A0\0%A1\0%A2\0%A3\0%A4\0%A5\0%A6\0%A7\0" + "%A8\0%A9\0%AA\0%AB\0%AC\0%AD\0%AE\0%AF\0" + "%B0\0%B1\0%B2\0%B3\0%B4\0%B5\0%B6\0%B7\0" + "%B8\0%B9\0%BA\0%BB\0%BC\0%BD\0%BE\0%BF\0" + "%C0\0%C1\0%C2\0%C3\0%C4\0%C5\0%C6\0%C7\0" + "%C8\0%C9\0%CA\0%CB\0%CC\0%CD\0%CE\0%CF\0" + "%D0\0%D1\0%D2\0%D3\0%D4\0%D5\0%D6\0%D7\0" + "%D8\0%D9\0%DA\0%DB\0%DC\0%DD\0%DE\0%DF\0" + "%E0\0%E1\0%E2\0%E3\0%E4\0%E5\0%E6\0%E7\0" + "%E8\0%E9\0%EA\0%EB\0%EC\0%ED\0%EE\0%EF\0" + "%F0\0%F1\0%F2\0%F3\0%F4\0%F5\0%F6\0%F7\0" + "%F8\0%F9\0%FA\0%FB\0%FC\0%FD\0%FE\0%FF"; + +const uint8_t C0_CONTROL_ENCODE_SET[32] = { + // 00 01 02 03 04 05 06 07 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 08 09 0A 0B 0C 0D 0E 0F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 10 11 12 13 14 15 16 17 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 18 19 1A 1B 1C 1D 1E 1F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 20 21 22 23 24 25 26 27 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 28 29 2A 2B 2C 2D 2E 2F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 30 31 32 33 34 35 36 37 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 38 39 3A 3B 3C 3D 3E 3F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 40 41 42 43 44 45 46 47 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 48 49 4A 4B 4C 4D 4E 4F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 50 51 52 53 54 55 56 57 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 58 59 5A 5B 5C 5D 5E 5F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 60 61 62 63 64 65 66 67 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 68 69 6A 6B 6C 6D 6E 6F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 70 71 72 73 74 75 76 77 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 78 79 7A 7B 7C 7D 7E 7F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x80, + // 80 81 82 83 84 85 86 87 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 88 89 8A 8B 8C 8D 8E 8F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 90 91 92 93 94 95 96 97 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 98 99 9A 9B 9C 9D 9E 9F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // A0 A1 A2 A3 A4 A5 A6 A7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // A8 A9 AA AB AC AD AE AF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // B0 B1 B2 B3 B4 B5 B6 B7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // B8 B9 BA BB BC BD BE BF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // C0 C1 C2 C3 C4 C5 C6 C7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // C8 C9 CA CB CC CD CE CF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // D0 D1 D2 D3 D4 D5 D6 D7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // D8 D9 DA DB DC DD DE DF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // E0 E1 E2 E3 E4 E5 E6 E7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // E8 E9 EA EB EC ED EE EF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // F0 F1 F2 F3 F4 F5 F6 F7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // F8 F9 FA FB FC FD FE FF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80 +}; + +const uint8_t FRAGMENT_ENCODE_SET[32] = { + // 00 01 02 03 04 05 06 07 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 08 09 0A 0B 0C 0D 0E 0F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 10 11 12 13 14 15 16 17 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 18 19 1A 1B 1C 1D 1E 1F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 20 21 22 23 24 25 26 27 + 0x01 | 0x00 | 0x04 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 28 29 2A 2B 2C 2D 2E 2F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 30 31 32 33 34 35 36 37 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 38 39 3A 3B 3C 3D 3E 3F + 0x00 | 0x00 | 0x00 | 0x00 | 0x10 | 0x00 | 0x40 | 0x00, + // 40 41 42 43 44 45 46 47 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 48 49 4A 4B 4C 4D 4E 4F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 50 51 52 53 54 55 56 57 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 58 59 5A 5B 5C 5D 5E 5F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 60 61 62 63 64 65 66 67 + 0x01 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 68 69 6A 6B 6C 6D 6E 6F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 70 71 72 73 74 75 76 77 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 78 79 7A 7B 7C 7D 7E 7F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x80, + // 80 81 82 83 84 85 86 87 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 88 89 8A 8B 8C 8D 8E 8F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 90 91 92 93 94 95 96 97 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 98 99 9A 9B 9C 9D 9E 9F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // A0 A1 A2 A3 A4 A5 A6 A7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // A8 A9 AA AB AC AD AE AF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // B0 B1 B2 B3 B4 B5 B6 B7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // B8 B9 BA BB BC BD BE BF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // C0 C1 C2 C3 C4 C5 C6 C7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // C8 C9 CA CB CC CD CE CF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // D0 D1 D2 D3 D4 D5 D6 D7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // D8 D9 DA DB DC DD DE DF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // E0 E1 E2 E3 E4 E5 E6 E7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // E8 E9 EA EB EC ED EE EF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // F0 F1 F2 F3 F4 F5 F6 F7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // F8 F9 FA FB FC FD FE FF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80 +}; + + +const uint8_t PATH_ENCODE_SET[32] = { + // 00 01 02 03 04 05 06 07 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 08 09 0A 0B 0C 0D 0E 0F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 10 11 12 13 14 15 16 17 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 18 19 1A 1B 1C 1D 1E 1F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 20 21 22 23 24 25 26 27 + 0x01 | 0x00 | 0x04 | 0x08 | 0x00 | 0x00 | 0x00 | 0x00, + // 28 29 2A 2B 2C 2D 2E 2F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 30 31 32 33 34 35 36 37 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 38 39 3A 3B 3C 3D 3E 3F + 0x00 | 0x00 | 0x00 | 0x00 | 0x10 | 0x00 | 0x40 | 0x80, + // 40 41 42 43 44 45 46 47 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 48 49 4A 4B 4C 4D 4E 4F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 50 51 52 53 54 55 56 57 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 58 59 5A 5B 5C 5D 5E 5F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 60 61 62 63 64 65 66 67 + 0x01 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 68 69 6A 6B 6C 6D 6E 6F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 70 71 72 73 74 75 76 77 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 78 79 7A 7B 7C 7D 7E 7F + 0x00 | 0x00 | 0x00 | 0x08 | 0x00 | 0x20 | 0x00 | 0x80, + // 80 81 82 83 84 85 86 87 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 88 89 8A 8B 8C 8D 8E 8F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 90 91 92 93 94 95 96 97 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 98 99 9A 9B 9C 9D 9E 9F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // A0 A1 A2 A3 A4 A5 A6 A7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // A8 A9 AA AB AC AD AE AF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // B0 B1 B2 B3 B4 B5 B6 B7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // B8 B9 BA BB BC BD BE BF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // C0 C1 C2 C3 C4 C5 C6 C7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // C8 C9 CA CB CC CD CE CF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // D0 D1 D2 D3 D4 D5 D6 D7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // D8 D9 DA DB DC DD DE DF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // E0 E1 E2 E3 E4 E5 E6 E7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // E8 E9 EA EB EC ED EE EF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // F0 F1 F2 F3 F4 F5 F6 F7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // F8 F9 FA FB FC FD FE FF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80 +}; + +const uint8_t USERINFO_ENCODE_SET[32] = { + // 00 01 02 03 04 05 06 07 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 08 09 0A 0B 0C 0D 0E 0F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 10 11 12 13 14 15 16 17 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 18 19 1A 1B 1C 1D 1E 1F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 20 21 22 23 24 25 26 27 + 0x01 | 0x00 | 0x04 | 0x08 | 0x00 | 0x00 | 0x00 | 0x00, + // 28 29 2A 2B 2C 2D 2E 2F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x80, + // 30 31 32 33 34 35 36 37 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 38 39 3A 3B 3C 3D 3E 3F + 0x00 | 0x00 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 40 41 42 43 44 45 46 47 + 0x01 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 48 49 4A 4B 4C 4D 4E 4F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 50 51 52 53 54 55 56 57 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 58 59 5A 5B 5C 5D 5E 5F + 0x00 | 0x00 | 0x00 | 0x08 | 0x10 | 0x20 | 0x40 | 0x00, + // 60 61 62 63 64 65 66 67 + 0x01 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 68 69 6A 6B 6C 6D 6E 6F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 70 71 72 73 74 75 76 77 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 78 79 7A 7B 7C 7D 7E 7F + 0x00 | 0x00 | 0x00 | 0x08 | 0x10 | 0x20 | 0x00 | 0x80, + // 80 81 82 83 84 85 86 87 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 88 89 8A 8B 8C 8D 8E 8F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 90 91 92 93 94 95 96 97 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 98 99 9A 9B 9C 9D 9E 9F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // A0 A1 A2 A3 A4 A5 A6 A7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // A8 A9 AA AB AC AD AE AF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // B0 B1 B2 B3 B4 B5 B6 B7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // B8 B9 BA BB BC BD BE BF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // C0 C1 C2 C3 C4 C5 C6 C7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // C8 C9 CA CB CC CD CE CF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // D0 D1 D2 D3 D4 D5 D6 D7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // D8 D9 DA DB DC DD DE DF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // E0 E1 E2 E3 E4 E5 E6 E7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // E8 E9 EA EB EC ED EE EF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // F0 F1 F2 F3 F4 F5 F6 F7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // F8 F9 FA FB FC FD FE FF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80 +}; + +const uint8_t QUERY_ENCODE_SET_NONSPECIAL[32] = { + // 00 01 02 03 04 05 06 07 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 08 09 0A 0B 0C 0D 0E 0F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 10 11 12 13 14 15 16 17 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 18 19 1A 1B 1C 1D 1E 1F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 20 21 22 23 24 25 26 27 + 0x01 | 0x00 | 0x04 | 0x08 | 0x00 | 0x00 | 0x00 | 0x00, + // 28 29 2A 2B 2C 2D 2E 2F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 30 31 32 33 34 35 36 37 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 38 39 3A 3B 3C 3D 3E 3F + 0x00 | 0x00 | 0x00 | 0x00 | 0x10 | 0x00 | 0x40 | 0x00, + // 40 41 42 43 44 45 46 47 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 48 49 4A 4B 4C 4D 4E 4F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 50 51 52 53 54 55 56 57 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 58 59 5A 5B 5C 5D 5E 5F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 60 61 62 63 64 65 66 67 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 68 69 6A 6B 6C 6D 6E 6F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 70 71 72 73 74 75 76 77 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 78 79 7A 7B 7C 7D 7E 7F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x80, + // 80 81 82 83 84 85 86 87 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 88 89 8A 8B 8C 8D 8E 8F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 90 91 92 93 94 95 96 97 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 98 99 9A 9B 9C 9D 9E 9F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // A0 A1 A2 A3 A4 A5 A6 A7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // A8 A9 AA AB AC AD AE AF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // B0 B1 B2 B3 B4 B5 B6 B7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // B8 B9 BA BB BC BD BE BF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // C0 C1 C2 C3 C4 C5 C6 C7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // C8 C9 CA CB CC CD CE CF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // D0 D1 D2 D3 D4 D5 D6 D7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // D8 D9 DA DB DC DD DE DF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // E0 E1 E2 E3 E4 E5 E6 E7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // E8 E9 EA EB EC ED EE EF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // F0 F1 F2 F3 F4 F5 F6 F7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // F8 F9 FA FB FC FD FE FF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80 +}; + +// Same as QUERY_ENCODE_SET_NONSPECIAL, but with 0x27 (') encoded. +const uint8_t QUERY_ENCODE_SET_SPECIAL[32] = { + // 00 01 02 03 04 05 06 07 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 08 09 0A 0B 0C 0D 0E 0F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 10 11 12 13 14 15 16 17 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 18 19 1A 1B 1C 1D 1E 1F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 20 21 22 23 24 25 26 27 + 0x01 | 0x00 | 0x04 | 0x08 | 0x00 | 0x00 | 0x00 | 0x80, + // 28 29 2A 2B 2C 2D 2E 2F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 30 31 32 33 34 35 36 37 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 38 39 3A 3B 3C 3D 3E 3F + 0x00 | 0x00 | 0x00 | 0x00 | 0x10 | 0x00 | 0x40 | 0x00, + // 40 41 42 43 44 45 46 47 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 48 49 4A 4B 4C 4D 4E 4F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 50 51 52 53 54 55 56 57 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 58 59 5A 5B 5C 5D 5E 5F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 60 61 62 63 64 65 66 67 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 68 69 6A 6B 6C 6D 6E 6F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 70 71 72 73 74 75 76 77 + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00, + // 78 79 7A 7B 7C 7D 7E 7F + 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x00 | 0x80, + // 80 81 82 83 84 85 86 87 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 88 89 8A 8B 8C 8D 8E 8F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 90 91 92 93 94 95 96 97 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // 98 99 9A 9B 9C 9D 9E 9F + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // A0 A1 A2 A3 A4 A5 A6 A7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // A8 A9 AA AB AC AD AE AF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // B0 B1 B2 B3 B4 B5 B6 B7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // B8 B9 BA BB BC BD BE BF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // C0 C1 C2 C3 C4 C5 C6 C7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // C8 C9 CA CB CC CD CE CF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // D0 D1 D2 D3 D4 D5 D6 D7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // D8 D9 DA DB DC DD DE DF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // E0 E1 E2 E3 E4 E5 E6 E7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // E8 E9 EA EB EC ED EE EF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // F0 F1 F2 F3 F4 F5 F6 F7 + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80, + // F8 F9 FA FB FC FD FE FF + 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80 +}; + +} // namespace table_data +} // namespace url +} // namespace node diff --git a/src/util.cc b/src/util.cc index 40ea25b8d2edfe..e181fdf568cd18 100644 --- a/src/util.cc +++ b/src/util.cc @@ -223,8 +223,13 @@ int WriteFileSync(v8::Isolate* isolate, int ReadFileSync(std::string* result, const char* path) { uv_fs_t req; + auto defer_req_cleanup = OnScopeLeave([&req]() { + uv_fs_req_cleanup(&req); + }); + uv_file file = uv_fs_open(nullptr, &req, path, O_RDONLY, 0, nullptr); if (req.result < 0) { + // req will be cleaned up by scope leave. return req.result; } uv_fs_req_cleanup(&req); @@ -243,7 +248,7 @@ int ReadFileSync(std::string* result, const char* path) { const int r = uv_fs_read(nullptr, &req, file, &buf, 1, result->length(), nullptr); if (req.result < 0) { - uv_fs_req_cleanup(&req); + // req will be cleaned up by scope leave. return req.result; } uv_fs_req_cleanup(&req); diff --git a/test/common/README.md b/test/common/README.md index ea4d4e401be64e..7b76c1a746c656 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -925,8 +925,8 @@ functionality. * `dir` [<string>][] Directory to search for diagnostic report files. * return [<Array>][] -Returns an array of diagnotic report file names found in `dir`. The files should -have been generated by a process whose PID matches `pid`. +Returns an array of diagnostic report file names found in `dir`. The files +should have been generated by a process whose PID matches `pid`. ### `validate(filepath)` diff --git a/test/fixtures/inspector-cli/cjs/index.js b/test/fixtures/inspector-cli/cjs/index.js index 0ace6d9b78591c..c9bf53d1b4e61b 100644 --- a/test/fixtures/inspector-cli/cjs/index.js +++ b/test/fixtures/inspector-cli/cjs/index.js @@ -1,5 +1,5 @@ -const fourty = 40; +const forty = 40; const { add } = require('./other'); -const sum = add(fourty, 2); +const sum = add(forty, 2); module.exports = sum; diff --git a/test/parallel/test-stream-destroy.js b/test/parallel/test-stream-destroy.js new file mode 100644 index 00000000000000..f99c29c811932d --- /dev/null +++ b/test/parallel/test-stream-destroy.js @@ -0,0 +1,115 @@ +'use strict'; + +const common = require('../common'); +const { + Writable, + Readable, + destroy +} = require('stream'); +const assert = require('assert'); +const http = require('http'); + +{ + const r = new Readable({ read() {} }); + destroy(r); + assert.strictEqual(r.destroyed, true); + r.on('error', common.mustCall((err) => { + assert.strictEqual(err.name, 'AbortError'); + })); + r.on('close', common.mustCall()); +} + +{ + const r = new Readable({ read() {} }); + destroy(r, new Error('asd')); + assert.strictEqual(r.destroyed, true); + r.on('error', common.mustCall((err) => { + assert.strictEqual(err.message, 'asd'); + })); + r.on('close', common.mustCall()); +} + +{ + const w = new Writable({ write() {} }); + destroy(w); + assert.strictEqual(w.destroyed, true); + w.on('error', common.mustCall((err) => { + assert.strictEqual(err.name, 'AbortError'); + })); + w.on('close', common.mustCall()); +} + +{ + const w = new Writable({ write() {} }); + destroy(w, new Error('asd')); + assert.strictEqual(w.destroyed, true); + w.on('error', common.mustCall((err) => { + assert.strictEqual(err.message, 'asd'); + })); + w.on('close', common.mustCall()); +} + +{ + const server = http.createServer((req, res) => { + destroy(req); + req.on('error', common.mustCall((err) => { + assert.strictEqual(err.name, 'AbortError'); + })); + req.on('close', common.mustCall(() => { + res.end('hello'); + })); + }); + + server.listen(0, () => { + const req = http.request({ + port: server.address().port + }); + + req.write('asd'); + req.on('response', (res) => { + const buf = []; + res.on('data', (data) => buf.push(data)); + res.on('end', common.mustCall(() => { + assert.deepStrictEqual( + Buffer.concat(buf), + Buffer.from('hello') + ); + server.close(); + })); + }); + }); +} + +{ + const server = http.createServer((req, res) => { + req + .resume() + .on('end', () => { + destroy(req); + }) + .on('error', common.mustNotCall()); + + req.on('close', common.mustCall(() => { + res.end('hello'); + })); + }); + + server.listen(0, () => { + const req = http.request({ + port: server.address().port + }); + + req.write('asd'); + req.on('response', (res) => { + const buf = []; + res.on('data', (data) => buf.push(data)); + res.on('end', common.mustCall(() => { + assert.deepStrictEqual( + Buffer.concat(buf), + Buffer.from('hello') + ); + server.close(); + })); + }); + }); +} diff --git a/test/parallel/test-stream-pipeline.js b/test/parallel/test-stream-pipeline.js index aaf726ea5a0350..c7593ec5c66bd6 100644 --- a/test/parallel/test-stream-pipeline.js +++ b/test/parallel/test-stream-pipeline.js @@ -11,10 +11,12 @@ const { Duplex, addAbortSignal, } = require('stream'); +const pipelinep = require('stream/promises').pipeline const assert = require('assert'); const http = require('http'); const { promisify } = require('util'); const net = require('net'); +const tsp = require('timers/promises'); { let finished = false; @@ -1420,3 +1422,20 @@ const net = require('net'); writableLike.emit('close'); } + +{ + const ac = new AbortController(); + const signal = ac.signal; + pipelinep( + async function * (signal) { + await tsp.setTimeout(1e6, signal); + }, + async function (source) { + + }, + { signal } + ).catch(common.mustCall((err) => { + assert.strictEqual(err.name, 'AbortError'); + })); + ac.abort(); +}