Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/https.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ function Agent(options) {
if (!(this instanceof Agent))
return new Agent(options);

options = { __proto__: null, ...options };
options = ObjectSetPrototypeOf({ ...options }, null);
validateOpenSSLEngineOptions(options);
options.defaultPort ??= 443;
options.protocol ??= 'https:';
Expand Down
6 changes: 3 additions & 3 deletions lib/internal/http/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function Agent(options) {

EventEmitter.call(this);

this.options = { __proto__: null, ...options };
this.options = ObjectSetPrototypeOf({ ...options }, null);

this.defaultPort = this.options.defaultPort || 80;
this.protocol = this.options.protocol || 'http:';
Expand Down Expand Up @@ -375,7 +375,7 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */,
}

// Here the agent options will override per-request options.
options = { __proto__: null, ...options, ...this.options };
options = ObjectSetPrototypeOf({ ...options, ...this.options }, null);
if (options.socketPath)
options.path = options.socketPath;

Expand Down Expand Up @@ -445,7 +445,7 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */,

Agent.prototype.createSocket = function createSocket(req, options, cb) {
// Here the agent options will override per-request options.
options = { __proto__: null, ...options, ...this.options };
options = ObjectSetPrototypeOf({ ...options, ...this.options }, null);
if (options.socketPath)
options.path = options.socketPath;

Expand Down
6 changes: 3 additions & 3 deletions lib/internal/http/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const {
Boolean,
Error,
NumberIsFinite,
ObjectAssign,
ObjectDefineProperty,
ObjectHasOwn,
ObjectKeys,
Expand Down Expand Up @@ -363,7 +362,8 @@ function ClientRequest(input, options, cb) {
pathIsFromURL = false;
}

options = ObjectAssign({ __proto__: null }, input, options);
// Avoid creating a dictionary-mode object.
options = ObjectSetPrototypeOf({ ...input, ...options }, null);
}

// Propagate the user's highWaterMark to OutgoingMessage so that
Expand Down Expand Up @@ -411,7 +411,7 @@ function ClientRequest(input, options, cb) {
const defaultPort = options.defaultPort ||
(this.agent?.defaultPort);

const optsWithoutSignal = { __proto__: null, ...options };
const optsWithoutSignal = ObjectSetPrototypeOf({ ...options }, null);

const port = optsWithoutSignal.port = options.port || defaultPort || 80;
const host = optsWithoutSignal.host = validateHost(options.hostname, 'hostname') ||
Expand Down
Loading