platform/upstream/nodejs.git
13 years agobuffer: write() should always set _charsWritten.
koichik [Fri, 2 Sep 2011 09:37:15 +0000 (18:37 +0900)]
buffer: write() should always set _charsWritten.

Refs #1633.

13 years agobuffer: Avoid overrun with 'binary' encoding.
koichik [Thu, 1 Sep 2011 07:48:35 +0000 (16:48 +0900)]
buffer: Avoid overrun with 'binary' encoding.

Fixes #1624.

13 years agoFixes #1610 Remove DigiNotar CA from trusted list
isaacs [Tue, 30 Aug 2011 15:35:16 +0000 (08:35 -0700)]
Fixes #1610 Remove DigiNotar CA from trusted list

Details:
https://threatpost.com/en_us/blogs/attackers-obtain-valid-cert-google-domains-mozilla-moves-revoke-it-082911
http://www.coriolis-systems.com/blog/2011/08/diginotar-certificate-security.php

13 years agoutil: isRegExp() should not call toString() on its argument
Nathan Rajlich [Thu, 25 Aug 2011 17:22:35 +0000 (19:22 +0200)]
util: isRegExp() should not call toString() on its argument

An overloaded toString() method may have side effects
so don't call it for a simple type check.

Back-port of 54b409d to the v0.4 branch.

13 years agonet: fix throw error
Ryan Dahl [Tue, 23 Aug 2011 21:29:46 +0000 (14:29 -0700)]
net: fix throw error

Thanks Tobi

13 years agoDoc improvements
koichik [Mon, 22 Aug 2011 15:19:39 +0000 (00:19 +0900)]
Doc improvements

13 years agoFix #1563. overflow in ChildProcess custom_fd.
Ryan Dahl [Sat, 20 Aug 2011 19:38:31 +0000 (12:38 -0700)]
Fix #1563. overflow in ChildProcess custom_fd.

Backported from master f5db3f1f859427d2b1252f937a45409c5d4eb38b

13 years agodocs: process.memoryUsage returns memory usage measured in bytes
Maciej Małecki [Fri, 19 Aug 2011 22:26:21 +0000 (00:26 +0200)]
docs: process.memoryUsage returns memory usage measured in bytes

13 years agoClose #1544 Document slashesDenoteHost flag in url.parse
isaacs [Wed, 17 Aug 2011 20:13:56 +0000 (13:13 -0700)]
Close #1544 Document slashesDenoteHost flag in url.parse

13 years agoNow working on v0.4.12
Ryan Dahl [Thu, 18 Aug 2011 01:45:28 +0000 (18:45 -0700)]
Now working on v0.4.12

13 years agoBump version to v0.4.11 v0.4.11
Ryan Dahl [Thu, 18 Aug 2011 01:17:57 +0000 (18:17 -0700)]
Bump version to v0.4.11

13 years agoFixes #1546. Remove expensive debug call.
Ryan Dahl [Wed, 17 Aug 2011 20:21:15 +0000 (13:21 -0700)]
Fixes #1546. Remove expensive debug call.

13 years agomodule: fix pointer reference to out-of-scope variable
Ben Noordhuis [Sat, 13 Aug 2011 23:25:39 +0000 (01:25 +0200)]
module: fix pointer reference to out-of-scope variable

Reported by Tom Hughes.

13 years agoFix docs for fs.*chown
Mickaël Delahaye [Mon, 15 Aug 2011 13:09:03 +0000 (15:09 +0200)]
Fix docs for fs.*chown

Fix bad parameters of fs.chown[Sync], fs.fchown[Sync] and
fs.lchown[Sync] in documentation.

Fixes #1533.

13 years agoDocs: Not memcpy, but memmove
koichik [Sun, 14 Aug 2011 14:10:36 +0000 (23:10 +0900)]
Docs: Not memcpy, but memmove

Fixes #1520.

13 years agotest: add test for #1202, uncatchable exception on bad host name
Ben Noordhuis [Mon, 8 Aug 2011 20:56:26 +0000 (22:56 +0200)]
test: add test for #1202, uncatchable exception on bad host name

13 years agonet: defer DNS lookup error events to next tick
Ben Noordhuis [Fri, 12 Aug 2011 13:42:45 +0000 (15:42 +0200)]
net: defer DNS lookup error events to next tick

net.createConnection() creates a net.Socket object
and immediately calls net.Socket.connect() on it.

