Permalink
Browse files

http: name anonymous functions in _http_client

Refs: #8913
PR-URL: #9055
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information...
maasencioh authored and jasnell committed Oct 12, 2016
1 parent 9099a43 commit ec17e766569e19543c106083bcf1ace4b3987484
Showing with 12 additions and 11 deletions.
  1. +12 −11 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,21 +645,21 @@ 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++)
args[i] = arguments[i];
this._deferToConnect('setKeepAlive', args);
};
ClientRequest.prototype.clearTimeout = function(cb) {
ClientRequest.prototype.clearTimeout = function clearTimeout(cb) {
this.setTimeout(0, cb);
};

0 comments on commit ec17e76

Please sign in to comment.