This reverts commit 911cbd0cef.
This patch is broken on Linux and I don't want to think about the
functionality during the Windows port. We can reconsider it after v0.6.
net.createConnection() is wrapper for net.Socket.connect(),
but There is mismatch between them.
net.createConnection(port, [host])
net.Socket.connect(port, [host], [callback])
Fixes#1208.
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.
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'.
Sockets emitted by the 'connection' event are always connected, having
them emit the 'connect' event makes no sense. It only confused people,
as it's not clear if you have to listen to 'connect' or not.
That try..catch block was also very scary. It would silently swallow
exceptions in 'connect' listeners and destroy the socket. Makes no
sense.
Fixes#1047.
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.