platform/upstream/nodejs.git
9 years agonet: Make server.connections un-enumerable
Patrick Mooney [Wed, 17 Sep 2014 18:54:24 +0000 (13:54 -0500)]
net: Make server.connections un-enumerable

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>
9 years agobenchmark: add test for module loader
Robert Kowalski [Sat, 13 Sep 2014 09:06:28 +0000 (11:06 +0200)]
benchmark: add test for module loader

Adds a test for benchmarking the module loader, needed for benchmarking
changes / refacortings in the module loader.

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Timothy J Fontaine <tjfontaine@gmail.com>
9 years agotest: disable dgram-bind-shared-ports on win32
Timothy J Fontaine [Wed, 24 Sep 2014 21:13:58 +0000 (14:13 -0700)]
test: disable dgram-bind-shared-ports on win32

Windows currently doesn't support clustered dgram sockets, when it does
re-enable this test

9 years agotests: add test for buffer.slice.
Julien Gilli [Wed, 24 Sep 2014 16:36:25 +0000 (09:36 -0700)]
tests: add test for buffer.slice.

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.

9 years agotls_wrap: ensure that TLSCallbacks are gc-able
Fedor Indutny [Tue, 23 Sep 2014 09:49:42 +0000 (13:49 +0400)]
tls_wrap: ensure that TLSCallbacks are gc-able

Call `MakeWeak()` to destruct TLSCallbacks when the js-object dies.

fix #8416

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agobuffer: fix map and set parent to undefined upstream/0.12.0
Trevor Norris [Tue, 23 Sep 2014 20:19:31 +0000 (13:19 -0700)]
buffer: fix map and set parent to undefined

In 4c9b30d removal of the prototype attributes meant NativeBuffer() no
longer had the same object map as Buffer(). By now setting the same
properties in the same order both constructors will produce the same
map.

The same commit changed "parent" from undefined to null. This caused a
failure in Buffer#slice() where it was checked if parent === undefined.
Causing the incorrect parent to be set.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
9 years agouv: apply floating patch 2f54947b
Fedor Indutny [Tue, 23 Sep 2014 20:19:39 +0000 (00:19 +0400)]
uv: apply floating patch 2f54947b

9 years agodeps: update uv to v1.0.0-rc1
Fedor Indutny [Fri, 19 Sep 2014 17:37:55 +0000 (21:37 +0400)]
deps: update uv to v1.0.0-rc1

9 years agocrypto: export externals to internal structs
Fedor Indutny [Fri, 12 Sep 2014 12:27:22 +0000 (13:27 +0100)]
crypto: export externals to internal structs

Export External getters for a internal structs: SSL, SSL_CTX.

9 years agohttp: write() after end() emits an error.
Julien Gilli [Tue, 23 Sep 2014 00:21:40 +0000 (17:21 -0700)]
http: write() after end() emits an error.

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>
9 years agobuffer: improve Buffer constructor
Kang-Hao Kenny [Fri, 19 Sep 2014 15:14:37 +0000 (23:14 +0800)]
buffer: improve Buffer constructor

Increase the performance of new Buffer construction by initializing all
properties before SetIndexedPropertiesToExternalArrayData call.

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agodoc: corrected typo in vm docs
Andrew Teich [Fri, 19 Sep 2014 05:09:24 +0000 (22:09 -0700)]
doc: corrected typo in vm docs

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agonode: support v8 microtask queue
Vladimir Kurchatkin [Thu, 4 Sep 2014 16:02:04 +0000 (20:02 +0400)]
node: support v8 microtask queue

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>
9 years agotest: add test for cluster.worker.destroy()
Julien Gilli [Tue, 2 Sep 2014 17:52:45 +0000 (10:52 -0700)]
test: add test for cluster.worker.destroy()

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>
9 years agocrypto: never store pointer to conn in SSL_CTX
Fedor Indutny [Wed, 17 Sep 2014 22:21:32 +0000 (02:21 +0400)]
crypto: never store pointer to conn in SSL_CTX

SSL_CTX is shared between multiple connections and is not a right place
to store per-connection data.

