Skip to content

Commit fa035ad

Browse files
maasenciohjasnell
authored andcommitted
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>
1 parent ec17e76 commit fa035ad

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

lib/_http_incoming.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ util.inherits(IncomingMessage, Stream.Readable);
6565
exports.IncomingMessage = IncomingMessage;
6666

6767

68-
IncomingMessage.prototype.setTimeout = function(msecs, callback) {
68+
IncomingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {
6969
if (callback)
7070
this.on('timeout', callback);
7171
this.socket.setTimeout(msecs);
7272
return this;
7373
};
7474

7575

76-
IncomingMessage.prototype.read = function(n) {
76+
IncomingMessage.prototype.read = function read(n) {
7777
if (!this._consuming)
7878
this._readableState.readingMore = false;
7979
this._consuming = true;
@@ -82,7 +82,7 @@ IncomingMessage.prototype.read = function(n) {
8282
};
8383

8484

85-
IncomingMessage.prototype._read = function(n) {
85+
IncomingMessage.prototype._read = function _read(n) {
8686
// We actually do almost nothing here, because the parserOnBody
8787
// function fills up our internal buffer directly. However, we
8888
// do need to unpause the underlying socket so that it flows.
@@ -94,13 +94,14 @@ IncomingMessage.prototype._read = function(n) {
9494
// It's possible that the socket will be destroyed, and removed from
9595
// any messages, before ever calling this. In that case, just skip
9696
// it, since something else is destroying this connection anyway.
97-
IncomingMessage.prototype.destroy = function(error) {
97+
IncomingMessage.prototype.destroy = function destroy(error) {
9898
if (this.socket)
9999
this.socket.destroy(error);
100100
};
101101

102102

103-
IncomingMessage.prototype._addHeaderLines = function(headers, n) {
103+
IncomingMessage.prototype._addHeaderLines = _addHeaderLines;
104+
function _addHeaderLines(headers, n) {
104105
if (headers && headers.length) {
105106
var raw, dest;
106107
if (this.complete) {
@@ -119,7 +120,7 @@ IncomingMessage.prototype._addHeaderLines = function(headers, n) {
119120
this._addHeaderLine(k, v, dest);
120121
}
121122
}
122-
};
123+
}
123124

124125

125126
// Add the given (field, value) pair to the message
@@ -129,7 +130,8 @@ IncomingMessage.prototype._addHeaderLines = function(headers, n) {
129130
// multiple values this way. If not, we declare the first instance the winner
130131
// and drop the second. Extended header fields (those beginning with 'x-') are
131132
// always joined.
132-
IncomingMessage.prototype._addHeaderLine = function(field, value, dest) {
133+
IncomingMessage.prototype._addHeaderLine = _addHeaderLine;
134+
function _addHeaderLine(field, value, dest) {
133135
field = field.toLowerCase();
134136
switch (field) {
135137
// Array headers:
@@ -176,12 +178,12 @@ IncomingMessage.prototype._addHeaderLine = function(field, value, dest) {
176178
dest[field] = value;
177179
}
178180
}
179-
};
181+
}
180182

181183

182184
// Call this instead of resume() if we want to just
183185
// dump all the data to /dev/null
184-
IncomingMessage.prototype._dump = function() {
186+
IncomingMessage.prototype._dump = function _dump() {
185187
if (!this._dumped) {
186188
this._dumped = true;
187189
this.resume();

0 commit comments

Comments
 (0)