GeezerVison is showing github.com — http: keep request option copies in fast mode · nodejs/node@7007c63
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: lib/https.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -494,7 +494,7 @@ function Agent(options) { | 494 | 494 | if (!(this instanceof Agent)) | 495 | 495 | return new Agent(options); | 496 | 496 |
| 497 | | - options = { __proto__: null, ...options }; | | 497 | + options = { __proto__: kEmptyObject, ...options }; | 498 | 498 | validateOpenSSLEngineOptions(options); | 499 | 499 | options.defaultPort ??= 443; | 500 | 500 | options.protocol ??= 'https:'; | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/http/agent.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -172,7 +172,7 @@ function Agent(options) { | 172 | 172 |
| 173 | 173 | EventEmitter.call(this); | 174 | 174 |
| 175 | | - this.options = { __proto__: null, ...options }; | | 175 | + this.options = { __proto__: kEmptyObject, ...options }; | 176 | 176 |
| 177 | 177 | this.defaultPort = this.options.defaultPort || 80; | 178 | 178 | this.protocol = this.options.protocol || 'http:'; | @@ -395,7 +395,7 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */, | 395 | 395 | } | 396 | 396 |
| 397 | 397 | // Here the agent options will override per-request options. | 398 | | - options = { __proto__: null, ...options, ...this.options }; | | 398 | + options = { __proto__: kEmptyObject, ...options, ...this.options }; | 399 | 399 | if (options.socketPath) | 400 | 400 | options.path = options.socketPath; | 401 | 401 |
| @@ -472,7 +472,7 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */, | 472 | 472 |
| 473 | 473 | Agent.prototype.createSocket = function createSocket(req, options, cb) { | 474 | 474 | // Here the agent options will override per-request options. | 475 | | - options = { __proto__: null, ...options, ...this.options }; | | 475 | + options = { __proto__: kEmptyObject, ...options, ...this.options }; | 476 | 476 | if (options.socketPath) | 477 | 477 | options.path = options.socketPath; | 478 | 478 |
| |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/http/client.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -26,7 +26,6 @@ const { | 26 | 26 | Boolean, | 27 | 27 | Error, | 28 | 28 | NumberIsFinite, | 29 | | - ObjectAssign, | 30 | 29 | ObjectDefineProperty, | 31 | 30 | ObjectHasOwn, | 32 | 31 | ObjectKeys, | @@ -365,7 +364,8 @@ function ClientRequest(input, options, cb) { | 365 | 364 | pathIsFromURL = false; | 366 | 365 | } | 367 | 366 |
| 368 | | - options = ObjectAssign({ __proto__: null }, input, options); | | 367 | + // Avoid creating a dictionary-mode object. | | 368 | + options = { __proto__: kEmptyObject, ...input, ...options }; | 369 | 369 | } | 370 | 370 |
| 371 | 371 | // Propagate the user's highWaterMark to OutgoingMessage so that | @@ -413,7 +413,7 @@ function ClientRequest(input, options, cb) { | 413 | 413 | const defaultPort = options.defaultPort || | 414 | 414 | (this.agent?.defaultPort); | 415 | 415 |
| 416 | | - const optsWithoutSignal = { __proto__: null, ...options }; | | 416 | + const optsWithoutSignal = { __proto__: kEmptyObject, ...options }; | 417 | 417 |
| 418 | 418 | const port = optsWithoutSignal.port = options.port || defaultPort || 80; | 419 | 419 | const host = optsWithoutSignal.host = validateHost(options.hostname, 'hostname') || | |
|