mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00: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:
committed by
Rich Trott
parent
f64842adeb
commit
fa946983cc
@@ -95,9 +95,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