platform/upstream/nodejs.git
9 years agocrypto: fix X509 cert memory leak in GetPeerCert
Fedor Indutny [Tue, 11 Nov 2014 05:08:09 +0000 (08:08 +0300)]
crypto: fix X509 cert memory leak in GetPeerCert

`SSL_get_peer_certificate` returns referenced X509 object, we should
decrement the reference count once it is not needed.

Fix joyent/node#8674
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/node-forward/node/pull/56

9 years agosrc: fix windows build error
Ben Noordhuis [Tue, 11 Nov 2014 11:06:55 +0000 (12:06 +0100)]
src: fix windows build error

Fix a Windows-only build error that was introduced in
commit 1183ba4 ("zlib: support concatenated gzip files").

Rename the NO_ERROR and FAILED enumerations, they conflict
with macros of the same name in <winerror.h>.

PR-URL: https://github.com/node-forward/node/pull/57
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
9 years agolib,src: make os.endianness() inlinable
Ben Noordhuis [Mon, 10 Nov 2014 23:40:58 +0000 (00:40 +0100)]
lib,src: make os.endianness() inlinable

Turn os.endianness() from a run-time function into a pure JS function.
Upsides: makes it a good candidate for inlining at the call site.
Downsides: none that I can think of.

PR-URL: https://github.com/node-forward/node/pull/55
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agotest: kill children before cluster parent
Rod Vagg [Sat, 8 Nov 2014 09:03:20 +0000 (20:03 +1100)]
test: kill children before cluster parent

Killing the cluster master first on Windows causes an ESRCH when killing
the children as the OS takes care of them itself.

PR-URL: https://github.com/node-forward/node/pull/53
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agozlib: support concatenated gzip files
Luis Reis [Tue, 9 Sep 2014 16:30:15 +0000 (17:30 +0100)]
zlib: support concatenated gzip files

Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: https://github.com/joyent/node/pull/6442

9 years agocrypto: escape DNS altname
Fedor Indutny [Wed, 5 Nov 2014 03:24:19 +0000 (22:24 -0500)]
crypto: escape DNS altname

Vulnerability credit goes to:

    Calvin Liang conradjliang@hotmail.com

Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: ...private

9 years agotest: use common.PIPE in simple/test-cluster-eaccess
Rod Vagg [Wed, 5 Nov 2014 23:03:50 +0000 (09:03 +1000)]
test: use common.PIPE in simple/test-cluster-eaccess

PR-URL: https://github.com/node-forward/node/pull/50
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agotest: unlink custom unix socket before test
Ben Noordhuis [Wed, 29 Oct 2014 16:21:12 +0000 (17:21 +0100)]
test: unlink custom unix socket before test

Unlink NODE_COMMON_PIPE before running the test if set in the
environment.  The test runner won't do it for us like it does
for files in test/tmp.

PR-URL: https://github.com/node-forward/node/pull/40
Reviewed-By: Rod Vagg <rod@vagg.org>
9 years agobuild: add rpmbuild .spec file
Ben Noordhuis [Fri, 5 Jul 2013 18:10:25 +0000 (20:10 +0200)]
build: add rpmbuild .spec file

Add a .spec file and a rpmbuild(1) driver script.  Useful for people
on RHEL-based systems that want to compile and package from source.

PR-URL: https://github.com/node-forward/node/pull/10
Reviewed-By: Rod Vagg <rod@vagg.org>
9 years agosrc: network interface names are UTF-8 encoded
Ben Noordhuis [Mon, 3 Nov 2014 15:42:07 +0000 (16:42 +0100)]
src: network interface names are UTF-8 encoded

Fixes a bug that was introduced in commit f674b09 when v8::String::New()
calls were replaced with calls to one-byte, two-byte and UTF-8 versions.
It turns out that for network interface names, using a one-byte encoding
can produce the wrong results on Windows.  Use UTF-8 instead.

Libuv on Windows correctly encodes non-ASCII characters in the interface
name as UTF-8.  On Unices however, the interface name is just a binary
string with no particular encoding; that's why on UNIX platforms, we
keep interpreting it as a one-byte string.

Fixes joyent/node#8633.

PR-URL: https://github.com/node-forward/node/pull/44
Reviewed-By: Bert Belder <bertbelder@gmail.com>
9 years agowindows: fix process description to say "Node.js"
Rod Vagg [Tue, 4 Nov 2014 07:57:11 +0000 (17:57 +1000)]
windows: fix process description to say "Node.js"

Newer incarnations of the task manager only show the description, not
even the product name.

PR-URL: https://github.com/node-forward/node/pull/46
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuisl.nl>
9 years agonode: do not crash on IPC stdin
Fedor Indutny [Tue, 4 Nov 2014 05:08:41 +0000 (00:08 -0500)]
node: do not crash on IPC stdin

