0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test
isaacs 327b6e3e1d stream: Don't emit 'end' unless read() called
This solves the problem of calling `readable.pipe(writable)` after the
readable stream has already emitted 'end', as often is the case when
writing simple HTTP proxies.

The spirit of streams2 is that things will work properly, even if you
don't set them up right away on the first tick.

This approach breaks down, however, because pipe()ing from an ended
readable will just do nothing.  No more data will ever arrive, and the
writable will hang open forever never being ended.

However, that does not solve the case of adding a `on('end')` listener
after the stream has received the EOF chunk, if it was the first chunk
received (and thus, length was 0, and 'end' got emitted).  So, with
this, we defer the 'end' event emission until the read() function is
called.

Also, in pipe(), if the source has emitted 'end' already, we call the
cleanup/onend function on nextTick.  Piping from an already-ended stream
is thus the same as piping from a stream that is in the process of
ending.

Updates many tests that were relying on 'end' coming immediately, even
though they never read() from the req.

Fix #4942
2013-03-10 11:08:22 -07:00
..
addons test: modify async native test.js to test for #4820 2013-02-21 13:14:07 -08:00
disabled
fixtures test: Fix debugger repl tests 2013-02-26 16:49:17 -08:00
gc
internet DNS: Support NAPTR queries 2013-03-06 14:31:22 +04:00
message process: separate nextTick domain logic 2013-02-27 16:37:10 -08:00
pummel test: Pass cli flags in pummel/test-regress-GH-892 2013-03-06 11:44:29 -08:00
simple stream: Don't emit 'end' unless read() called 2013-03-10 11:08:22 -07:00
common.js test: optionally set common.PORT via env variable 2013-03-02 19:09:39 +01:00