ZiJian Liu
d858c9576a
http: remove dead code from internal/http.js
...
PR-URL: https://github.com/nodejs/node/pull/36630
Backport-PR-URL: https://github.com/nodejs/node/pull/36890
Refs: https://github.com/nodejs/node/pull/32329
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-13 10:12:11 -05:00
ZiJian Liu
7e3ad1be32
Revert "http: remove dead code from internal/http.js"
...
This reverts commit 9156f430b5 .
PR-URL: https://github.com/nodejs/node/pull/36890
Refs: https://github.com/nodejs/node/pull/32329
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com >
2021-01-13 09:48:44 -05:00
ExE Boss
1db3772c95
lib: simplify primordials.uncurryThis
...
PR-URL: https://github.com/nodejs/node/pull/36866
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
2021-01-12 17:55:54 -05:00
Guy Bedford
01213c71b9
module: fix Windows folder exports deprecation warning
...
PR-URL: https://github.com/nodejs/node/pull/36859
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
2021-01-12 17:55:53 -05:00
Robert Nagy
abae61e230
stream: finished waits for 'close' on OutgoingMessage
...
Don't invoke finished callback until OutgoingMessagehas
emitted 'close'.
PR-URL: https://github.com/nodejs/node/pull/36648
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-12 07:11:44 -05:00
James M Snell
53cf996270
crypto: implement basic secure heap support
...
Adds two new command line arguments:
* `--secure-heap=n`, which causes node.js to initialize
an openssl secure heap of `n` bytes on openssl initialization.
* `--secure-heap-min=n`, which specifies the minimum allocation
from the secure heap.
* A new method `crypto.secureHeapUsed()` that returns details
about the total and used secure heap allocation.
The secure heap is an openssl feature that allows certain kinds
of potentially sensitive information (such as private key
BigNums) to be allocated from a dedicated memory area that is
protected against pointer over- and underruns.
The secure heap is a fixed size, so it's important that users
pick a large enough size to cover the crypto operations they
intend to utilize.
The secure heap is disabled by default.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36779
Refs: https://github.com/nodejs/node/pull/36729
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-01-12 07:11:43 -05:00
James M Snell
42aca13953
crypto: fixup bug in keygen error handling
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36779
Refs: https://github.com/nodejs/node/pull/36729
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-01-12 07:11:42 -05:00
Robert Nagy
4c819d65f9
stream: fix .end() error propagation
...
PR-URL: https://github.com/nodejs/node/pull/36817
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-01-12 07:11:42 -05:00
Antoine du Hamel
c23cca2de9
tls: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36772
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-12 07:11:40 -05:00
ZiJian Liu and Antoine du Hamel
3fa470a3c9
events: refactor to use optional chaining
...
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36763
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-01-12 07:11:40 -05:00
Ouyang Yadong
54bd4ab855
cluster: fix edge cases that throw ERR_INTERNAL_ASSERTION
...
Some cases use both `cluster` and `net`/`cluser` will throw
ERR_INTERNAL_ASSERTION when `listen`/`bind` to the port of `0`. This
PR maitains a separate map of the index to fix the issue. See the new
tests added for the detail cases.
PR-URL: https://github.com/nodejs/node/pull/36764
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-01-12 07:11:36 -05:00
Momtchil Momtchev
cb0b53edb1
stream: lazy read ReadStream
...
Using stream._construct would cause the Readable
to incorrectly greedily start reading.
Fixes: https://github.com/nodejs/node/issues/36251
PR-URL: https://github.com/nodejs/node/pull/36823
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-01-12 07:10:56 -05:00
Antoine du Hamel
0c11a17d82
console: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36753
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-12 07:10:56 -05:00
Yash Ladha
95219eac08
lib: refactor to use mapping in cluster master
...
Cluster master message handler is basically doing the same thing for
different message actions which can be avoided. Thus move to method
mapping object and doing a single lookup to find the function to execute
and it doesnot exists, skip the execution chain.
PR-URL: https://github.com/nodejs/node/pull/36250
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-12 07:10:56 -05:00
ZiJian Liu
24246a29d7
net: throw ERR_OUT_OF_RANGE if blockList.addSubnet prefix is NaN
...
Fixes: https://github.com/nodejs/node/issues/36731
PR-URL: https://github.com/nodejs/node/pull/36732
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-12 07:10:53 -05:00
James M Snell
c4ad50e0ff
crypto: introduce X509Certificate API
...
Introduces the `crypto.X509Certificate` object.
```js
const { X509Certificate } = require('crypto');
const x509 = new X509Certificate('{pem encoded cert}');
console.log(x509.subject);
```
Fixes: https://github.com/nodejs/node/issues/29181
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36804
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
2021-01-12 07:10:52 -05:00
James M Snell
94afc3e712
process: passing -1 to setuid/setgid should not abort
...
Fixes: https://github.com/nodejs/node/issues/32750
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36786
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Harshitha K P <harshitha014@gmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
2021-01-12 07:10:51 -05:00
Rohan Chougule
a38ad0709c
http2: refactor to use primordials instead of <string>.indexOf
...
PR-URL: https://github.com/nodejs/node/pull/36679
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Zeyu Yang <himself65@outlook.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-12 07:10:51 -05:00
James M Snell
4e4deca90d
crypto: implement randomuuid
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36729
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Ben Coe <bencoe@gmail.com >
2021-01-12 07:10:48 -05:00
Antoine du Hamel
258aa50986
tty: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36771
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
2021-01-12 07:10:44 -05:00
Antoine du Hamel
e3a091d9f3
fs: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36699
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-12 07:10:44 -05:00
Antoine du Hamel
302be57be4
module: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36680
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-12 07:10:43 -05:00
Rohan Chougule
baa8064bd0
util: refactor inspect.js to use more primodials
...
PR-URL: https://github.com/nodejs/node/pull/36730
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
2021-01-12 07:10:39 -05:00
Rich Trott
bff201a66d
util: remove unreachable defensive coding
...
Now that we are using primordials in the first part of
isIdenticalTypedArrayType(), the defensive coding to get the correct
result (when Symbol.toStringTag is manipulated) is no longer reachable
or necessary. Remove the code.
Refs: https://coverage.nodejs.org/coverage-873d21cdc1266273/lib/internal/util/comparisons.js.html#L135
PR-URL: https://github.com/nodejs/node/pull/36744
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2021-01-12 07:10:37 -05:00
Antoine du Hamel
b764269437
lib: remove v8_prof_polyfill from eslint ignore list
...
PR-URL: https://github.com/nodejs/node/pull/36537
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2021-01-12 07:10:34 -05:00
Pranshu Jethmalani
e85fbb778d
http2: fix typos in core.js
...
PR-URL: https://github.com/nodejs/node/pull/36719
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Yash Ladha <yash@yashladha.in >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-12 07:10:33 -05:00
Thiago Padilha
9bc2cec848
child_process: add 'overlapped' stdio flag
...
The 'overlapped' value sets the UV_OVERLAPPED_PIPE libuv flag in the
child process stdio.
Fixes: https://github.com/nodejs/node/issues/29238
PR-URL: https://github.com/nodejs/node/pull/29412
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-12 07:10:31 -05:00
Adrien Maret
92af50327e
process: add direct access to rss without iterating pages
...
Accessing the rss value through memoryUsage() can be expensive
because this method will also generate memory usage statistics
by iterating on each page.
This commit intend to offer a more direct access to rss value.
Refs: #33384
PR-URL: https://github.com/nodejs/node/pull/34291
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-12 07:10:30 -05:00
Nitzan Uziely
02dbcc4317
net: support abortSignal in server.listen
...
PR-URL: https://github.com/nodejs/node/pull/36623
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-12 07:10:27 -05:00
Antoine du Hamel
f0a9c53bec
errors: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36651
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yash Ladha <yash@yashladha.in >
2021-01-12 07:10:25 -05:00
Robert Nagy
190ddced46
stream: only use legacy close listeners if not willEmitClose
...
Some streams that willEmitClose unecessarily fallback to legacy
events.
PR-URL: https://github.com/nodejs/node/pull/36649
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-01-12 07:10:23 -05:00
Brian White
eb6b38639a
lib: remove unused code
...
PR-URL: https://github.com/nodejs/node/pull/36632
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-01-12 07:10:22 -05:00
ZiJian Liu
7fe1b5ef5a
lib: refactor to use validateCallback
...
PR-URL: https://github.com/nodejs/node/pull/36609
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-01-12 07:10:22 -05:00
Matteo Collina
1fc30a84ac
stream,zlib: do not use _stream_* anymore
...
PR-URL: https://github.com/nodejs/node/pull/36618
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-01-12 07:10:21 -05:00
Pooja D P
bb4f8c8732
lib: use more primordials in shared validators
...
PR-URL: https://github.com/nodejs/node/pull/36552
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-12 07:10:20 -05:00
Antoine du Hamel
64bf2f229e
util: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36265
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-01-12 07:10:20 -05:00
Antoine du Hamel
181bad58d3
lib: add primordials.SafeArrayIterator
...
PR-URL: https://github.com/nodejs/node/pull/36532
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-12 07:10:07 -05:00
ZiJian Liu
9156f430b5
http: remove dead code from internal/http.js
...
PR-URL: https://github.com/nodejs/node/pull/36630
Refs: https://github.com/nodejs/node/pull/32329
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-12 07:10:03 -05:00
ZiJian Liu
8b7336b072
quic,timers: refactor to use validateAbortSignal
...
PR-URL: https://github.com/nodejs/node/pull/36604
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
2021-01-12 07:09:29 -05:00
raisinten
6e338dac3c
lib: refactor to use more primordials in internal/encoding.js
...
PR-URL: https://github.com/nodejs/node/pull/36480
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-01-12 07:09:27 -05:00
ZiJian Liu
ec3e841f59
lib: refactor to use primordials in internal/priority_queue.js
...
PR-URL: https://github.com/nodejs/node/pull/36560
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-12 07:09:26 -05:00
Antoine du Hamel
b1c6a44caf
url: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36316
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-12 07:09:25 -05:00
Antoine du Hamel
822ac48272
buffer: make FastBuffer safe to construct
...
Using an explicit constructor is necessary to avoid relying on
`Array.prototype[Symbol.iterator]` and `%ArrayIteratorPrototype%.next`,
which can be mutated by users.
PR-URL: https://github.com/nodejs/node/pull/36587
Refs: https://github.com/nodejs/node/pull/36428
Refs: https://github.com/nodejs/node/pull/36532
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-01-12 07:09:24 -05:00
Antoine du Hamel
8ac2016229
lib: add primordials.SafeStringIterator
...
PR-URL: https://github.com/nodejs/node/pull/36526
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-12 07:09:24 -05:00
Antoine du Hamel
56af1250fe
lib: make safe primordials safe to construct
...
PR-URL: https://github.com/nodejs/node/pull/36428
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-12 07:09:24 -05:00
Antoine du Hamel
82393aefff
events: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36304
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-12 07:09:23 -05:00
raisinten and Antoine du Hamel
63091f8440
lib: refactor to use more primordials in internal/histogram.js
...
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36455
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-01-12 07:07:52 -05:00
Momtchil Momtchev
c844d22b72
errors: eliminate all overhead for hidden calls
...
Eliminate all overhead for function calls that are to be
hidden from the stack traces at the expense of
reduced performance for the error case
Fixes: https://github.com/nodejs/node/issues/35386
PR-URL: https://github.com/nodejs/node/pull/35644
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-01-12 07:07:51 -05:00
Antoine du Hamel
5e499c490e
http: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36194
Backport-PR-URL: https://github.com/nodejs/node/pull/36803
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-01-12 06:57:31 -05:00
ZiJian Liu
e30af7be33
fs: refactor to use optional chaining
...
PR-URL: https://github.com/nodejs/node/pull/36524
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2020-12-21 18:24:30 +01:00