fix #8348

Reviewed-By: Trevor Norris
9 years agocrypto: clarify RandomBytes() error msg
Mickael van der Beek [Wed, 17 Sep 2014 21:40:01 +0000 (14:40 -0700)]
crypto: clarify RandomBytes() error msg

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agowin: manifest node.exe for Windows 8.1
Alexis Campailla [Fri, 15 Aug 2014 16:25:38 +0000 (18:25 +0200)]
win: manifest node.exe for Windows 8.1

Adding a compatibility section to node.exe embedded manifest so that
Node is declared explicitly compatible with Windows 8.1. Required so
that os.release() can return the correct version on Windows 8.1.

See http://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agodoc: console example improvement
Guilherme de Souza [Fri, 12 Sep 2014 10:07:05 +0000 (07:07 -0300)]
doc: console example improvement

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
9 years agodoc: http.request() improved code example
Guilherme de Souza [Fri, 12 Sep 2014 09:25:15 +0000 (06:25 -0300)]
doc: http.request() improved code example

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
Reviewed-by: Fedor Indutny <fedor@indutny.com>
9 years agoMerge remote-tracking branch 'upstream/v0.10' into v0.12
Timothy J Fontaine [Wed, 17 Sep 2014 00:48:09 +0000 (17:48 -0700)]
Merge remote-tracking branch 'upstream/v0.10' into v0.12

Conflicts:
ChangeLog
deps/v8/src/hydrogen.cc
lib/http.js
lib/querystring.js
src/node_crypto.cc
src/node_version.h
test/simple/test-querystring.js

9 years agoNow working on 0.10.33
Timothy J Fontaine [Tue, 16 Sep 2014 23:53:10 +0000 (16:53 -0700)]
Now working on 0.10.33

9 years agoMerge branch 'v0.10.32-release' into v0.10
Timothy J Fontaine [Tue, 16 Sep 2014 23:52:57 +0000 (16:52 -0700)]
Merge branch 'v0.10.32-release' into v0.10

9 years ago2014.09.16, Version 0.10.32 (Stable) v0.10.32
Timothy J Fontaine [Tue, 16 Sep 2014 22:47:52 +0000 (15:47 -0700)]
2014.09.16, Version 0.10.32 (Stable)

* npm: Update to 1.4.28

* v8: fix a crash introduced by previous release (Fedor Indutny)

* configure: add --openssl-no-asm flag (Fedor Indutny)

* crypto: use domains for any callback-taking method (Chris Dickinson)

* http: do not send `0rnrn` in TE HEAD responses (Fedor Indutny)

* querystring: fix unescape override (Tristan Berger)

* url: Add support for RFC 3490 separators (Mathias Bynens)

9 years agonpm: Update to 1.4.28
Timothy J Fontaine [Tue, 16 Sep 2014 22:38:50 +0000 (15:38 -0700)]
npm: Update to 1.4.28

9 years agohttp: do not send `0\r\n\r\n` in TE HEAD responses
Fedor Indutny [Sat, 13 Sep 2014 12:08:25 +0000 (13:08 +0100)]
http: do not send `0\r\n\r\n` in TE HEAD responses

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>
9 years agocrypto: use domains for any callback-taking method
Chris Dickinson [Tue, 16 Sep 2014 17:14:24 +0000 (10:14 -0700)]
crypto: use domains for any callback-taking method

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>
9 years agolib, src: add vm.runInDebugContext()
Ben Noordhuis [Fri, 22 Aug 2014 13:09:24 +0000 (15:09 +0200)]
lib, src: add vm.runInDebugContext()

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>
9 years agodns: include host name in error message if available
Maciej Małecki [Wed, 6 Aug 2014 14:53:59 +0000 (16:53 +0200)]
dns: include host name in error message if available

This makes errors more readable and similar to FS errors, which also
include file name.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agodoc: document `process.env` better
Maciej Małecki [Mon, 11 Nov 2013 19:51:34 +0000 (20:51 +0100)]
doc: document `process.env` better

