child_process: improve spawn() argument handling

Add stricter argument type checking to normalizeSpawnArguments().

Removes a number of extraneous checks in spawn().

Fix regression in handling of the optional args argument.

Add more thorough testing of spawn() arguments.

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
crypto: lower RSS usage for TLSCallbacks

Don't allocate any BIO buffers initially, do this on a first read from
the TCP connection. Allocate different amount of data for initial read
and for consequent reads: small buffer for hello+certificate, big buffer
for better throughput.

see #8416
timer_wrap: remove HandleScopes, check return size

Calls from JS to C++ have an implicit HandleScope. So there is no need
to instantiate a new HandleScope in these basic cases.

Check if the returned int64_t is an SMI and cast the return value to
uint32_t instead of a double. Prevents needing to box the return value,
and saves a small amount of execution time.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
http: cleanup setHeader()

Several fields on OutgoingMessage were set after instantiation. These
have been included in the constructor to prevent mutation of the object
map after instantiation.

"name" is now explicitly checked to be a string. Where before if a
non-string was passed the following cryptic error was thrown:

    _http_outgoing.js:334
      var key = name.toLowerCase();
                     ^
    TypeError: undefined is not a function

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

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
src: fix VC++ warning C4244

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
doc: fix optional parameter parsing

The parameter parser specifically looked for the old bracket syntax.
This generated a lot of warnings when building the docs. Those warnings
have been fixed by changing the parsing logic.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
buffer: fix and cleanup fill()

Running fill() with an empty string would cause Node to hang
indefinitely. Now it will return without having operated on the buffer.

User facing function has been pulled into JS to perform all initial
value checks and coercions. The C++ method has been placed on the
"internal" object.

Coerced non-string values to numbers to match v0.10 support.

Simplified logic and changed a couple variable names.

Added tests for fill() and moved them all to the beginning of
buffer-test.js since many other tests depend on fill() working properly.

Fixes: https://github.com/joyent/node/issues/8469
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
rebase
streams: adds the ability to set the default encoding for writable streams

Fixes #7159
Merge branch 'fix-issue-7159' of github.com:jrayaustin/node into fix-issue-7159