Browse Source

http: use direct parameters instead

When parameter count is fixed, use literal Array instance is more
simply and avoid arguments leak also.

PR-URL: https://github.com/nodejs/node/pull/10833
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
v6
Jackson Tian 8 years ago
committed by Italo A. Casas
parent
commit
aa8eb8747c
No known key found for this signature in database GPG Key ID: 23EFEFE93C4CFFFE
  1. 18
      lib/_http_client.js

18
lib/_http_client.js

@ -718,19 +718,13 @@ ClientRequest.prototype.setTimeout = function setTimeout(msecs, callback) {
return this; return this;
}; };
ClientRequest.prototype.setNoDelay = function setNoDelay() { ClientRequest.prototype.setNoDelay = function setNoDelay(noDelay) {
const argsLen = arguments.length; this._deferToConnect('setNoDelay', [noDelay]);
const args = new Array(argsLen);
for (var i = 0; i < argsLen; i++)
args[i] = arguments[i];
this._deferToConnect('setNoDelay', args);
}; };
ClientRequest.prototype.setSocketKeepAlive = function setSocketKeepAlive() {
const argsLen = arguments.length; ClientRequest.prototype.setSocketKeepAlive =
const args = new Array(argsLen); function setSocketKeepAlive(enable, initialDelay) {
for (var i = 0; i < argsLen; i++) this._deferToConnect('setKeepAlive', [enable, initialDelay]);
args[i] = arguments[i];
this._deferToConnect('setKeepAlive', args);
}; };
ClientRequest.prototype.clearTimeout = function clearTimeout(cb) { ClientRequest.prototype.clearTimeout = function clearTimeout(cb) {

Loading…
Cancel
Save