Fixes #6424.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agotls: fix encoding in certificate-related functions
Adam Lippai [Sat, 13 Sep 2014 22:37:34 +0000 (00:37 +0200)]
tls: fix encoding in certificate-related functions

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

9 years agodoc: fix modules require.resolve documentation
Mathias Schreck [Wed, 3 Sep 2014 11:45:36 +0000 (13:45 +0200)]
doc: fix modules require.resolve documentation

The behavior of the `node_modules` lookup algorithm was
changed in #1177, but the documentation was not updated completely
to describe the new behavior.

The pseudocode of the lookup algorithm did not metion that
`index.json` is tried to be loaded if you require a folder.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agodeps: backport 60c316 from v8 trunk
Fedor Indutny [Thu, 24 Jul 2014 09:31:45 +0000 (09:31 +0000)]
deps: backport 60c316 from v8 trunk

Original commit message:

    Extend the interceptor setter ASSERT to support the JSGlobalProxy case.

    BUG=v8:3463
    LOG=n
    R=dcarney@chromium.org

    Review URL: https://codereview.chromium.org/415973004

    git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22589 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

Signed-off-by: Fedor Indutny <fedor@indutny.com>
fix #7969

9 years agogyp: fix post-mortem in v0.11
Fedor Indutny [Mon, 21 Jul 2014 18:12:11 +0000 (22:12 +0400)]
gyp: fix post-mortem in v0.11

Expose missing constants and keep symbols on OSX.

9 years agodeps: cherry-pick r21466 from v8 trunk
Ben Noordhuis [Fri, 23 May 2014 14:01:17 +0000 (14:01 +0000)]
deps: cherry-pick r21466 from v8 trunk

Check for cached transition to ExternalArray elements kind.
See [1] and [2] for details.

[1] https://code.google.com/p/v8/issues/detail?id=3337
[2] https://codereview.chromium.org/291193011

Signed-off-by: Fedor Indutny <fedor@indutny.com>
9 years agodeps: cherry-pick r21297 from v8 trunk
Ben Noordhuis [Wed, 14 May 2014 09:25:57 +0000 (11:25 +0200)]
deps: cherry-pick r21297 from v8 trunk

Changes the return value of PropertyCallbackInfo<T>::This() from
Local<Value> back to Local<Object>.  See [1] and [2] for background.

[1] https://groups.google.com/forum/#!topic/v8-users/wP2UcQ4cBW4
[2] https://codereview.chromium.org/285643008/

Signed-off-by: Fedor Indutny <fedor@indutny.com>
9 years agodeps: fix up v8 postmortem codegen
Ben Noordhuis [Mon, 12 May 2014 03:38:47 +0000 (05:38 +0200)]
deps: fix up v8 postmortem codegen

Signed-off-by: Fedor Indutny <fedor@indutny.com>
9 years agov8: Upgrade 3.26.33 with 14 patches
Trevor Norris [Tue, 9 Sep 2014 21:03:08 +0000 (14:03 -0700)]
v8: Upgrade 3.26.33 with 14 patches

V8 3.26.31 has received 14 patches since the upgrade to 3.26.33. Since
3.26.33 is technically a tag on the 3.27 branch, reverting back to
3.26.31 would remove now default functionality like WeakMaps. Because of
that the patches have simply been cherry-picked and squashed.

Here is a summary of all patches:

* Fix index register assignment in LoadFieldByIndex for arm, arm64, and
  mips.
* Fix invalid attributes when generalizing because of incompatible map
  change.
* Skip write barriers when updating the weak hash table.
* MIPS: Avoid HeapObject check in HStoreNamedField.
* Do GC if CodeRange fails to allocate a block.
* Array.concat: properly go to dictionary mode when required.
* Keep CodeRange::current_allocation_block_index_ in range.
* Grow heap slower if GC freed many global handles.
* Do not eliminate bounds checks for "<const> - x".
* Add missing map check to optimized f.apply(...).
* In GrowMode, force the value to the right representation to avoid
  deopts between storing the length and storing the value.
