mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
https: prevent options object from being mutated
Previously, when passing options object to the agent.createConnection method, the same options object got modified within the method. Now, any modification will happen on only a copy of the object. Fixes: https://github.com/nodejs/node/issues/31119 PR-URL: https://github.com/nodejs/node/pull/31151 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
1 parent
2c85dd91d6
commit
06bcd1ab9b
2 files changed
+27
-1
No files matched your search
+3
-1
@@ -96,9 +96,11 @@ function createConnection(port, host, options) {
|
||||
if (port !== null && typeof port === 'object') {
|
||||
options = port;
|
||||
} else if (host !== null && typeof host === 'object') {
|
||||
options = host;
|
||||
options = { ...host };
|
||||
} else if (options === null || typeof options !== 'object') {
|
||||
options = {};
|
||||
} else {
|
||||
options = { ...options };
|
||||
}
|
||||
|
||||
if (typeof port === 'number') {
|
||||
|
||||
Reference in new issue
Block a user