Browse Source

http: name anonymous functions in _http_client

Refs: https://github.com/nodejs/node/issues/8913
PR-URL: https://github.com/nodejs/node/pull/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>
v6
maasencioh 8 years ago
committed by James M Snell
parent
commit
23d6e1f7bc
  1. 23
      lib/_http_client.js

23
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);
};

Loading…
Cancel
Save