* Reduce max executable size limit.
* Fix invalid condition in check elimination effects.
* Fix off-by-one error in Array.concat slow mode check.

For more information see: https://github.com/v8/v8/commits/3.26

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agotls: `checkServerIdentity` option
Trevor Livingston [Fri, 5 Sep 2014 14:56:55 +0000 (09:56 -0500)]
tls: `checkServerIdentity` option

Allow overriding `checkServerIdentity` function, when connecting to a
TLS server.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agosrc: remove Environment::GetCurrentChecked()
Ben Noordhuis [Fri, 5 Sep 2014 15:33:28 +0000 (17:33 +0200)]
src: remove Environment::GetCurrentChecked()

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>
9 years agolib: unexport http.parsers
Ben Noordhuis [Fri, 22 Aug 2014 23:25:40 +0000 (01:25 +0200)]
lib: unexport http.parsers

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>
9 years agolib: http: poison parser references after freeing
Ben Noordhuis [Fri, 22 Aug 2014 22:57:45 +0000 (00:57 +0200)]
lib: http: poison parser references after freeing

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>
9 years agosrc: update and expand comments in base-object.h
Ben Noordhuis [Fri, 22 Aug 2014 22:33:04 +0000 (00:33 +0200)]
src: update and expand comments in base-object.h

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>
9 years agolib, src: don't make http parser handles weak
Ben Noordhuis [Fri, 22 Aug 2014 22:31:44 +0000 (00:31 +0200)]
lib, src: don't make http parser handles weak

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>
9 years agosrc: add ClearWrap() to util.h
Ben Noordhuis [Thu, 4 Sep 2014 02:23:03 +0000 (04:23 +0200)]
src: add ClearWrap() to util.h

Counterpart to Wrap(), clears the previously assigned internal field.
Will be used in an upcoming commit.

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agosrc: fix handle leak in Parser::Execute()
Ben Noordhuis [Fri, 22 Aug 2014 21:57:46 +0000 (23:57 +0200)]
src: fix handle leak in Parser::Execute()

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>
9 years agolib: improved forEach object performance
Majid Arif Siddiqui [Thu, 14 Aug 2014 03:15:24 +0000 (11:15 +0800)]
lib: improved forEach object performance

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agotest: listen on exclusive port in cluster workers
cjihrig [Thu, 4 Sep 2014 15:10:44 +0000 (11:10 -0400)]
test: listen on exclusive port in cluster workers

Test that listening on exclusive ports with the cluster module works
correctly.

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agonet,dgram: workers can listen on exclusive ports
cjihrig [Fri, 22 Aug 2014 20:51:53 +0000 (16:51 -0400)]
net,dgram: workers can listen on exclusive ports

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>
9 years agosrc: be more intelligent about use of "arguments"
Trevor Norris [Wed, 3 Sep 2014 21:24:50 +0000 (14:24 -0700)]
src: be more intelligent about use of "arguments"

Use 'use strict' when there are named arguments and the arguments object
is passed to apply(). Also pass named arguments to call() when the named
argument is modified by the function.

Suggested in
https://github.com/joyent/node/pull/8302#issuecomment-54331801

Confirmed in
https://github.com/joyent/node/pull/8302#issuecomment-54364818

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
9 years agotls: support multiple keys/certs
Fedor Indutny [Mon, 1 Sep 2014 14:44:57 +0000 (18:44 +0400)]
tls: support multiple keys/certs

Required to serve website with both ECDSA/RSA certificates.

9 years agotls_wrap: fix use after free
Fedor Indutny [Mon, 1 Sep 2014 14:44:07 +0000 (18:44 +0400)]
tls_wrap: fix use after free

Do not free TLSCallbacks from StreamWrap. TLSCallbacks is bound to a V8
object and should be collected by V8's GC.

9 years agocrypto: use less memory for storing keys
Fedor Indutny [Mon, 1 Sep 2014 12:07:45 +0000 (16:07 +0400)]
crypto: use less memory for storing keys

Use `BIO_new_mem_buf` where possible to reduce memory usage and
initialization costs.

