Permalink
Browse files

http: name anonymous functions in _http_incoming

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 ec17e76 commit fa035ada9090d26baba1e68bc4044194303e75f9
Showing with 11 additions and 9 deletions.
  1. +11 −9 lib/_http_incoming.js
@@ -65,15 +65,15 @@ util.inherits(IncomingMessage, Stream.Readable);
exports.IncomingMessage = IncomingMessage;
IncomingMessage.prototype.setTimeout = function(msecs, callback) {
IncomingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {
if (callback)
this.on('timeout', callback);
this.socket.setTimeout(msecs);
return this;
};
IncomingMessage.prototype.read = function(n) {
IncomingMessage.prototype.read = function read(n) {
if (!this._consuming)
this._readableState.readingMore = false;
this._consuming = true;
@@ -82,7 +82,7 @@ IncomingMessage.prototype.read = function(n) {
};
IncomingMessage.prototype._read = function(n) {
IncomingMessage.prototype._read = function _read(n) {
// We actually do almost nothing here, because the parserOnBody
// function fills up our internal buffer directly. However, we
// do need to unpause the underlying socket so that it flows.
@@ -94,13 +94,14 @@ IncomingMessage.prototype._read = function(n) {
// It's possible that the socket will be destroyed, and removed from
// any messages, before ever calling this. In that case, just skip
// it, since something else is destroying this connection anyway.
IncomingMessage.prototype.destroy = function(error) {
IncomingMessage.prototype.destroy = function destroy(error) {
if (this.socket)
this.socket.destroy(error);
};
IncomingMessage.prototype._addHeaderLines = function(headers, n) {
IncomingMessage.prototype._addHeaderLines = _addHeaderLines;
function _addHeaderLines(headers, n) {
if (headers && headers.length) {
var raw, dest;
if (this.complete) {
@@ -119,7 +120,7 @@ IncomingMessage.prototype._addHeaderLines = function(headers, n) {
this._addHeaderLine(k, v, dest);
}
}
};
}
// Add the given (field, value) pair to the message
@@ -129,7 +130,8 @@ IncomingMessage.prototype._addHeaderLines = function(headers, n) {
// multiple values this way. If not, we declare the first instance the winner
// and drop the second. Extended header fields (those beginning with 'x-') are
// always joined.
IncomingMessage.prototype._addHeaderLine = function(field, value, dest) {
IncomingMessage.prototype._addHeaderLine = _addHeaderLine;
function _addHeaderLine(field, value, dest) {
field = field.toLowerCase();
switch (field) {
// Array headers:
@@ -176,12 +178,12 @@ IncomingMessage.prototype._addHeaderLine = function(field, value, dest) {
dest[field] = value;
}
}
};
}
// Call this instead of resume() if we want to just
// dump all the data to /dev/null
IncomingMessage.prototype._dump = function() {
IncomingMessage.prototype._dump = function _dump() {
if (!this._dumped) {
this._dumped = true;
this.resume();

0 comments on commit fa035ad

Please sign in to comment.