querystring: remove prepended ? from query field

Fixes an issue that caused the first querystring to be parsed prepending
a "?" in the first variable name on relative urls with no #fragment

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
doc: typo fixes on stream, tls and http

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
dgram: remove new keyword from errnoException

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
src: require EventEmitter via NativeModule

Fixes a recent change causing test-process-kill-pid.js to fail.

Fixes: 931cbc1 "lib: don't use emitter.listeners(type).length"
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
src: change kIsolateSlot to 3

The slot 0 and 1 had already been taken by "gin" and "blink" in Chrome,
and the size of isolate's slots is 4 by default, so using 3 should hopefully
make node work independently when embedded into other application.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
tests: fix invalid hints flags dns test.

1 is actually a valid flag on SmartOS. More generally, hints flags'
values are defined by the underlying native flags, and these can have
different values on different systems.

Using (ADDRCONFIG | V4MAPPED) + 1 ensure that the flag will be invalid,
since it will always be different from ADDRCONFIG, V4MAPPED, ADDRCONFIG
| V4MAPPED,  0 and any other combination of even flags.

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
tests: do not hardcode service name in test-dns.

Instead of hard-coding http service name in test-dns, retrieve it from
/etc/services. This is not ideal, but it's still better than hard-coding
it.

Fixes #8047.

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
test: check ipv6 support before testing it

fix #7983
fix #8049

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
tests: don't assume IPv4 only in remote addr tests

Tests in test-net-remote-address-port.js assume that client and server
sockets always use IPv4. However, depending on the OS and the network
interfaces setup, this is not true. This change makes the test consider
that both IPv4 or IPv6 sockets are valid

Fixes #8096.

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
test: fix dns test

Fix a few issues in test/internet/test-dns.js:
- 'hint' should be 'hints'
- reverse name lookup is not guaranteed to return 'localhost'
- V4MAPPED hint requires IPV6 address family

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
src: use explicit setImmediate not global

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
async-wrap: add functionality, rm tracing module

* Generalize the ASYNC_PROVIDER being passed by the category to which
  it belongs. Instead of having specialized providers for classes like
  ConnectWrap.

* When instantiating a class in cases like receiving an incoming TCP
  connection the activeContext of the parent is no longer available
  because of the asynchronous call. In these cases manually set the
  parent class that contains the context that should propagate to the
  instantiated class.
  * Currently this only happens in tcp_wrap, pipe_wrap and stream_wrap.
    Though careful attention will need to be made in the future that
    other initializations of the same form are also wrapped.

* Force before/after callbacks to run when a class is instantiated, not
  only when a callback is about to be called from MakeCallback.

* Add _removeAsyncQueue() method to handles so when there are no longer
  any items in the queue async_flags_ can be reset.

* Remove all public facing API for the tracing module and replace with a
  process.binding('async_listener') to initialize hooks into the
  AsyncWrap class.

* Remove flag states of AsyncWrap::ProviderType. It's impossible to have
  and AsyncWrap instance with more than one PROVIDER.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
async-wrap: macro-ify AsyncWrap::ProviderType's

Making all the provider types a macro expansion allows them to be
declared in one location but used in many places. This makes maintenance
easier as more providers are added.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
async-wrap: all new instances get a unique id

Every AsyncWrap instance recieves a unique id. A new C++ and JS API have
been exposed to retrieve this value:

* AsyncWrap::id()
* handle.asyncId()

Signed-off-by: Trevor Norris <trev.norris@gmail.com>