There are no event listeners registered yet so
defer the error event to the next tick.

Fixes #1202.

13 years agobuild: remove 1024 char read limit from cmake file
Ben Noordhuis [Fri, 12 Aug 2011 13:32:43 +0000 (15:32 +0200)]
build: remove 1024 char read limit from cmake file

13 years agoSmall changes for fs.watchFile. Fixed broken markdown. Changed variable `f` to a...
Arnout Kazemier [Fri, 12 Aug 2011 11:05:46 +0000 (14:05 +0300)]
Small changes for fs.watchFile. Fixed broken markdown. Changed variable `f` to a proper filename.

Fixes #1507.

13 years agoFix #1497 querystring: Replace 'in' test with 'hasOwnProperty'
isaacs [Thu, 11 Aug 2011 22:30:56 +0000 (15:30 -0700)]
Fix #1497 querystring: Replace 'in' test with 'hasOwnProperty'

13 years agoDoc improvements
koichik [Thu, 11 Aug 2011 08:13:13 +0000 (17:13 +0900)]
Doc improvements

related to #1472.

13 years agoCorrect code span
Christopher Wright [Thu, 11 Aug 2011 04:09:33 +0000 (14:09 +1000)]
Correct code span

Fixes #1489.

13 years agocrypto: fix incorrect ssl shutdown check
Tom Hughes [Fri, 5 Aug 2011 22:22:54 +0000 (15:22 -0700)]
crypto: fix incorrect ssl shutdown check

13 years agonet: fix incorrect sizeof()
Tom Hughes [Fri, 5 Aug 2011 20:52:27 +0000 (13:52 -0700)]
net: fix incorrect sizeof()

13 years agodocs: rename readline.md to readline.markdown
Ben Noordhuis [Sun, 7 Aug 2011 22:59:08 +0000 (00:59 +0200)]
docs: rename readline.md to readline.markdown

13 years agocmake: Various fixes.
Tom Hughes [Fri, 5 Aug 2011 22:57:31 +0000 (00:57 +0200)]
cmake: Various fixes.

* Allow overriding install path with CMAKE_INSTALL_PREFIX.
* make sure js2min.py can be found when building out of source.
* Replace empty macros with void(0).
  Expressions like "debug(x) && foo()" fail if debug(x) is an empty macro.
* Make sure node-natives.h creation is deterministic.
* Fix version string.
  The copyright header made the node_version.h file larger
  than the previously set file read limit.

13 years agoAdd documentation for SecurePair and its 'secure' event.
Logan Smyth [Wed, 3 Aug 2011 02:17:16 +0000 (22:17 -0400)]
Add documentation for SecurePair and its 'secure' event.

Fixes #1443.

13 years agoDoc improvements
koichik [Fri, 29 Jul 2011 18:03:58 +0000 (03:03 +0900)]
Doc improvements

related to #1391, #1415.

13 years agoFix http.ClientRequest crashes if end() was called twice
koichik [Fri, 29 Jul 2011 14:49:48 +0000 (23:49 +0900)]
Fix http.ClientRequest crashes if end() was called twice

Fixes #1417.
Fixes #1223.

13 years agoFix memleak in libeio.
Tom Hughes [Wed, 27 Jul 2011 20:58:39 +0000 (13:58 -0700)]
Fix memleak in libeio.

13 years agoInclude "platform.h", not <platform.h> - conflicts with system headers
Ben Noordhuis [Tue, 26 Jul 2011 20:05:08 +0000 (22:05 +0200)]
Include "platform.h", not <platform.h> - conflicts with system headers

Fixes #1003.

13 years agoDoc improvements and change argument name.
koichik [Sun, 24 Jul 2011 06:56:23 +0000 (15:56 +0900)]
Doc improvements and change argument name.

Fixes #1318.

13 years agoeio: remove trailing comma from enumerations
Ben Noordhuis [Mon, 25 Jul 2011 13:37:21 +0000 (15:37 +0200)]
eio: remove trailing comma from enumerations

Fixes compile-time error in strict mode. Fixes #567.

13 years agoNote that require.paths is gone in 0.5
isaacs [Mon, 25 Jul 2011 00:18:33 +0000 (17:18 -0700)]
Note that require.paths is gone in 0.5

Rather than say it "may disappear", let's just be clear that it *has*
disappeared, and exactly how long it'll be supported for.