When started with IPC pipe on fd=0 child process should not crash when
referencing or using `process.stdin`.

fix joyent/node#8669

PR-URL: https://github.com/node-forward/node/pull/45
Reviewed-By: Ben Noorhduis <info@bnoordhuis.nl>
9 years agosrc: replace NULL with nullptr in debug agent
Ben Noordhuis [Mon, 3 Nov 2014 12:19:17 +0000 (13:19 +0100)]
src: replace NULL with nullptr in debug agent

Update the debug agent to conform to the code style in src/.

9 years agosrc: clean up root_certs iteration
Ben Noordhuis [Mon, 3 Nov 2014 11:15:52 +0000 (12:15 +0100)]
src: clean up root_certs iteration

Drop the trailing nullptr and use ARRAY_SIZE.

9 years agosrc: move debug agent from deps/ to src/
Ben Noordhuis [Mon, 3 Nov 2014 11:03:34 +0000 (12:03 +0100)]
src: move debug agent from deps/ to src/

There is not much point in keeping it a separate project because it
doesn't build standalone, plus it makes applying changes to core more
difficult because of the implicit dependency on header files in src/.

9 years agosrc: make root_certs const
Ben Noordhuis [Thu, 16 Oct 2014 21:14:45 +0000 (23:14 +0200)]
src: make root_certs const

Make the root_certs global fully const.  As a side effect, that moves it
from the .data section to the .rodata section.  Makes it a little easier
to reason about the remaining globals.

9 years agoMerge remote-tracking branch 'joyent/v0.12' into v0.12
Ben Noordhuis [Wed, 29 Oct 2014 15:15:15 +0000 (16:15 +0100)]
Merge remote-tracking branch 'joyent/v0.12' into v0.12

Conflicts:
lib/path.js

9 years agobuild: remove python 2.7 dependency
Ben Noordhuis [Wed, 29 Oct 2014 14:43:09 +0000 (15:43 +0100)]
build: remove python 2.7 dependency

Remove the dependency on the 'sysconfig' module, it breaks the build
when $(PYTHON) is python 2.6.

PR-URL: https://github.com/node-forward/node/pull/39
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agov8_platform: fix cpplint issue
Fedor Indutny [Wed, 29 Oct 2014 01:12:49 +0000 (21:12 -0400)]
v8_platform: fix cpplint issue

Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: local://fedors.head/pull/1

9 years agostream_wrap: do not crash if handle was closed
Fedor Indutny [Fri, 24 Oct 2014 15:46:25 +0000 (19:46 +0400)]
stream_wrap: do not crash if handle was closed

Ignore cases where the handle is already gone, like we do in
`handle_wrap.cc`. It should be safe to close handle and then call some
binding methods on it, since the internal handle may be shared between
`_tls_wrap.js` and `net.js` modules.

Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/node-forward/node/pull/37

9 years agosrc: remove usage of extended sizeof
Nikolai Vavilov [Tue, 28 Oct 2014 17:21:08 +0000 (19:21 +0200)]
src: remove usage of extended sizeof

It's not supported in VS2013.

PR-URL: https://github.com/node-forward/node/pull/38
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agosrc: simplify v8 thread pool implementation
Ben Noordhuis [Sat, 25 Oct 2014 06:45:55 +0000 (08:45 +0200)]
src: simplify v8 thread pool implementation

This commit drops the semaphore in exchange for a second condition
variable and makes the task ring an array member instead of allocating
it on the heap.  That in turn makes size calculations a little easier
because of the array's fixed size.

PR-URL: https://github.com/node-forward/node/pull/34
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agosrc: fix uninitialized memory dereference
Ben Noordhuis [Sat, 25 Oct 2014 05:27:21 +0000 (07:27 +0200)]
src: fix uninitialized memory dereference

The elements of the heap-allocated TaskQueue::ring_ array in
src/node_v8_platform.cc were compared against without being
initialized first.

Fixes node-forward/node#33.

PR-URL: https://github.com/node-forward/node/pull/34
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agonet: add pauseOnConnect option to createServer()
cjihrig [Sat, 18 Oct 2014 01:45:40 +0000 (21:45 -0400)]
net: add pauseOnConnect option to createServer()

Currently when a server receives a new connection the underlying socket
handle begins reading data immediately. This causes problems when
sockets are passed between processes, as data can be read by the first
process and thus never read by the second process.

This commit allows sockets that are constructed with a handle to be
paused initially.

PR-URL: https://github.com/joyent/node/pull/8576
Fixes: https://github.com/joyent/node/issues/7905
Fixes: https://github.com/joyent/node/issues/7784
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agodocs: fix smalloc.dispose() example
Vladimir Kurchatkin [Tue, 21 Oct 2014 09:00:37 +0000 (13:00 +0400)]
docs: fix smalloc.dispose() example

