Skip to content

Commit

Permalink
http: name anonymous functions in _http_incoming
Browse files Browse the repository at this point in the history
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 19, 2016
1 parent ec17e76 commit fa035ad
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/_http_incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
Expand All @@ -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) {
Expand All @@ -119,7 +120,7 @@ IncomingMessage.prototype._addHeaderLines = function(headers, n) {
this._addHeaderLine(k, v, dest);
}
}
};
}


// Add the given (field, value) pair to the message
Expand All @@ -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:
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit fa035ad

Please sign in to comment.