http: name anonymous functions in _http_incoming
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>
This commit is contained in:
parent
23d6e1f7bc
commit
239ff06126
@ -65,7 +65,7 @@ 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);
|
||||
@ -73,7 +73,7 @@ IncomingMessage.prototype.setTimeout = function(msecs, callback) {
|
||||
};
|
||||
|
||||
|
||||
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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user