Also couple of additions about dispose and limitations of smalloc'ed
objects.

Fixes: https://github.com/joyent/node/pull/8625
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agodoc: update compiler requirements in README
Ben Noordhuis [Mon, 27 Oct 2014 11:39:19 +0000 (12:39 +0100)]
doc: update compiler requirements in README

The latest V8 upgrade and the C++11-ification of the source code in src/
requires a recent compiler.  Update the requirements in the README.

Fixes node-forward/node#35.

PR-URL: https://github.com/node-forward/node/pull/36
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agolint: fix whitespace issues
Trevor Norris [Sat, 25 Oct 2014 21:27:23 +0000 (14:27 -0700)]
lint: fix whitespace issues

Fixes: f6e5740 "path: resolve normalize drive letter to lower case"
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
9 years agosrc: fix comparison of WCHAR with nullptr
Nikolai Vavilov [Fri, 24 Oct 2014 22:36:59 +0000 (01:36 +0300)]
src: fix comparison of WCHAR with nullptr

PR-URL: https://github.com/node-forward/node/pull/32
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agoMerge remote-tracking branch 'origin/v0.12' into v0.12
Fedor Indutny [Fri, 24 Oct 2014 12:52:29 +0000 (16:52 +0400)]
Merge remote-tracking branch 'origin/v0.12' into v0.12

Conflicts:
src/cares_wrap.cc
src/env-inl.h
src/env.h
src/node.cc
src/node.h
src/node_crypto.cc

9 years agosrc: mark more destructors with override keyword
Ben Noordhuis [Thu, 23 Oct 2014 20:45:58 +0000 (22:45 +0200)]
src: mark more destructors with override keyword

The previous commits fixed oversights in destructors that should have
been marked virtual but weren't.  This commit marks destructors from
derived classes with the override keyword.

9 years agosrc: mark SSLWrap destructor as virtual
Ben Noordhuis [Thu, 23 Oct 2014 20:32:41 +0000 (22:32 +0200)]
src: mark SSLWrap destructor as virtual

Like the previous commit but this time for the SSLWrap destructor.

9 years agosrc: mark BaseObject destructor as virtual
Ben Noordhuis [Thu, 23 Oct 2014 20:22:00 +0000 (22:22 +0200)]
src: mark BaseObject destructor as virtual

Like the previous commit but this time for the BaseObject destructor.

9 years agosrc: mark AsyncWrap destructor as virtual
Ben Noordhuis [Thu, 23 Oct 2014 20:04:47 +0000 (22:04 +0200)]
src: mark AsyncWrap destructor as virtual

Make AsyncWrap::~AsyncWrap() virtual, otherwise it is unsafe to delete
a derived class through a pointer to AsyncWrap.  Fortunately, we don't
do that anywhere right now; this commit is merely a preemptive bug fix.

9 years agosrc: mark empty destructors as default
Ben Noordhuis [Wed, 22 Oct 2014 02:53:26 +0000 (04:53 +0200)]
src: mark empty destructors as default

Mark empty destructors as having a default no-op implementation.
Remove a few unused constructors and destructors while we are here.

9 years agosrc: update DISALLOW_COPY_AND_ASSIGN() to c++11
Ben Noordhuis [Wed, 22 Oct 2014 02:33:01 +0000 (04:33 +0200)]
src: update DISALLOW_COPY_AND_ASSIGN() to c++11

Mark the matrix of copy/move constructor/assignment operator as deleted.
Prevents the object from being copied around (the macro already did that
pre-C++11), but also from being moved out.

9 years agosrc: mark virtual functions with override keyword
Ben Noordhuis [Wed, 22 Oct 2014 02:26:25 +0000 (04:26 +0200)]
src: mark virtual functions with override keyword

Add `override` keywords where appropriate.  Makes maintenance easier
because the compiler will shout at you when a base class changes in
an incompatible way.

9 years agosrc: remove STATIC_ASSERT() macro
Ben Noordhuis [Wed, 22 Oct 2014 01:53:57 +0000 (03:53 +0200)]
src: remove STATIC_ASSERT() macro

This macro does not not rightfully belong in node.h, remove it.
Replace the one use site with a C++11 `static_assert` construct.

9 years agosrc: replace NULL with nullptr
Ben Noordhuis [Wed, 22 Oct 2014 01:29:32 +0000 (03:29 +0200)]
src: replace NULL with nullptr

Now that we are building with C++11 features enabled, replace use
of NULL with nullptr.

The benefit of using nullptr is that it can never be confused for
an integral type because it does not support implicit conversions
to integral types except boolean - unlike NULL, which is defined
as a literal `0`.

