http: fix bailout for writeHead

Reported-by: Jackson Tian <shyvo1987@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
src: add missing Isolate arguments

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
node: add missing Isolate::Scope at startup

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
dns: throw if hostname is not string or falsey

Fix assertion failure from poor argument parsing logic introduced in
6ea5d16. Add tests to make sure arguments are properly parsed.

Fixes: 6ea5d16 "dns: always set variable family in lookup()"
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
net,stream: add isPaused, don't read() when paused

net Sockets were calling read(0) to start reading, without
checking to see if they were paused first. This would result
in paused Socket objects keeping the event loop alive.

Fixes #8200

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
http: avoid create difference hidden class

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
crypto: fix memory leak in Connection::New

Do not create `SSL` instance twice, `SSL_new` is called from `SSLBase`
constructor anyway.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
crypto: allow padding in RSA methods

Reviewed-By: Trevor Norris <trevnorris@gmail.com>
src: Add function name for .byteLength/.compare

Reviewed-By: Fedor Indutny <fedor@indutny.com>
crypto: introduce ECDH
tls, crypto: add DHE support

In case of an invalid DH parameter file, it is sliently discarded. To
use auto DH parameter in a server and DHE key length check in a
client, we need to wait for the next release of OpenSSL-1.0.2.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
tls: add DHE-RSA-AES128-SHA256 to the def ciphers

`!EDH` is also removed from the list in the discussion of #8272

Reviewed-By: Fedor Indutny <fedor@indutny.com>
crypto: wrap ECDH constants in HAVE_OPENSSL

Reviewed-By: Fedor Indutny <fedor@indutny.com>
src: reading/owner/onread/onconnection for tcp

Initialize fields to avoid Hidden Class creation in runtime.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
crypto: avoid memory leak

Reviewed-By: Fedor Indutny <fedor@indutny.com>
crypto: unsigned value can't be negative

Reviewed-By: Fedor Indutny <fedor@indutny.com>
cluster: centralize removal from workers list.

Currently, cluster workers can be removed from the workers list in three
different places:
- In the exit event handler for the worker process.
- In the disconnect event handler of the worker process.
- In the disconnect event handler of the cluster master.

However, handles for a given worker are cleaned up only in one of these
places: in the cluster master's disconnect event handler.

Because these events happen asynchronously, it is possible that the
workers list is empty before we even clean up one handle. This makes
the assert that makes sure that no handle is left when the workers
list is empty fail.

This commit removes the worker from the cluster.workers list only when
the worker is dead _and_ disconnected, at which point we're sure that
its associated handles are cleaned up.

Fixes #8191 and #8192.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
configure: generate a fully statically linked exec

Allow to create an executable with no external dynamic libraries, also the
ones from the system. This is somewhat dependent of the used C lib, for
example glibc has some internal dynamic libraries loaded by itself, but for
other ones like eglibc or dietlib, this would produce a true static linked
executable. This can be of interest for embebers or resource constraints
platforms, but the main reason for this is to allow to use a Javascript
file as Linux kernel 'init' on NodeOS.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
node,async-wrap: verify domain enter/exit are set

The REPL global object lazy loads modules by placing getters for each.
This causes MakeDomainCallback() to be run if a native module is loaded
from the REPL, but if the domain module hasn't been loaded then there
are no enter/exit callbacks to be called. Causing an assert() to fail.

Fix the issue by conditionally running the callback instead of asserting
it is available. Also add "addon" test to verify the fix.

Fixes: #8231
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
stream_wrap: Add support to write binary strings

node::StringBytes::Write() has appropriate support to write strings with
'binary' encoding. So expose that API through StreamWrap and allow
inheriting classes to use it.

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