summaryrefslogtreecommitdiff
path: root/lib/_http_incoming.js
diff options
context:
space:
mode:
authorAnatoli Papirovski <apapirovski@mac.com>2018-04-17 00:45:43 +0200
committerAnatoli Papirovski <apapirovski@mac.com>2018-04-19 08:41:17 +0200
commit3d480dcf4c270cbf5a3acef08fc6b8d25576411b (patch)
treea5d8c869b7d2d8c558cb875228576495053e997e /lib/_http_incoming.js
parentbbdb4af0bd7abd9751e2d7bf85e7b535cb0802fa (diff)
downloadandroid-node-v8-3d480dcf4c270cbf5a3acef08fc6b8d25576411b.tar.gz
android-node-v8-3d480dcf4c270cbf5a3acef08fc6b8d25576411b.tar.bz2
android-node-v8-3d480dcf4c270cbf5a3acef08fc6b8d25576411b.zip
http: fix _dump regression
A recent set of changes removed _consuming tracking from server incoming messages which ensures that _dump only runs if the user has never attempted to read the incoming data. Fix by reintroducing _consuming which tracks whether _read was ever successfully called. PR-URL: https://github.com/nodejs/node/pull/20088 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'lib/_http_incoming.js')
-rw-r--r--lib/_http_incoming.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js
index a84cb64bdb..55c196399c 100644
--- a/lib/_http_incoming.js
+++ b/lib/_http_incoming.js
@@ -38,6 +38,8 @@ function readStop(socket) {
function IncomingMessage(socket) {
Stream.Readable.call(this);
+ this._readableState.readingMore = true;
+
this.socket = socket;
this.connection = socket;
@@ -63,6 +65,7 @@ function IncomingMessage(socket) {
this.statusMessage = null;
this.client = socket;
+ this._consuming = false;
// flag for when we decide that this message cannot possibly be
// read by the user, so there's no point continuing to handle it.
this._dumped = false;
@@ -79,6 +82,11 @@ IncomingMessage.prototype.setTimeout = function setTimeout(msecs, callback) {
IncomingMessage.prototype._read = function _read(n) {
+ if (!this._consuming) {
+ this._readableState.readingMore = false;
+ this._consuming = true;
+ }
+
// 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.