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>
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>
The property server.connections should no longer be enumerable because
it has been deprecated. This will prevent deprecation warnings when
server objects are accessed by functions such as JSON.stringify.
Fixes: https://github.com/joyent/node/issues/8373
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
4c9b30d introduced a regression in buffer.slice that 7c3c51b fixed, but
no test had been added to make sure that a similar regression is caught
by the tests suite in the future.
When calling write() after end() has been called on an OutgoingMessage,
an error is emitted and the write's callback is called with an instance
of Error.
Fix#7477.
Reviewed-By: Fedor Indutny <fedor@indutny.com>
When V8 started supporting Promises natively it also introduced a
microtack queue. This feature operates similar to process.nextTick(),
and created an issue where neither knew when the other had run. This
patch has nextTick() call the microtask queue runner at the end of
processing callbacks in the nextTickQueue.
Fixes: https://github.com/joyent/node/issues/7714
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Add a simple test to cover workers' implementation of
Worker.prototype.destroy(). Before adding this test, this code wouldn't
be covered by the tests suite, and any regression introduced in workers'
implementation of Worker.prototype.destroy wouldn't be caught.
Fixes: https://github.com/joyent/node/issues/8223
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
When replying to a HEAD request, do not attempt to send the trailers and
EOF sequence (`0\r\n\r\n`). The HEAD request MUST not have body.
Quote from RFC:
The presence of a message body in a response depends on both the
request method to which it is responding and the response status code
(Section 3.1.2). Responses to the HEAD request method (Section 4.3.2
of [RFC7231]) never include a message body because the associated
response header fields (e.g., Transfer-Encoding, Content-Length,
etc.), if present, indicate only what their values would have been if
the request method had been GET (Section 4.3.1 of [RFC7231]).
fix#8361
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
This adds domains coverage for pdbkdf2, pseudoRandomBytes, and randomBytes.
All others should be covered by event emitters.
Fixes#5801.
Reviewed-By: Timothy J Fontaine <tjfontaine@gmail.com>
Compiles and executes source code in V8's debugger context. Provides
a programmatic way to get access to the debug object by executing:
var Debug = vm.runInDebugContext('Debug');
Fixes#7886.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Strings are treated as UTF8 instead of one-byte strings when
names are processed and when OpenSSL's ..._print functions are used.
This commit fixes simple/test-tls-peer-certificate-encoding test.
fix#8366
Allow cluster workers to listen on exclusive ports for TCP and UDP,
instead of forcing all calls to go through the cluster master.
Fixes: #3856
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
PR #8034 came with a test to make sure that timers expiry is based on
monotonic time and not on wall-clock time. However, a bug in the
implementation broke timers with non-integer delays. A fix for this
issue was provided with PR #8073, but it didn't come with a test.
Because #8073 fixed a subtle issue that could reappear in the future,
and because the impact of such an issue would be significant, I suggest
adding this test.
The test would timeout after 1 minute if the issue was reproduced.
Otherwise it will run very quickly.
Reviewed-By: Fedor Indutny <fedor@indutny.com>
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>
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>
Documentation states that `querystring.unescape` may be overridden to
replace unescaper during parsing. However, the function was only
being used as a fallback for when the native decoder throws (on a
malformed URL). This patch moves the call to the native function and
the try/catch around it into querystring.unescape then has the parser
always invoke it, so that an override will always be used.
Fixes#4055
Reviewed-By: Fedor Indutny <fedor@indutny.com>
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>
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>
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>
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>
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>
Disabling the part of the test that relies on dispatching SIGHUP,
because sending SIGHUP is not supported on Windows.
Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
Send messages until both the parent and the child process have received
at least one message. If at least one of them doesn't receive any
message, the test runner will make the test timeout.
Fixes#8046.
Currently the address resolution family defaults to IPv4. Instead remove
the preference and instead resolve to a family suitable for the host.
Expose the getaddrinfo flags and allow them to be passed.
Add documentation about new flags.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
When backporting f8193ab into v0.10, a regression was introduced. Timers
with non-integer timeout could trigger a infinite recursion with 100%
cpu usage. This commit backports 93b0624 which fixes the regression.
After backporting f8193ab, instead of using Date.now(), timers would use
Timer.now() to determine if they had expired. However, Timer.now() is
based on loop->time, which is not updated when a timer's remaining time
is > 0 and < 1. Timers would thus never timeout if their remaining time
was at some point > 0 and < 1.
With this commit, Timer.now() updates loop->time itself, and timers
always timeout eventually.
Fixes#8065 and #8068.
Callbacks in node are usually asynchronous, and should never be
sometimes synchronous, and sometimes asynchronous.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
A streams1 stream will have its falsy values such as 0, false, or ""
eaten by the upgrade to streams2, even when objectMode is enabled.
Include test for said cases.
Reviewed-by: isaacs <i@izs.me>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
v0.10 and node docs specific that in a worker, the 'message' and 'error'
event emits on process, and on cluster.worker.
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Prevent test-process-kill-pid.js tests suite from sending SIGHUP
to its process group, which was causing the test runner to terminate.
Fix jenkins' jobs for nodejs-master.
Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
Between 0.11.1 and 0.11.2, the message and error events stopped
being usable via the cluster.worker object. This commit makes
them usable again. Closes#7998.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Currently, invalid usage such as:
process.kill('SIGTERM')
process.kill(null)
process.kill(undefined);
all coerce the pid to 0, and signal the current process.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Currently, stringification of an empty array outputs a single
separator character. This commit causes an empty array to output
the empty string.
Signed-off-by: Fedor Indutny <fedor@indutny.com>