9 years agopath: resolve normalize drive letter to lower case
dead-horse [Wed, 17 Sep 2014 10:59:59 +0000 (18:59 +0800)]
path: resolve normalize drive letter to lower case

make path.resolve work the same as path.normalize

9 years agoetw: use Isolate to SetJitCodeEventHandler
Rod Vagg [Sat, 18 Oct 2014 12:25:10 +0000 (23:25 +1100)]
etw: use Isolate to SetJitCodeEventHandler

PR-URL: https://github.com/node-forward/node/pull/27
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agotest: allow common.PIPE to be configured via env
Rod Vagg [Sat, 18 Oct 2014 04:06:43 +0000 (15:06 +1100)]
test: allow common.PIPE to be configured via env

Add optional env var $NODE_COMMON_PIPE for setting common.PIPE to
manually deal with maximum path lengths for unix sockets.

PR-URL: https://github.com/node-forward/node/pull/26
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
9 years agobuild: remove workarounds for gcc <= 4.4
Ben Noordhuis [Thu, 16 Oct 2014 17:35:16 +0000 (19:35 +0200)]
build: remove workarounds for gcc <= 4.4

Now that V8 requires a compiler with decent C++11 support, there is no
reason to keep supporting old versions of gcc.  Remove workarounds for
bugs in gcc 4.4 and older.

This coincidentally makes it easier to build with clang 3.3 + address
sanitizer because clang no longer chokes on the `-fno-tree-vrp` switch.

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agobuild: add asan option to multi-arch/mode build
Ben Noordhuis [Thu, 16 Oct 2014 17:22:34 +0000 (19:22 +0200)]
build: add asan option to multi-arch/mode build

Make it possible to build node against Address Sanitizer.  Enable with:

    $ make -f Makefile.build asan=clang++ CC=clang CC_host=clang

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agotest: make test runner multi-arch/mode compatible
Ben Noordhuis [Thu, 16 Oct 2014 16:43:13 +0000 (18:43 +0200)]
test: make test runner multi-arch/mode compatible

Make `python tools/test.py --arch=ia32,x64 --mode=debug,release` work.
The test runner looks for the `node` binary in `out/${arch}.${mode}/`.

Running tools/test.py without --arch makes it use `out/Release/node` or
`out/Debug/node` like before.

This commit removes `test/simple/test-executable-path.js` because the
assumptions it makes about the locations of the debug and release
binaries are now outdated.

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agobuild: set up basic multi-arch/mode build
Ben Noordhuis [Thu, 16 Oct 2014 15:10:33 +0000 (17:10 +0200)]
build: set up basic multi-arch/mode build

Make `make -f Makefile.build ia32.release x64.debug` work.  It's not
perfect yet: it requires running `./configure` first and the generated
`config.gypi` is shared across builds.

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agobuild: copy V8 makefile to top-level directory
Ben Noordhuis [Thu, 16 Oct 2014 14:41:24 +0000 (16:41 +0200)]
build: copy V8 makefile to top-level directory

Will be used as the template for a multi-arch, multi-mode build system.

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agobuild: add x32 support
Ben Noordhuis [Tue, 14 Oct 2014 20:52:16 +0000 (22:52 +0200)]
build: add x32 support

This commit adds preliminary x32 support.  Configure with:

    $ ./configure --dest-cpu=x32

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agodeps: fix v8 x32 build
Ben Noordhuis [Tue, 14 Oct 2014 20:50:08 +0000 (22:50 +0200)]
deps: fix v8 x32 build

Fix double definition errors in the libv8_base.a library target by
compiling out stub functions when building for x32.

This fix is incomplete because, although V8 now builds, it makes a
number of bad assumptions about the size of stack slots, see
https://code.google.com/p/v8/issues/detail?id=3630.

PR-URL: https://github.com/node-forward/node/pull/24
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agotest: fix non-determinism in test-crypto-domains
Ben Noordhuis [Thu, 16 Oct 2014 01:45:53 +0000 (03:45 +0200)]
test: fix non-determinism in test-crypto-domains

The test implicitly assumed that crypto operations complete in the same
order as they are started but, because they go round-trip through the
thread pool, there is no such guarantee.  Enforce proper sequencing.

Fixes node-forward/node#22.

PR-URL: https://github.com/node-forward/node/pull/23
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agosrc: attach env directly to api functions
Ben Noordhuis [Mon, 13 Oct 2014 13:19:55 +0000 (15:19 +0200)]
src: attach env directly to api functions

Attach the per-context execution environment directly to API functions.
Rationale:

 * Gets node one step closer to multi-isolate readiness.

 * Avoids multi-context confusion, e.g. when the caller and callee live
   in different contexts.

 * Avoids expensive calls to pthread_getspecific() on platforms where
   V8 does not know how to use the thread-local storage directly.
   (Linux, the BSDs.)