9 years agoconfigure: add --openssl-no-asm flag
Fedor Indutny [Tue, 2 Sep 2014 11:53:36 +0000 (15:53 +0400)]
configure: add --openssl-no-asm flag

see #8062

Reviewed-By: Trevor Norris <trev.norris@gmail.com>
9 years agonet: Improve Socket.prototype.write()
Jackson Tian [Mon, 1 Sep 2014 14:44:19 +0000 (22:44 +0800)]
net: Improve Socket.prototype.write()

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agostream_wrap: Add support to write binary strings
Trevor Norris [Wed, 3 Sep 2014 10:36:17 +0000 (03:36 -0700)]
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>
9 years agonode,async-wrap: verify domain enter/exit are set
Trevor Norris [Tue, 2 Sep 2014 18:30:45 +0000 (11:30 -0700)]
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>
9 years agotests: add test for non-integer delay timers.
Julien Gilli [Tue, 26 Aug 2014 18:45:12 +0000 (11:45 -0700)]
tests: add test for non-integer delay timers.

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>
9 years agoconfigure: generate a fully statically linked exec
Jesús Leganés Combarro "piranna [Sat, 23 Aug 2014 21:01:06 +0000 (23:01 +0200)]
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>
9 years agocluster: centralize removal from workers list.
Julien Gilli [Sat, 16 Aug 2014 00:20:32 +0000 (17:20 -0700)]
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>
9 years agocrypto: unsigned value can't be negative
Brian White [Tue, 2 Sep 2014 13:27:33 +0000 (09:27 -0400)]
crypto: unsigned value can't be negative

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agocrypto: avoid memory leak
Brian White [Tue, 2 Sep 2014 13:26:14 +0000 (09:26 -0400)]
crypto: avoid memory leak

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agosrc: reading/owner/onread/onconnection for tcp
Jackson Tian [Sat, 23 Aug 2014 14:48:13 +0000 (22:48 +0800)]
src: reading/owner/onread/onconnection for tcp

Initialize fields to avoid Hidden Class creation in runtime.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agocrypto: wrap ECDH constants in HAVE_OPENSSL
Isaac Burns [Fri, 29 Aug 2014 19:47:42 +0000 (14:47 -0500)]
crypto: wrap ECDH constants in HAVE_OPENSSL

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agotls: add DHE-RSA-AES128-SHA256 to the def ciphers
Shigeki Ohtsu [Thu, 28 Aug 2014 07:51:42 +0000 (16:51 +0900)]
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>
9 years agotls, crypto: add DHE support
Shigeki Ohtsu [Wed, 27 Aug 2014 09:00:13 +0000 (18:00 +0900)]
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>
9 years agocrypto: introduce ECDH
Fedor Indutny [Wed, 27 Aug 2014 14:01:01 +0000 (18:01 +0400)]
crypto: introduce ECDH

9 years agourl: Add support for RFC 3490 separators
Mathias Bynens [Mon, 4 Aug 2014 10:44:06 +0000 (12:44 +0200)]
url: Add support for RFC 3490 separators

There is no need to split the host by hand in `url.js` – Punycode.js
takes care of it anyway. This not only simplifies the code, but also
adds support for RFC 3490 separators (i.e. not just U+002E, but U+3002,
U+FF0E, and U+FF61 as well).

Closes #6055.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agosrc: Add function name for .byteLength/.compare
Jackson Tian [Mon, 25 Aug 2014 12:55:11 +0000 (20:55 +0800)]
src: Add function name for .byteLength/.compare

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agoquerystring: fix unescape override
Tristan Berger [Tue, 26 Aug 2014 08:39:25 +0000 (04:39 -0400)]
querystring: fix unescape override

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>
9 years agocrypto: allow padding in RSA methods
Fedor Indutny [Sat, 23 Aug 2014 13:38:32 +0000 (17:38 +0400)]
crypto: allow padding in RSA methods

