There is only one call site that uses it and that can do the checks
itself. Removes ~15 lines of code.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Unexport the http.parsers freelist. It was originally exported by Ryan
in commit 0003c701 but the commit log doesn't mention why and it's never
been documented. It's unclear if there are any users.
The lifecycle of parser objects changed recently and it seems better to
not let people shoot themselves in the foot so easily.
If it turns out there are actually users, we can always re-export it
again - probably under a slightly different name, to force people to
update their code to the new way of things.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Make it a little harder to slip in use-after-free bugs by nulling out
references to the parser object after handing it off to freeParser().
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
It's safe to call BaseObject::object() from your destructor _unless_
the handle is weak; then it's the weak callback that is calling your
destructor and the object will have been released by the time the
destructor runs.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Weak handles put strain on the garbage collector and the parser handle
doesn't need to be weak in the first place. This change should improve
GC times on busy servers a little.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Counterpart to Wrap(), clears the previously assigned internal field.
Will be used in an upcoming commit.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Fix a resource leak where an intermediate Local<Context> handle in
Environment::GetCurrent() got leaked into whatever HandleScope was
further up the stack.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Fix issue where output of a native prototype method would simply print
[Function]. It will now print [Function: name].
Signed-off-by: Trevor Norris <trev.norris@gmail.com>