PR-URL: https://github.com/node-forward/node/pull/18
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agosrc: remove unused Environment::GetCurrent() calls
Ben Noordhuis [Sun, 12 Oct 2014 15:48:05 +0000 (17:48 +0200)]
src: remove unused Environment::GetCurrent() calls

Remove a few Environment::GetCurrent() calls that g++ failed to detect
were not used for anything.  The return value was assigned to a local
variable but not used meaningfully.

PR-URL: https://github.com/node-forward/node/pull/18
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agosrc: remove unused MIN macro
Ben Noordhuis [Sat, 11 Oct 2014 19:54:59 +0000 (21:54 +0200)]
src: remove unused MIN macro

Defined in src/node.cc but not actually in use; remove it.

PR-URL: https://github.com/node-forward/node/pull/18
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agosrc: ignore risky env vars when setuid root
Ben Noordhuis [Sat, 11 Oct 2014 19:48:25 +0000 (21:48 +0200)]
src: ignore risky env vars when setuid root

On POSIX platforms, check that the uid and gid match the euid and egid
respectively before looking up the environment variable.

Before this commit, an i18n-enabled suid node would cheerfully load
attacker-controlled ICU data through the NODE_ICU_DATA environment
variable.

This commit is not a complete fix.  For example, it's up for debate
what to do with the NODE_CHANNEL_FD environment variable.

PR-URL: https://github.com/node-forward/node/pull/18
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agosrc: replace assert() with CHECK()
Ben Noordhuis [Sat, 11 Oct 2014 14:52:07 +0000 (16:52 +0200)]
src: replace assert() with CHECK()

Mechanically replace assert() statements with UNREACHABLE(), CHECK(),
or CHECK_{EQ,NE,LT,GT,LE,GE}() statements.

The exceptions are src/node.h and src/node_object_wrap.h because they
are public headers.

PR-URL: https://github.com/node-forward/node/pull/16
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agosrc: fix up imports
Ben Noordhuis [Sat, 11 Oct 2014 14:48:49 +0000 (16:48 +0200)]
src: fix up imports

Make tools/check-imports.sh stop complaining, remove or reorder 'using'
statements.

PR-URL: https://github.com/node-forward/node/pull/16
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agosrc: remove unnecessary HandleScopes
Ben Noordhuis [Sat, 11 Oct 2014 14:24:12 +0000 (16:24 +0200)]
src: remove unnecessary HandleScopes

API callback functions don't need to create a v8::HandleScope instance
because V8 already creates one in the JS->C++ adapter frame.

PR-URL: https://github.com/node-forward/node/pull/16
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agodeps: fix postmortem-metadata generator in v8
Refael Ackermann [Mon, 29 Sep 2014 09:20:50 +0000 (13:20 +0400)]
deps: fix postmortem-metadata generator in v8

Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: https://github.com/joyent/node/pull/8476

9 years agotest: fix error messages after v8 upgrade
Fedor Indutny [Fri, 10 Oct 2014 22:18:34 +0000 (02:18 +0400)]
test: fix error messages after v8 upgrade

9 years agogyp: build with gnu++0x for the sake of new v8
Fedor Indutny [Fri, 10 Oct 2014 22:17:49 +0000 (02:17 +0400)]
gyp: build with gnu++0x for the sake of new v8

The new v8 doesn't build on non gnu++0x, set it to a proper value for
all systems.

9 years agov8_platform: provide default v8::Platform impl
Fedor Indutny [Fri, 10 Oct 2014 22:17:03 +0000 (02:17 +0400)]
v8_platform: provide default v8::Platform impl

Provide default Platform implementation for v8's purposes.

9 years agobuild: vcbuild fix "The input line is too long."
Alexis Campailla [Fri, 10 Oct 2014 13:14:47 +0000 (15:14 +0200)]
build: vcbuild fix "The input line is too long."

vcbuild.bat is calling vcvars.bat, which doesn't detect if the environment
has already been set. This causes repeated entries to be added to the PATH,
which after a few invocations will lead to an error:
The input line is too long.

9 years agodeps: update v8 to 3.29.93.1
Fedor Indutny [Fri, 10 Oct 2014 10:49:02 +0000 (14:49 +0400)]
deps: update v8 to 3.29.93.1

9 years agostreams: make setDefaultEncoding() throw
Brian White [Thu, 9 Oct 2014 20:07:50 +0000 (16:07 -0400)]
streams: make setDefaultEncoding() throw