13 years agoFix crypto encryption/decryption with Base64.
SAWADA Tadashi [Sun, 19 Jun 2011 07:54:34 +0000 (16:54 +0900)]
Fix crypto encryption/decryption with Base64.

Fixes #738.
Fixes #1205.

13 years agoTypos in ChangeLog file.
Vicente Jimenez Aguilar [Thu, 4 Nov 2010 17:48:35 +0000 (18:48 +0100)]
Typos in ChangeLog file.

Fixes #968.

13 years agoWindows/cygwin: no more GetConsoleTitleW errors on XP
Bert Belder [Fri, 22 Jul 2011 14:28:56 +0000 (16:28 +0200)]
Windows/cygwin: no more GetConsoleTitleW errors on XP

13 years agoDoc improvements
koichik [Thu, 21 Jul 2011 15:20:47 +0000 (00:20 +0900)]
Doc improvements

corresponds to #1374 and #1334.

13 years agohttp: fix setting ServerResponse.statusCode in writeHead
Trent Mick [Thu, 21 Jul 2011 05:42:10 +0000 (22:42 -0700)]
http: fix setting ServerResponse.statusCode in writeHead

Fixes #1374.

13 years agoNow working on v0.4.11
Ryan Dahl [Wed, 20 Jul 2011 07:37:26 +0000 (00:37 -0700)]
Now working on v0.4.11

13 years agoBump version to v0.4.10 v0.4.10
Ryan Dahl [Tue, 19 Jul 2011 17:46:40 +0000 (10:46 -0700)]
Bump version to v0.4.10

13 years agoClose #1360 url: Allow _ in hostnames.
isaacs [Tue, 19 Jul 2011 18:56:44 +0000 (11:56 -0700)]
Close #1360 url: Allow _ in hostnames.

13 years agoProperly respond to HEAD during end(body) hot path
Reid Burke [Fri, 8 Jul 2011 04:04:27 +0000 (21:04 -0700)]
Properly respond to HEAD during end(body) hot path

During write(), _hasBody is checked to make sure a body
is allowed -- this is now also checked during end(body)
when write() isn't used.

Concise final chunk for HEAD req's res.end(data).

Instead of simply clearing data, check _hasBody
earlier to avoid sending cruft when chunkedEncoding
is used.

Fixes #1291.

13 years agoFix Math.pow crashes on machines without SSE2.
Ben Noordhuis [Sat, 16 Jul 2011 14:00:06 +0000 (16:00 +0200)]
Fix Math.pow crashes on machines without SSE2.

This is a back-port of r8577 from V8's upstream 3.1 branch.

Fixes #829.

13 years agoDoc improvements
koichik [Sat, 16 Jul 2011 00:45:43 +0000 (09:45 +0900)]
Doc improvements

Fixes #1334.

13 years agoadded information about relative paths in File System module
Wojciech Wnętrzak [Thu, 14 Jul 2011 11:17:40 +0000 (13:17 +0200)]
added information about relative paths in File System module

13 years agoAdd tests for #1085 and #1304
koichik [Thu, 14 Jul 2011 16:58:43 +0000 (01:58 +0900)]
Add tests for #1085 and #1304

Fixes #1327.

13 years agoFixes #1085. The agent end event may call detachSocket() after the socket is detached...
Stefan Rusu [Thu, 14 Jul 2011 12:33:04 +0000 (15:33 +0300)]
Fixes #1085. The agent end event may call detachSocket() after the socket is detached and destroyed by abort(). This patch avoids that behavior.

13 years agoFixes #1304. The Connection instance may be destroyed by abort() when process.nextTic...
Stefan Rusu [Thu, 14 Jul 2011 09:52:43 +0000 (12:52 +0300)]
Fixes #1304. The Connection instance may be destroyed by abort() when process.nextTick is executed.

13 years agoAdding documentation for 'agent' option in http.request().
Kip Gebhardt [Tue, 28 Jun 2011 19:50:42 +0000 (12:50 -0700)]
Adding documentation for 'agent' option in http.request().

Fixes #1243.

13 years agoFix Buffer drops last null character in UTF-8
koichik [Tue, 21 Jun 2011 15:53:31 +0000 (00:53 +0900)]
Fix Buffer drops last null character in UTF-8

Reproduce:

    $ node
    > buf = new Buffer('\0')
    <Buffer >
    > buf.length
    0
    > buf = new Buffer(1)
    <Buffer 28>
    > buf.write('\0')
    0

