summaryrefslogtreecommitdiff
path: root/lib/_http_incoming.js
diff options
context:
space:
mode:
authorFedor Indutny <fedor.indutny@gmail.com>2014-01-24 16:25:11 +0400
committerTimothy J Fontaine <tjfontaine@gmail.com>2014-01-25 12:03:20 -0800
commita454063ea17f94a5d456bb2666502076c0d51795 (patch)
tree4cc0d64b5f1b8958709133a42d227f7b3745d9b7 /lib/_http_incoming.js
parentc1b1f312035644fd33cbc59cacd7980e7ed432da (diff)
downloadandroid-node-v8-a454063ea17f94a5d456bb2666502076c0d51795.tar.gz
android-node-v8-a454063ea17f94a5d456bb2666502076c0d51795.tar.bz2
android-node-v8-a454063ea17f94a5d456bb2666502076c0d51795.zip
http: do not emit EOF non-readable socket
Socket may become not `readable`, but http should not rely on this property and should not think that it means that no data will ever arrive from it. In fact, it may arrive in a next tick and, since `this.push(null)` was already called, it will result in a error like this: Error: stream.push() after EOF at readableAddChunk (_stream_readable.js:143:15) at IncomingMessage.Readable.push (_stream_readable.js:123:10) at HTTPParser.parserOnBody (_http_common.js:132:22) at Socket.socketOnData (_http_client.js:277:20) at Socket.EventEmitter.emit (events.js:101:17) at Socket.Readable.read (_stream_readable.js:367:10) at Socket.socketCloseListener (_http_client.js:196:10) at Socket.EventEmitter.emit (events.js:123:20) at TCP.close (net.js:479:12) fix #6784
Diffstat (limited to 'lib/_http_incoming.js')
-rw-r--r--lib/_http_incoming.js4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js
index a8788c5fbd..ea92bfe7b3 100644
--- a/lib/_http_incoming.js
+++ b/lib/_http_incoming.js
@@ -98,9 +98,7 @@ IncomingMessage.prototype._read = function(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.
- if (!this.socket.readable)
- this.push(null);
- else
+ if (this.socket.readable)
readStart(this.socket);
};