PR-URL: https://github.com/joyent/node/pull/8529
Fixes: f04f3a0 "streams: set default encoding for writable streams"
[trev.norris@gmail.com: update tests to check if throws]
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
9 years agofreebsd,linux,sunos: make stack non-executable
Ben Noordhuis [Sat, 3 May 2014 01:55:35 +0000 (03:55 +0200)]
freebsd,linux,sunos: make stack non-executable

Link with -z,noexecstack to make stack memory non-executable.  Makes
shellcode injection through buffer overflows more difficult.

Fixes: https://github.com/joyent/node/issues/7542
PR-URL: https://github.com/node-forward/node/pull/8
Reviewed-By: Trevor Norris <trevnorris@gmail.com>
9 years agocrypto: update root certificates
Ben Noordhuis [Thu, 9 Oct 2014 21:10:55 +0000 (23:10 +0200)]
crypto: update root certificates

Update the list of root certificates in src/node_root_certs.h with
tools/mk-ca-bundle.pl.

PR-URL: https://github.com/node-forward/node/pull/7
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Trevor Norris <trevnorris@gmail.com>
9 years agotools: update certdata.txt
Ben Noordhuis [Thu, 9 Oct 2014 21:08:51 +0000 (23:08 +0200)]
tools: update certdata.txt

This is the latest certdata.txt from [0], last updated on 2014-10-08.

[0] https://hg.mozilla.org/mozilla-central/raw-file/f0bb13ef0ee4/security/nss/lib/ckfw/builtins/certdata.txt

PR-URL: https://github.com/node-forward/node/pull/7
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Trevor Norris <trevnorris@gmail.com>
9 years agobuild: determine and use EXEEXT on windows
Ray Donnelly [Sat, 30 Aug 2014 22:59:05 +0000 (23:59 +0100)]
build: determine and use EXEEXT on windows

PR-URL: https://github.com/joyent/node/pull/8294
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agosrc: fixes for win32
Ray Donnelly [Sat, 30 Aug 2014 22:51:20 +0000 (23:51 +0100)]
src: fixes for win32

Update following macros:

* NODE_NET_SOCKET_{READ,WRITE}() - they both take 4 arguments,
  not 2

* NODE_COUNT_GC_PERCENTTIME() - it takes a single argument.

Use INT_PTR instead of INT32 in pointer casts in win32_etw provider.

PR-URL: https://github.com/joyent/node/pull/8294
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agobuild: fix build for SmartOS
Julien Gilli [Thu, 9 Oct 2014 20:01:27 +0000 (13:01 -0700)]
build: fix build for SmartOS

This change in V8: https://code.google.com/p/v8/source/detail?r=22210
has introduced a method named OS::GetCurrentThreadId which fails to
compile on OSes where a "gettid" syscall does not exist.
This build issue has been fixed upstream by another change:
https://code.google.com/p/v8/source/detail?r=23459. This commit
integrates this fix. It's still not clear if this is good enough for the
long term, see https://code.google.com/p/v8/issues/detail?id=3620 for
more information.

The other build issue was due to the fact that alloca.h is not included
by other system includes on SmartOS, which is assumed by V8.

PR-URL: https://github.com/joyent/node/pull/8534
Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agodoc: correct createSecureContext
Wang Xinyong [Thu, 9 Oct 2014 17:15:05 +0000 (01:15 +0800)]
doc: correct createSecureContext

Remove incorrect stablity indication of tls.createSecureContext, and
format stablity indication of crypto.createCredentials.

Fixes: e50749 "doc: document `tls.createSecureContext`"
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agotest: fix test-child-process-spawn-typeerror
Alexis Campailla [Wed, 8 Oct 2014 18:30:01 +0000 (20:30 +0200)]
test: fix test-child-process-spawn-typeerror

You cannot spawn 'dir' on Windows because it's not an executable.  Also,
some people might have 'ls' on their path on Windows, so I changed
invalidCmd to something that's highly unlikely to exist.

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agodoc: fix wording and punctuation in modules
Stiliyan Lazarov [Sat, 4 Oct 2014 14:50:50 +0000 (10:50 -0400)]
doc: fix wording and punctuation in modules

[trev.norris@gmail.com: break lines at 80 characters]
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
9 years agocrypto: createDiffieHellman throw for bad args
Trevor Norris [Wed, 8 Oct 2014 22:38:46 +0000 (15:38 -0700)]
crypto: createDiffieHellman throw for bad args

Previously crypto.createDiffieHellman() would fail silently when a bad
argument was passed for prime/prime_length. Now throws TypeError.

Fixes: https://github.com/joyent/node/issues/8480
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
9 years agotest: fix debug-signal-cluster after da update
Fedor Indutny [Wed, 8 Oct 2014 10:35:07 +0000 (14:35 +0400)]
test: fix debug-signal-cluster after da update