Fixes #394.
Fixes #1210.

13 years agoImprovements AssertionError message
koichik [Sun, 10 Jul 2011 09:47:41 +0000 (18:47 +0900)]
Improvements AssertionError message

Fixes #217.

13 years agoThe Node.JS website should link to whichever ChangeLog will be updated soonest.
koichik [Wed, 13 Jul 2011 15:31:56 +0000 (00:31 +0900)]
The Node.JS website should link to whichever ChangeLog will be updated soonest.

Fixes #1316.

13 years agoDocument error in console.timeEnd
koichik [Wed, 13 Jul 2011 15:10:17 +0000 (00:10 +0900)]
Document error in console.timeEnd

Fixes #1109.

13 years agoadded explanation of `exports`
AJ ONeal [Thu, 19 May 2011 19:49:29 +0000 (12:49 -0700)]
added explanation of `exports`

Fixes #1075.

13 years agoDoc improvements
koichik [Sat, 9 Jul 2011 17:04:56 +0000 (02:04 +0900)]
Doc improvements

Fixes #297.

13 years agoUpdate favicon
Ryan Dahl [Mon, 11 Jul 2011 19:24:49 +0000 (12:24 -0700)]
Update favicon

13 years agoFix wallpaper links
Ryan Dahl [Mon, 11 Jul 2011 15:48:02 +0000 (08:48 -0700)]
Fix wallpaper links

13 years agologo update
Ryan Dahl [Mon, 11 Jul 2011 15:29:25 +0000 (08:29 -0700)]
logo update

13 years agoDoc improvements. Explained the flags of fs.open().
koichik [Sat, 9 Jul 2011 07:59:35 +0000 (16:59 +0900)]
Doc improvements. Explained the flags of fs.open().

Fixes #1268.

13 years agoDoc improvements
koichik [Sat, 11 Jun 2011 13:09:40 +0000 (22:09 +0900)]
Doc improvements

moved 'continue' event from http.Agent to http.ClientRequest.
added 'close' event to http.ClientResponse.
added 'open' event to fs.ReadStream.

Fixes #1169.

13 years agodocs for chown/chmod
isaacs [Sat, 2 Apr 2011 00:46:18 +0000 (17:46 -0700)]
docs for chown/chmod

13 years agoRevert 3e2a2a7. Always send a HTTP/1.1 status line to the client.
Ben Noordhuis [Tue, 5 Jul 2011 19:54:06 +0000 (21:54 +0200)]
Revert 3e2a2a7. Always send a HTTP/1.1 status line to the client.

13 years agoBring back execScript
Ryan Dahl [Wed, 6 Jul 2011 23:52:14 +0000 (16:52 -0700)]
Bring back execScript

Undoing
http://codereview.chromium.org/7060008
https://groups.google.com/forum/#!topic/v8-dev/JTRHrPHFBts

13 years agofix an broken question.
Yoshihiro Kikuchi [Tue, 5 Jul 2011 08:32:23 +0000 (17:32 +0900)]
fix an broken question.

Fixes #1274.

13 years agoTypo: stout -> stdout
Alex Xu [Sat, 2 Apr 2011 14:43:55 +0000 (10:43 -0400)]
Typo: stout -> stdout

Closes #874

13 years agoTest cases for #1234: don't send HTTP/1.1 responses to HTTP/1.0 clients.
Ben Noordhuis [Wed, 29 Jun 2011 19:14:02 +0000 (21:14 +0200)]
Test cases for #1234: don't send HTTP/1.1 responses to HTTP/1.0 clients.

13 years agoDon't send a HTTP/1.1 status line to HTTP/1.0 clients.
Ben Noordhuis [Wed, 29 Jun 2011 18:24:16 +0000 (20:24 +0200)]
Don't send a HTTP/1.1 status line to HTTP/1.0 clients.

Fixes #1234.

13 years agoClean up temporary file on exit.
Ben Noordhuis [Mon, 4 Jul 2011 23:06:39 +0000 (01:06 +0200)]
Clean up temporary file on exit.

Unbreaks test/simple/test-http-get-pipeline-problem.js,
it assumed a fixed number of files in the tmp directory.

