753f3b247a
http: add requestTimeout
...
This commits introduces a new http.Server option called requestTimeout
with a default value in milliseconds of 0.
If requestTimeout is set to a positive value, the server will start a new
timer set to expire in requestTimeout milliseconds when a new connection
is established. The timer is also set again if new requests after the
first are received on the socket (this handles pipelining and keep-alive
cases).
The timer is cancelled when:
1. the request body is completely received by the server.
2. the response is completed. This handles the case where the
application responds to the client without consuming the request body.
3. the connection is upgraded, like in the WebSocket case.
If the timer expires, then the server responds with status code 408 and
closes the connection.
CVE-2020-8251
PR-URL: https://github.com/nodejs-private/node-private/pull/208
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Mary Marchini <oss@mmarchini.me >
Co-Authored-By: Paolo Insogna <paolo@cowtech.it >
Co-Authored-By: Robert Nagy <ronagy@icloud.com >
2020-09-15 11:20:08 -04:00
Richard Lau
0f94c6b4e4
Revert "stream: simpler and faster Readable async iterator"
...
This reverts commit 4bb40078da .
2020-09-09 19:49:34 -04:00
Robert Nagy
4bb40078da
stream: simpler and faster Readable async iterator
...
Reimplement as an async generator instead of a custom
iterator class.
Backport-PR-URL: https://github.com/nodejs/node/pull/34887
PR-URL: https://github.com/nodejs/node/pull/34035
Refs: https://github.com/nodejs/node/issues/34680
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-09-07 12:30:02 -04:00
Robert Nagy
ffae5f3809
stream: save error in state
...
Useful for future PR's to resolve situations where e.g. finished()
is invoked on an already errored streams.
PR-URL: https://github.com/nodejs/node/pull/34103
Backport-PR-URL: https://github.com/nodejs/node/pull/34887
Refs: https://github.com/nodejs/node/issues/34680
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2020-09-07 12:30:00 -04:00
Rich Trott
178a740caf
crypto: simplify KeyObject constructor
...
Inline a function that only gets called in the constructor. Make call to
`super()` more straightforward in the process by removing conditional
involving the function as it only ever returns `undefined` or else
throws. That made the code a little hard to understand, as without
looking at the function, one would likely expect it to return `true`
on success rather than `undefined`.
PR-URL: https://github.com/nodejs/node/pull/35064
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2020-09-07 12:29:58 -04:00
Tobias Nießen
a12d92c97b
crypto: fix randomInt range check
...
Refs: https://github.com/nodejs/node/pull/34600
PR-URL: https://github.com/nodejs/node/pull/35052
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2020-09-07 12:29:51 -04:00
Guy Bedford
1fdfaa578f
bootstrap: correct --frozen-intrinsics override fix
...
PR-URL: https://github.com/nodejs/node/pull/35041
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-09-07 12:29:49 -04:00
Rich Trott
6d0d5b2ec2
crypto: align parameter names with documentation
...
Change _cb_ to _callback_ to align with documentation. This is so that
stack traces and error messages align with the documentation. If the
documentation says "callback", then the stack traces and error messages
should indicate that "callback" needs to be function or whatever, rather
than "cb".
PR-URL: https://github.com/nodejs/node/pull/35054
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2020-09-07 12:29:39 -04:00
Oli Lalonde
44d89a9faa
crypto: add randomInt function
...
PR-URL: https://github.com/nodejs/node/pull/34600
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2020-09-07 12:29:20 -04:00
Daijiro Wachi
1bf5d1a39b
querystring: manage percent character at unescape
...
Related: https://github.com/nodejs/node/issues/33892
Fixes: https://github.com/nodejs/node/issues/35012
PR-URL: https://github.com/nodejs/node/pull/35013
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Shingo Inoue <leko.noor@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-09-07 12:29:19 -04:00
Anna Henningsen
2ab33c58ae
buffer: also alias BigUInt methods
...
These were overlooked in 5864fca7bc because of the extra
`Big` in the name. :)
Refs: https://github.com/nodejs/node/pull/34729
PR-URL: https://github.com/nodejs/node/pull/34960
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2020-09-03 07:02:16 -04:00
Denys Otrishko
5f24cea11a
stream: fix Readable stream state properties
...
Looks like they have been accidentally moved in
https://github.com/nodejs/node/pull/31144 .
PR-URL: https://github.com/nodejs/node/pull/34886
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Zeyu Yang <himself65@outlook.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
Reviewed-By: Ricky Zhou <0x19951125@gmail.com >
2020-09-03 07:02:13 -04:00
Rich Trott
db8c66b8c2
esm: shorten ERR_UNSUPPORTED_ESM_URL_SCHEME message
...
I know it just got modified to include new information, but this
shortens the message a bit without (I hope) losing clarity or meaning.
PR-URL: https://github.com/nodejs/node/pull/34836
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
2020-09-01 11:27:48 -04:00
Anna Henningsen
f537c868b9
stream: allow using .push()/.unshift() during once('data')
...
Previously, the `.push()` or `.unshift()` call would just have jumped
straight to emitting a `'data'` event, even if there were no listeners,
effectively just silently dropping the chunk.
PR-URL: https://github.com/nodejs/node/pull/34957
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Ricky Zhou <0x19951125@gmail.com >
2020-09-01 11:27:47 -04:00
Trevor Norris
8aac42caf2
perf_hooks: add idleTime and event loop util
...
Use uv_metrics_idle_time() to return a high resolution millisecond timer
of the amount of time the event loop has been idle since it was
initialized.
Include performance.eventLoopUtilization() API to handle the math of
calculating the idle and active times. This has been added to prevent
accidental miscalculations of the event loop utilization. Such as not
taking into consideration offsetting nodeTiming.loopStart or timing
differences when being called from a Worker thread.
PR-URL: https://github.com/nodejs/node/pull/34938
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Adrian Estrada <edsadr@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
2020-09-01 11:22:24 -04:00
Denys Otrishko
fcb211f38a
net: replace usage of internal stream state with public api
...
Refs: https://github.com/nodejs/node/issues/445
PR-URL: https://github.com/nodejs/node/pull/34885
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ricky Zhou <0x19951125@gmail.com >
2020-09-01 11:22:22 -04:00
Denys Otrishko
94528f510e
zlib: replace usage of internal stream state with public api
...
Refs: https://github.com/nodejs/node/issues/445
PR-URL: https://github.com/nodejs/node/pull/34884
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2020-09-01 11:22:21 -04:00
Bradley Farias
18b04ab4c8
policy: implement scopes field
...
PR-URL: https://github.com/nodejs/node/pull/34552
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-09-01 11:15:46 -04:00
ExE Boss
fffba3a270
errors: use ErrorPrototypeToString from primordials object
...
PR-URL: https://github.com/nodejs/node/pull/34891
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2020-09-01 11:15:37 -04:00
João Lucas Lucchetta
cc7258469c
http2: fix Http2Response.sendDate
...
The `sendDate` flag was not being respected
by the current implementation and the `Date`
header was being sent regardless of the config.
This commit fixes that and adds tests for this case.
Fixes: https://github.com/nodejs/node/issues/34841
PR-URL: https://github.com/nodejs/node/pull/34850
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ricky Zhou <0x19951125@gmail.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-08-24 12:19:58 +01:00
Carlos Lopez
9e0d18fd3f
http2: use and support non-empty DATA frame with END_STREAM flag
...
Adds support for reading from a stream where the final frame is a
non-empty DATA frame with the END_STREAM flag set, instead of hanging
waiting for another frame. When writing to a stream, uses a
END_STREAM flag on final DATA frame instead of adding an empty
DATA frame.
BREAKING: http2 client now expects servers to properly support
END_STREAM flag
Fixes: https://github.com/nodejs/node/issues/31309
Fixes: https://github.com/nodejs/node/issues/33891
Refs: https://nghttp2.org/documentation/types.html#c.nghttp2_on_data_chunk_recv_callback
PR-URL: https://github.com/nodejs/node/pull/33875
Backport-PR-URL: https://github.com/nodejs/node/pull/34838
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-08-21 03:48:51 -04:00
Antoine du HAMEL
b73943e476
workers: add support for data: URLs
...
PR-URL: https://github.com/nodejs/node/pull/34584
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
2020-08-20 15:05:24 +01:00
cjihrig
90abdd3dd4
net: validate custom lookup() output
...
This commit adds validation to the IP address returned by the
net module's custom DNS lookup() function.
PR-URL: https://github.com/nodejs/node/pull/34813
Fixes: https://github.com/nodejs/node/issues/34812
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ricky Zhou <0x19951125@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2020-08-20 15:05:23 +01:00
Denys Otrishko
8f38c19c08
esm: improve error message of ERR_UNSUPPORTED_ESM_URL_SCHEME
...
Refs: https://github.com/nodejs/node/issues/34765
PR-URL: https://github.com/nodejs/node/pull/34795
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-08-20 15:05:22 +01:00
Rich Trott
7d0970ca66
doc,lib: remove unused error code
...
As best as I can tell, ERR_V8BREAKITERATOR is unused anywhere in our
code base and dependencies. Move to legacy errors.
PR-URL: https://github.com/nodejs/node/pull/34792
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2020-08-20 15:05:20 +01:00
Denys Otrishko
04defbaacd
lib: allow to validate enums with validateOneOf
...
PR-URL: https://github.com/nodejs/node/pull/34070
Reviewed-By: Zeyu Yang <himself65@outlook.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-08-20 15:05:19 +01:00
Voltra
952f233e39
http: add RFC references for each status code
...
Reference format: `RFC <rfc id> <section path>`
PR-URL: https://github.com/nodejs/node/pull/33671
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Pranshu Srivastava <rexagod@gmail.com >
Reviewed-By: Ricky Zhou <0x19951125@gmail.com >
2020-08-20 15:05:17 +01:00
Denys Otrishko
dbcb36d553
errors: improve ERR_INVALID_OPT_VALUE error
...
* use util.inspect for value presentation
* allow to optionally specify error reason
PR-URL: https://github.com/nodejs/node/pull/34671
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Mary Marchini <oss@mmarchini.me >
2020-08-20 15:05:17 +01:00
Derek Lewis and Guy Bedford
e4a0e5bc1a
module: fix check for package.json at volume root
...
This patch converts the "read package scope" algorithm's while loop
into a do-while loop enabling items at the filesystem root dir to
be considered within the scope of a sibling package.json also at the
filesystem root dir.
Fixes: https://github.com/nodejs/node/issues/33438
Co-authored-by: Guy Bedford <guybedford@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/34595
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Mary Marchini <oss@mmarchini.me >
2020-08-20 15:05:17 +01:00
Robert Nagy
7ef5591d06
fs: guard against undefined behavior
...
Calling close on a file description which is currently in use is
undefined behavior due to implementation details in libuv. Add
a guard against this when using FileHandle.
PR-URL: https://github.com/nodejs/node/pull/34746
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-08-20 15:05:15 +01:00
Anna Henningsen
332e38433b
buffer: alias UInt ➡️ Uint in buffer methods
...
It’s *so* hard to remember that it’s `UintXArray` but not
`(write|read)UintX`. Let’s fix that by just providing aliases. 😊
PR-URL: https://github.com/nodejs/node/pull/34729
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-08-20 15:05:15 +01:00
Matthew McEachen
1a9496a79d
lib: add UNC support to url.pathToFileURL()
...
Fixes: https://github.com/nodejs/node/issues/34736
PR-URL: https://github.com/nodejs/node/pull/34743
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-08-20 15:05:15 +01:00
Bradley Farias
84031183bc
policy: support conditions for redirects
...
PR-URL: https://github.com/nodejs/node/pull/34414
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
2020-08-20 15:05:14 +01:00
Guy Bedford
698cae7625
module: share CJS/ESM resolver fns, refactoring
...
PR-URL: https://github.com/nodejs/node/pull/34744
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-08-20 15:05:14 +01:00
Priyank Singh
6ee2578427
http2: add maxHeaderSize option to http2
...
add maxHeaderSize to http2 as an alias for maxHeaderListSize.
Fixes: https://github.com/nodejs/node/issues/33517
PR-URL: https://github.com/nodejs/node/pull/33636
Reviewed-By: Zeyu Yang <himself65@outlook.com >
Reviewed-By: Pranshu Srivastava <rexagod@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2020-08-20 15:05:13 +01:00
Guy Bedford
6929649793
module: custom --conditions flag option
...
PR-URL: https://github.com/nodejs/node/pull/34637
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
2020-08-20 15:05:12 +01:00
Rich Trott
124a01d487
lib: use full URL to GitHub issues in comments
...
Don't assume the reader of the code will know where to find the issue
tracker. Provide the full URL. This is especially important if the
issue tracker should move again.
PR-URL: https://github.com/nodejs/node/pull/34686
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ricky Zhou <0x19951125@gmail.com >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Mary Marchini <oss@mmarchini.me >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-08-20 15:05:09 +01:00
Bradley Farias
77bbd73919
util: add debug and debuglog.enabled
...
PR-URL: https://github.com/nodejs/node/pull/33424
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-08-20 15:05:09 +01:00
Guy Bedford
9a7c87df37
module: use cjsCache over esm injection
...
PR-URL: https://github.com/nodejs/node/pull/34605
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-08-20 15:05:07 +01:00
cca0372022
timers: allow timers to be used as primitives
...
This allows timers to be matched to numeric Ids and therefore used
as keys of an Object, passed and stored without storing the Timer instance.
clearTimeout/clearInterval is modified to support numeric/string Ids.
Co-authored-by: Bradley Farias <bradley.meck@gmail.com >
Co-authored-by: Anatoli Papirovski <apapirovski@mac.com >
Refs: https://github.com/nodejs/node/pull/21152
Backport-PR-URL: https://github.com/nodejs/node/pull/34482
PR-URL: https://github.com/nodejs/node/pull/34017
Backport-PR-URL: https://github.com/nodejs/node/pull/34482
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Signed-off-by: Denys Otrishko <shishugi@gmail.com >
2020-08-17 16:30:47 -04:00
Shelley Vohr
4efc5f66fa
lib: use non-symbols in isURLInstance check
...
PR-URL: https://github.com/nodejs/node/pull/34622
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-08-10 21:21:59 -07:00
Gerhard Stoebich
db6f9bd43a
async_hooks: avoid GC tracking of AsyncResource in ALS
...
Manually destroy the AsyncResource created by AsyncLocalStore.run() to
avoid unneeded GC tracking in case a destroy hooks is present.
PR-URL: https://github.com/nodejs/node/pull/34653
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-08-10 21:21:57 -07:00
Gerhard Stoebich
641a5fb0aa
async_hooks: avoid unneeded AsyncResource creation
...
Inspired by the callstack at https://github.com/nodejs/node/issues/34556#issuecomment-666743528
If the wanted store is equal to the active store it's not needed to
create an AsyncResource.
Refs: https://github.com/nodejs/node/issues/34556#issuecomment-666743528
PR-URL: https://github.com/nodejs/node/pull/34616
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com >
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com >
2020-08-10 21:21:57 -07:00
Gerhard Stoebich
0730c76023
async_hooks: improve property descriptors in als.bind
...
The length property should be non enumerable to match behavior of
normal functions.
The asyncResource property is enumerable and therefore it should be
also writable to avoid issues like there:
https://github.com/nodejs/node/pull/30932#discussion_r379679982
Both properties should be configurable.
Refs: https://github.com/nodejs/node/pull/34574
PR-URL: https://github.com/nodejs/node/pull/34620
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-08-10 21:21:56 -07:00
James M Snell
ef4fb6878e
async_hooks: add AsyncResource.bind utility
...
Creates an internal AsyncResource and binds a function to it,
ensuring that the function is invoked within execution context
in which bind was called.
PR-URL: https://github.com/nodejs/node/pull/34574
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
2020-08-10 21:21:56 -07:00
Rich Trott
0c4226e4e6
repl: use _Node.js_ in user-facing REPL text
...
We use _node (REPL)_ in one place and _Node.js (REPL)_ in another place
in error messages in repl.js. Use _Node.js_ in both places.
PR-URL: https://github.com/nodejs/node/pull/34644
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2020-08-10 21:21:56 -07:00
Robey Pointer
7887ce2a78
net: don't return the stream object from onStreamRead
...
CallJSOnreadMethod expects the return value to be undefined or
a new buffer, so make sure to return nothing, even when an error
causes us to destroy the stream.
Fixes: https://github.com/nodejs/node/issues/34346
PR-URL: https://github.com/nodejs/node/pull/34375
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2020-08-10 21:21:56 -07:00
Rich Trott
3ecb16b0af
repl: use _REPL_ in user-facing text
...
User-facing error messages should use _REPL_ for the general REPL and
not _repl_ which should be reserved for referring to the module itself,
etc. _REPL_ is an acronym, so it should be capitalized, as it generally
is in documentation in other technologies, and is usually in our own
documentation. This fixes a few inconsistent usages in lib/repl.js.
PR-URL: https://github.com/nodejs/node/pull/34643
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ricky Zhou <0x19951125@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2020-08-10 21:21:55 -07:00
Gerhard Stoebich
4dbb931862
async_hooks: don't read resource if ALS is disabled
...
Only call executionAsyncResource() in getStore() if the ALS instance is
enabled because the resource is not needed otherwise.
PR-URL: https://github.com/nodejs/node/pull/34617
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2020-08-10 21:21:51 -07:00
Anna Henningsen
c21e62f3e3
module: handle Top-Level Await non-fulfills better
...
Handle situations in which the main `Promise` from a TLA module
is not fulfilled better:
- When not resolving the `Promise` at all, set a non-zero exit code
(unless another one has been requested explicitly) to distinguish
the result from a successful completion.
- When rejecting the `Promise`, always treat it like an uncaught
exception. In particular, this also ensures a non-zero exit code.
Refs: https://github.com/nodejs/node/pull/34558
PR-URL: https://github.com/nodejs/node/pull/34640
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
2020-08-10 21:21:50 -07:00