The cluster children are hitting breakpoint at `cluster.onread` and
hanging on a Semaphore wait now. This prevents them from disconnecting
gracefully. Considering that the test is checking different thing, the
cluster children needs to be force killed from the grand parent process.

Reviewed-By: Trevor Norris <trevnorris@gmail.com>
PR-URL: https://github.com/joyent/node/pull/8476

9 years agosrc, test: fixup after v8 update
Fedor Indutny [Wed, 8 Oct 2014 10:34:51 +0000 (14:34 +0400)]
src, test: fixup after v8 update

Because of behavior change of some V8 APIs (they mostly became more
    strict), following modules needed to be fixed:

* crypto: duplicate prototype methods are not allowed anymore
* contextify: some TryCatch trickery, the binding was using it
incorrectly
* util: maximum call stack error is now crashing in a different place

Reviewed-By: Trevor Norris <trevnorris@gmail.com>
PR-URL: https://github.com/joyent/node/pull/8476

9 years agocluster: do not signal children in debug mode
Fedor Indutny [Sat, 4 Oct 2014 14:44:46 +0000 (18:44 +0400)]
cluster: do not signal children in debug mode

Do not send signal to children if they are already in debug mode.
Node.js on Windows does not register signal handler, and thus calling
`process._debugProcess()` will throw an error.

Reviewed-By: Trevor Norris <trevnorris@gmail.com>
PR-URL: https://github.com/joyent/node/pull/8476

9 years agodeps: re-implement debugger-agent
Fedor Indutny [Sat, 4 Oct 2014 14:44:39 +0000 (18:44 +0400)]
deps: re-implement debugger-agent

Reviewed-By: Trevor Norris <trevnorris@gmail.com>
PR-URL: https://github.com/joyent/node/pull/8476

9 years agodeps: fix postmortem-metadata generator in v8
Refael Ackermann [Mon, 29 Sep 2014 09:20:50 +0000 (13:20 +0400)]
deps: fix postmortem-metadata generator in v8

Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: https://github.com/joyent/node/pull/8476

9 years agodeps: apply floating irhydra patch to v8
Fedor Indutny [Thu, 2 Oct 2014 04:16:24 +0000 (08:16 +0400)]
deps: apply floating irhydra patch to v8

Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: https://github.com/joyent/node/pull/8476

9 years agodeps: update v8 to 3.28.73
Refael Ackermann [Mon, 29 Sep 2014 09:20:04 +0000 (13:20 +0400)]
deps: update v8 to 3.28.73

Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: https://github.com/joyent/node/pull/8476

9 years agotest: fix debug-signal-cluster after da update
Fedor Indutny [Wed, 8 Oct 2014 10:35:07 +0000 (14:35 +0400)]
test: fix debug-signal-cluster after da update

The cluster children are hitting breakpoint at `cluster.onread` and
hanging on a Semaphore wait now. This prevents them from disconnecting
gracefully. Considering that the test is checking different thing, the
cluster children needs to be force killed from the grand parent process.

Reviewed-By: Trevor Norris <trevnorris@gmail.com>
PR-URL: https://github.com/joyent/node/pull/8476

9 years agosrc, test: fixup after v8 update
Fedor Indutny [Wed, 8 Oct 2014 10:34:51 +0000 (14:34 +0400)]
src, test: fixup after v8 update

Because of behavior change of some V8 APIs (they mostly became more
    strict), following modules needed to be fixed:

* crypto: duplicate prototype methods are not allowed anymore
* contextify: some TryCatch trickery, the binding was using it
incorrectly
* util: maximum call stack error is now crashing in a different place

Reviewed-By: Trevor Norris <trevnorris@gmail.com>
PR-URL: https://github.com/joyent/node/pull/8476

9 years agocluster: do not signal children in debug mode
Fedor Indutny [Sat, 4 Oct 2014 14:44:46 +0000 (18:44 +0400)]
cluster: do not signal children in debug mode

Do not send signal to children if they are already in debug mode.
Node.js on Windows does not register signal handler, and thus calling
`process._debugProcess()` will throw an error.

Reviewed-By: Trevor Norris <trevnorris@gmail.com>
PR-URL: https://github.com/joyent/node/pull/8476

9 years agodeps: re-implement debugger-agent
Fedor Indutny [Sat, 4 Oct 2014 14:44:39 +0000 (18:44 +0400)]
deps: re-implement debugger-agent

Reviewed-By: Trevor Norris <trevnorris@gmail.com>
PR-URL: https://github.com/joyent/node/pull/8476

9 years agodeps: fix postmortem-metadata generator in v8
Refael Ackermann [Mon, 29 Sep 2014 09:20:50 +0000 (13:20 +0400)]
deps: fix postmortem-metadata generator in v8

Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: https://github.com/joyent/node/pull/8476

