diff options
author | Fedor Indutny <fedor.indutny@gmail.com> | 2014-01-24 16:25:11 +0400 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2014-04-08 00:40:22 +0400 |
commit | f2b297cc7ca1a7a4f4abd356bd1ad0af09e1b26b (patch) | |
tree | 512c383d977a108dc9c132e03a0fbc54fb099e63 /lib/http.js | |
parent | c2d32f4c0e60a31e6ee421f8f7f45541792c5c6d (diff) | |
download | node-f2b297cc7ca1a7a4f4abd356bd1ad0af09e1b26b.tar.gz |
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.js')
-rw-r--r-- | lib/http.js | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/http.js b/lib/http.js index 3b1484b8f..0623668c9 100644 --- a/lib/http.js +++ b/lib/http.js @@ -344,9 +344,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); }; |