Reviewed-By: Trevor Norris <trevnorris@gmail.com>
9 years agogyp: use --export-dynamic on FreeBSD
Fedor Indutny [Sun, 24 Aug 2014 22:19:15 +0000 (02:19 +0400)]
gyp: use --export-dynamic on FreeBSD

Should help addons use OpenSSL functions.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agodeps: enable ARM assembly for OpenSSL
Fedor Indutny [Fri, 22 Aug 2014 10:21:50 +0000 (14:21 +0400)]
deps: enable ARM assembly for OpenSSL

fix #8062

9 years agocrypto: fix memory leak in Connection::New
Fedor Indutny [Sat, 23 Aug 2014 19:22:23 +0000 (23:22 +0400)]
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>
9 years agodeps: fix up v8 after fd80a3
Fedor Indutny [Thu, 21 Aug 2014 23:59:35 +0000 (03:59 +0400)]
deps: fix up v8 after fd80a3

fd80a31e0697d6317ce8c2d289575399f4e06d21 has introduced a segfault
during redundant boundary check elimination (#8208).

The problem consists of two parts:

  1. Abscense of instruction iterator in
     `EliminateRedundantBoundsChecks`. It was present in recent v8, but
     wasn't considered important at the time of backport. However, since
     the function is changing instructions order in block, it is
     important to not rely at `i->next()` at the end of the loop.
  2. Too strict ASSERT in `MoveIndexIfNecessary`. It is essentially a
     backport of a45c96ab from v8's upstream. See
     https://github.com/v8/v8/commit/a45c96ab for details.

fix #8208

9 years agohttp: avoid create difference hidden class
Jackson Tian [Thu, 21 Aug 2014 16:05:42 +0000 (00:05 +0800)]
http: avoid create difference hidden class

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agonet,stream: add isPaused, don't read() when paused
Chris Dickinson [Tue, 19 Aug 2014 21:38:55 +0000 (14:38 -0700)]
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>
9 years agodns: throw if hostname is not string or falsey
cjihrig [Fri, 15 Aug 2014 14:40:09 +0000 (10:40 -0400)]
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>
9 years agoNow working on 0.10.32
Timothy J Fontaine [Tue, 19 Aug 2014 22:12:30 +0000 (18:12 -0400)]
Now working on 0.10.32

9 years agoMerge branch 'v0.10.31-release' into v0.10
Timothy J Fontaine [Tue, 19 Aug 2014 22:12:21 +0000 (18:12 -0400)]
Merge branch 'v0.10.31-release' into v0.10

9 years agonode: add missing Isolate::Scope at startup
Ben Noordhuis [Tue, 19 Aug 2014 17:28:06 +0000 (10:28 -0700)]
node: add missing Isolate::Scope at startup

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agosrc: add missing Isolate arguments
Yazhong Liu [Wed, 13 Aug 2014 18:02:37 +0000 (02:02 +0800)]
src: add missing Isolate arguments

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years ago2014.08.19, Version 0.10.31 (Stable) v0.10.31
Timothy J Fontaine [Tue, 19 Aug 2014 15:19:52 +0000 (11:19 -0400)]
2014.08.19, Version 0.10.31 (Stable)

* v8: backport CVE-2013-6668

* openssl: Update to v1.0.1i

* npm: Update to v1.4.23

* cluster: disconnect should not be synchronous (Sam Roberts)

* fs: fix fs.readFileSync fd leak when get RangeError (Jackson Tian)

* stream: fix Readable.wrap objectMode falsy values (James Halliday)

* timers: fix timers with non-integer delay hanging. (Julien Gilli)

9 years agonpm: Update to v1.4.23
Timothy J Fontaine [Tue, 19 Aug 2014 15:17:36 +0000 (11:17 -0400)]
npm: Update to v1.4.23

9 years agohttp: fix bailout for writeHead
Alex Kocharin [Thu, 14 Aug 2014 14:54:44 +0000 (18:54 +0400)]
http: fix bailout for writeHead

Reported-by: Jackson Tian <shyvo1987@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agogyp: preserve v8dbg syms on freebsd too
Fedor Indutny [Mon, 18 Aug 2014 13:58:36 +0000 (17:58 +0400)]
gyp: preserve v8dbg syms on freebsd too

9 years agoRevert "gyp: preserve v8dbg syms on freebsd too"
Fedor Indutny [Mon, 18 Aug 2014 13:57:26 +0000 (17:57 +0400)]
Revert "gyp: preserve v8dbg syms on freebsd too"

This reverts commit 181b8a5d3af2e14c50dd32e1f16bf553fd3c7050.

9 years agogyp: preserve v8dbg syms on freebsd too
Fedor Indutny [Sun, 17 Aug 2014 10:19:14 +0000 (14:19 +0400)]
gyp: preserve v8dbg syms on freebsd too

9 years agogyp: preserve v8dbg syms on freebsd too
Fedor Indutny [Sun, 17 Aug 2014 10:17:30 +0000 (14:17 +0400)]
gyp: preserve v8dbg syms on freebsd too

9 years agodeps: backport 5f836c from v8 upstream
Fedor Indutny [Thu, 14 Aug 2014 15:29:28 +0000 (19:29 +0400)]
deps: backport 5f836c from v8 upstream

Original commit message:

    Fix Hydrogen bounds check elimination

    When combining bounds checks, they must all be moved before the first load/store
    that they are guarding.

    BUG=chromium:344186
    LOG=y
    R=svenpanne@chromium.org

    Review URL: https://codereview.chromium.org/172093002

    git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@19475 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

fix #8070

9 years agotest: fix dns test
Alexis Campailla [Tue, 12 Aug 2014 14:48:02 +0000 (16:48 +0200)]
test: fix dns test

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>
9 years agotests: don't assume IPv4 only in remote addr tests
Julien Gilli [Mon, 11 Aug 2014 20:29:00 +0000 (13:29 -0700)]
tests: don't assume IPv4 only in remote addr tests

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>
9 years agotest: check ipv6 support before testing it
Fedor Indutny [Sat, 2 Aug 2014 08:42:42 +0000 (12:42 +0400)]
test: check ipv6 support before testing it

fix #7983
fix #8049

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
9 years agotests: do not hardcode service name in test-dns.
Julien Gilli [Wed, 6 Aug 2014 21:32:46 +0000 (14:32 -0700)]
tests: do not hardcode service name in test-dns.

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>
9 years agotests: fix invalid hints flags dns test.
Julien Gilli [Mon, 11 Aug 2014 22:15:21 +0000 (15:15 -0700)]
tests: fix invalid hints flags dns test.

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>
9 years agoopenssl: fix keypress requirement in apps on win32
Fedor Indutny [Wed, 11 Dec 2013 17:19:04 +0000 (21:19 +0400)]
openssl: fix keypress requirement in apps on win32

Original source:

http://openssl.6102.n7.nabble.com/PATCH-s-client-Fix-keypress-requirement-with-redirected-input-on-Windows-td46787.html

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agodeps: update openssl to v1.0.1i
Fedor Indutny [Thu, 7 Aug 2014 09:36:56 +0000 (13:36 +0400)]
deps: update openssl to v1.0.1i

9 years agosrc: change kIsolateSlot to 3
Cheng Zhao [Sun, 10 Aug 2014 02:46:11 +0000 (10:46 +0800)]
src: change kIsolateSlot to 3

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>
9 years agosrc: require EventEmitter via NativeModule
Trevor Norris [Wed, 13 Aug 2014 04:50:21 +0000 (21:50 -0700)]
src: require EventEmitter via NativeModule

Fixes a recent change causing test-process-kill-pid.js to fail.

Fixes: 931cbc1 "lib: don't use emitter.listeners(type).length"
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
9 years agodgram: remove new keyword from errnoException
Jackson Tian [Wed, 13 Aug 2014 04:03:25 +0000 (12:03 +0800)]
dgram: remove new keyword from errnoException

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
9 years agodoc: typo fixes on stream, tls and http
Kyle Robinson Young [Fri, 8 Aug 2014 17:49:24 +0000 (10:49 -0700)]
doc: typo fixes on stream, tls and http

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