9 years agodeps: apply floating irhydra patch to v8
Fedor Indutny [Thu, 2 Oct 2014 04:16:24 +0000 (08:16 +0400)]
deps: apply floating irhydra patch to v8

Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: https://github.com/joyent/node/pull/8476

9 years agodeps: update v8 to 3.28.73
Refael Ackermann [Mon, 29 Sep 2014 09:20:04 +0000 (13:20 +0400)]
deps: update v8 to 3.28.73

Reviewed-By: Fedor Indutny <fedor@indutny.com>
PR-URL: https://github.com/joyent/node/pull/8476

9 years agotls_wrap: ignore ZERO_RETURN after close_notify
Fedor Indutny [Mon, 6 Oct 2014 12:23:01 +0000 (16:23 +0400)]
tls_wrap: ignore ZERO_RETURN after close_notify

Do not call SSL_read() and ignore ZERO_RETURN if the connection was
shutdown and there could not be any reads.

Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/joyent/node/pull/8519

9 years agoMerge remote-tracking branch 'joyent/v0.12'
Fedor Indutny [Wed, 8 Oct 2014 11:31:45 +0000 (15:31 +0400)]
Merge remote-tracking branch 'joyent/v0.12'

9 years agobuffer, doc: misc. fix and cleanup
Trevor Norris [Wed, 8 Oct 2014 09:08:54 +0000 (02:08 -0700)]
buffer, doc: misc. fix and cleanup

* Add official documentation that a Buffer instance is a viable
  argument when instantiating a new Buffer.
* Properly set the poolOffset when a buffer needs to be truncated.
* Add comments clarifying specific peculiar coding choices.
* Remove a level of unnecessary indentation.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
9 years agosrc: update use of ExternalArrayType constants
Trevor Norris [Wed, 8 Oct 2014 08:34:46 +0000 (01:34 -0700)]
src: update use of ExternalArrayType constants

Continuation of 4809c7a to update the use of v8::ExternalArrayType.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
9 years agotools: fix for testing openssl integrations
Refael Ackermann [Thu, 2 Oct 2014 08:20:51 +0000 (11:20 +0300)]
tools: fix for testing openssl integrations

Windows doesn't resolve ".." the way we expect it for symlinks and
junctions.

PR-URL: https://github.com/joyent/node/pull/8489
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
9 years agosrc: fix jslint warning
Trevor Norris [Wed, 8 Oct 2014 08:13:43 +0000 (01:13 -0700)]
src: fix jslint warning

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
9 years agosmalloc: update use of ExternalArrayType constants
Trevor Norris [Wed, 8 Oct 2014 08:06:06 +0000 (01:06 -0700)]
smalloc: update use of ExternalArrayType constants

The constants in enum v8::ExternalArrayType have been changed. The old
values are there for legacy reasons, but it's best to update anyway.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
9 years agodoc: add missing semicolons
Steve Mao [Fri, 3 Oct 2014 05:53:15 +0000 (15:53 +1000)]
doc: add missing semicolons

PR-URL: https://github.com/joyent/node/pull/8498
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agostreams: set default encoding for writable streams
Johnny Ray [Tue, 7 Oct 2014 23:32:05 +0000 (16:32 -0700)]
streams: set default encoding for writable streams

Add API Writable#setDefaultEncoding().

PR-URL: https://github.com/joyent/node/pull/8483
Fixes: https://github.com/joyent/node/issues/7159
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agobuild: i18n: py27 -> py26 dependency
Steven R. Loomis [Sat, 4 Oct 2014 05:41:05 +0000 (22:41 -0700)]
build: i18n: py27 -> py26 dependency

Move from argparse to optparse for dependency management.

Fixes: https://github.com/joyent/node/pull/7719#issuecomment-56868172
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agobuild: i18n: move noisy variables to separate gypi
Steven R. Loomis [Sat, 4 Oct 2014 00:42:37 +0000 (17:42 -0700)]
build: i18n: move noisy variables to separate gypi

Fixes: https://github.com/joyent/node/issues/7676#issuecomment-57535890
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agourl: fixed encoding for slash switching emulation.
Evan Rutledge Borden [Fri, 26 Sep 2014 15:59:39 +0000 (11:59 -0400)]
url: fixed encoding for slash switching emulation.

Fixes: https://github.com/joyent/node/issues/8458
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
9 years agodoc: improve readLine.pause()
Victor Widell [Sun, 30 Mar 2014 10:34:45 +0000 (12:34 +0200)]
doc: improve readLine.pause()

The docs for readLine.pause are misleading. I seriously spent hours on this. If
it isn't a bug, at least it should be well documented.

Someone else stumbled on this too:
http://stackoverflow.com/questions/21341050/pausing-readline-in-node-js

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>