13 years agoFix a misnamed argument; multicastAddress -> multicastInterface. Closes #1237.
Joe Shaw [Mon, 27 Jun 2011 17:25:05 +0000 (13:25 -0400)]
Fix a misnamed argument; multicastAddress -> multicastInterface. Closes #1237.

13 years agoFixed a typo in a comment: "realpatch" -> "realpath"
Jörn Horstmann [Wed, 11 May 2011 09:33:16 +0000 (02:33 -0700)]
Fixed a typo in a comment: "realpatch" -> "realpath"

13 years agoAdding missing v8 namespace to NODE_PSYMBOL
Mariano Iglesias [Fri, 11 Mar 2011 10:09:05 +0000 (07:09 -0300)]
Adding missing v8 namespace to NODE_PSYMBOL

13 years agoFix issue 915 (Failed to find kqueue on FreeBSD) with the relevant portion of a patch...
Brett Kiefer [Wed, 15 Jun 2011 15:07:23 +0000 (11:07 -0400)]
Fix issue 915 (Failed to find kqueue on FreeBSD) with the relevant portion of a patch submitted to node.js dev (groups.google.com/group/nodejs-dev/browse_thread/thread/3aaf7fe2ca390fdc) by Davie Siegel. The issue is that event.h requires types.h on FreeBSD. This rearranges some of the logic but looks like it should still be valid for Darwin.

13 years agoFix doctool uses RegExp object as a Function
koichik [Sun, 3 Jul 2011 07:46:24 +0000 (16:46 +0900)]
Fix doctool uses RegExp object as a Function

RegExp object is no longer Function.
http://code.google.com/p/v8/issues/detail?id=617

Fixes #1262.

13 years agoRemove duplicate section in modules.markdown
koichik [Sun, 3 Jul 2011 07:56:38 +0000 (16:56 +0900)]
Remove duplicate section in modules.markdown

Fixes #1263

13 years agoFixes #877. Don't wait for socket pool to establish connections.
Ryan Dahl [Fri, 1 Jul 2011 22:49:39 +0000 (15:49 -0700)]
Fixes #877. Don't wait for socket pool to establish connections.

Thanks to Yann Biancheri for putting together an initial test.

13 years agoRevert "debugger: don't allow users to input non-valid commands"
Ryan Dahl [Fri, 1 Jul 2011 22:38:53 +0000 (15:38 -0700)]
Revert "debugger: don't allow users to input non-valid commands"

breaks 'print' command

This reverts commit 37d529f818aacd1146b1d927b3251bbefcea389f.

13 years agotiny fixes in tty_posix.js
Yoshihiro KIKUCHI [Thu, 30 Jun 2011 13:20:23 +0000 (22:20 +0900)]
tiny fixes in tty_posix.js

Close #1158
Close #1160
Close #1252

13 years agoNow working on v0.4.10
Ryan Dahl [Wed, 29 Jun 2011 12:44:38 +0000 (14:44 +0200)]
Now working on v0.4.10

13 years agoBump to v0.4.9 v0.4.9
Ryan Dahl [Wed, 29 Jun 2011 11:24:02 +0000 (13:24 +0200)]
Bump to v0.4.9

13 years agoMerge branch 'v8-3.1' into v0.4
Ryan Dahl [Wed, 29 Jun 2011 10:49:37 +0000 (12:49 +0200)]
Merge branch 'v8-3.1' into v0.4

13 years agoUpgrade V8 to 3.1.8.25
Ryan Dahl [Wed, 29 Jun 2011 10:49:17 +0000 (12:49 +0200)]
Upgrade V8 to 3.1.8.25

13 years agoFix -e/--eval can't load module from node_modules
koichik [Fri, 17 Jun 2011 16:11:43 +0000 (01:11 +0900)]
Fix -e/--eval can't load module from node_modules

With -e or --eval, require() can load module using relative path.

    node -e 'require("./foo")'

But it can't load module from node_modules directory.

    node -e 'require("foo")'

Fixes #1196.

13 years agoFixes #1187. Support multiple 'link' headers
Ryan Dahl [Mon, 20 Jun 2011 10:50:58 +0000 (12:50 +0200)]
Fixes #1187. Support multiple 'link' headers

13 years agoFixes #1203. Add missing scope.Close to fs.sendfileSync
Ryan Dahl [Mon, 20 Jun 2011 10:48:38 +0000 (12:48 +0200)]
Fixes #1203. Add missing scope.Close to fs.sendfileSync

