From ec17e766569e19543c106083bcf1ace4b3987484 Mon Sep 17 00:00:00 2001 From: maasencioh Date: Wed, 12 Oct 2016 13:06:30 +0200 Subject: [PATCH] http: name anonymous functions in _http_client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs: https://github.com/nodejs/node/issues/8913 PR-URL: https://github.com/nodejs/node/pull/9055 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Franziska Hinkelmann Reviewed-By: Michaƫl Zasso --- lib/_http_client.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/_http_client.js b/lib/_http_client.js index 58fbf0f30a86de..6837c94df98eea 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -206,19 +206,19 @@ exports.ClientRequest = ClientRequest; ClientRequest.prototype.aborted = undefined; -ClientRequest.prototype._finish = function() { +ClientRequest.prototype._finish = function _finish() { DTRACE_HTTP_CLIENT_REQUEST(this, this.connection); LTTNG_HTTP_CLIENT_REQUEST(this, this.connection); COUNTER_HTTP_CLIENT_REQUEST(); OutgoingMessage.prototype._finish.call(this); }; -ClientRequest.prototype._implicitHeader = function() { +ClientRequest.prototype._implicitHeader = function _implicitHeader() { this._storeHeader(this.method + ' ' + this.path + ' HTTP/1.1\r\n', this._renderHeaders()); }; -ClientRequest.prototype.abort = function() { +ClientRequest.prototype.abort = function abort() { if (this.aborted === undefined) { process.nextTick(emitAbortNT, this); } @@ -567,7 +567,7 @@ function tickOnSocket(req, socket) { req.emit('socket', socket); } -ClientRequest.prototype.onSocket = function(socket) { +ClientRequest.prototype.onSocket = function onSocket(socket) { process.nextTick(onSocketNT, this, socket); }; @@ -580,7 +580,8 @@ function onSocketNT(req, socket) { } } -ClientRequest.prototype._deferToConnect = function(method, arguments_, cb) { +ClientRequest.prototype._deferToConnect = _deferToConnect; +function _deferToConnect(method, arguments_, cb) { // This function is for calls that need to happen once the socket is // connected and writable. It's an important promisy thing for all the socket // calls that happen either now (when a socket is assigned) or @@ -596,7 +597,7 @@ ClientRequest.prototype._deferToConnect = function(method, arguments_, cb) { cb(); } - var onSocket = function() { + var onSocket = function onSocket() { if (self.socket.writable) { callSocketMethod(); } else { @@ -609,9 +610,9 @@ ClientRequest.prototype._deferToConnect = function(method, arguments_, cb) { } else { onSocket(); } -}; +} -ClientRequest.prototype.setTimeout = function(msecs, callback) { +ClientRequest.prototype.setTimeout = function setTimeout(msecs, callback) { if (callback) this.once('timeout', callback); var self = this; @@ -644,14 +645,14 @@ ClientRequest.prototype.setTimeout = function(msecs, callback) { return this; }; -ClientRequest.prototype.setNoDelay = function() { +ClientRequest.prototype.setNoDelay = function setNoDelay() { const argsLen = arguments.length; const args = new Array(argsLen); for (var i = 0; i < argsLen; i++) args[i] = arguments[i]; this._deferToConnect('setNoDelay', args); }; -ClientRequest.prototype.setSocketKeepAlive = function() { +ClientRequest.prototype.setSocketKeepAlive = function setSocketKeepAlive() { const argsLen = arguments.length; const args = new Array(argsLen); for (var i = 0; i < argsLen; i++) @@ -659,6 +660,6 @@ ClientRequest.prototype.setSocketKeepAlive = function() { this._deferToConnect('setKeepAlive', args); }; -ClientRequest.prototype.clearTimeout = function(cb) { +ClientRequest.prototype.clearTimeout = function clearTimeout(cb) { this.setTimeout(0, cb); };