13 years agoCleanup crypto verify to not print unnecessary errors
Mark Cavage [Wed, 15 Jun 2011 17:47:25 +0000 (10:47 -0700)]
Cleanup crypto verify to not print unnecessary errors

13 years agoCloses #1177 remove one node_modules optimization
Mathias Buus [Mon, 13 Jun 2011 22:42:06 +0000 (00:42 +0200)]
Closes #1177 remove one node_modules optimization

to better support certain project structures.

13 years agoSupport for signature verification with RSA/DSA public keys
Mark Cavage [Thu, 9 Jun 2011 01:20:17 +0000 (18:20 -0700)]
Support for signature verification with RSA/DSA public keys

Fixes #1166.

13 years agoDocumenting `require.main`, fixing #997
Trevor Burnham [Sun, 1 May 2011 18:03:08 +0000 (14:03 -0400)]
Documenting `require.main`, fixing #997

13 years agoMassage util.inherits for perf increase
Ryan Dahl [Sat, 11 Jun 2011 06:51:48 +0000 (08:51 +0200)]
Massage util.inherits for perf increase

13 years agodebugger: don't allow users to input non-valid commands
Siddharth Mahendraker [Thu, 2 Jun 2011 20:08:18 +0000 (23:08 +0300)]
debugger: don't allow users to input non-valid commands

Fixes #1144.

13 years agoDisabling SSL compression is dependent on OpenSSL version 0.9.8
Ryan Dahl [Fri, 3 Jun 2011 12:38:55 +0000 (14:38 +0200)]
Disabling SSL compression is dependent on OpenSSL version 0.9.8

Fixes #1087.

13 years agoUpgrade http-parser to eee60127c0df551be085cc8e7983e36d7700d885
Ryan Dahl [Fri, 3 Jun 2011 12:12:14 +0000 (14:12 +0200)]
Upgrade http-parser to eee60127c0df551be085cc8e7983e36d7700d885

13 years agoDoc improvements
Ryan Dahl [Fri, 3 Jun 2011 11:19:06 +0000 (13:19 +0200)]
Doc improvements

Fixes #1147.
Fixes #1139.
Fixes #1126.
Thanks ctide, kext, disfated.

13 years agoOption to disable SSL v2
Jérémy Lal [Fri, 3 Jun 2011 06:35:11 +0000 (08:35 +0200)]
Option to disable SSL v2

Fixes #880

13 years agodocument require.cache
Ryan Dahl [Fri, 3 Jun 2011 06:14:35 +0000 (08:14 +0200)]
document require.cache

13 years agoClose #562 Close #1078 Parse file:// urls properly
Ryan Petrello [Fri, 20 May 2011 04:50:35 +0000 (00:50 -0400)]
Close #562 Close #1078 Parse file:// urls properly

The file:// protocol *always* has a hostname; it's frequently
abbreviated as an empty string, which represents 'localhost'
implicitly.

According to RFC 1738 (http://tools.ietf.org/html/rfc1738):

A file URL takes the form:

   file://<host>/<path>

where <host> is the fully qualified domain name of the system on
which the <path> is accessible...

As a special case, <host> can be the string "localhost" or the empty
string; this is interpreted as 'the machine from which the URL is
being interpreted'.

13 years agoFix resource leaks in node_crypto.cc
Ben Noordhuis [Mon, 23 May 2011 11:10:00 +0000 (13:10 +0200)]
Fix resource leaks in node_crypto.cc

Fixes #1097.

13 years agoCrypto documentation fixes
Brian White [Wed, 25 May 2011 04:26:57 +0000 (21:26 -0700)]
Crypto documentation fixes

Fixes #1104.

13 years agoFix error handling bug in stream.pipe()
Felix Geisendörfer [Mon, 23 May 2011 09:02:53 +0000 (11:02 +0200)]
Fix error handling bug in stream.pipe()

Problem: Since stream.pipe() is registering it's own error handlers on
the source and destination stream, it needs to replicate the
EventEmitter 'error' emitting semantics of throwing an error if there
are no other listeners. However, there was a off-by-one error because
the check for remaining listeners was done after cleanup() which means
the pipe's own listener was no longer included.

This would cause 'error' events on either the dest or the source to
throw if there was one other error listener, and while swallowing
the 'error' event if there was no other listener.

Solution: I added a test demonstrating the two issues and fixed the
problem by correcting the off-by-one error.

Fixes #1095.