Commit Graph

10236 Commits (b26dd4e5ab9192bad72b9dc61fa4ad2d8f215da2)

Author SHA1 Message Date
Fedor Indutny 7343c77cdb 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.
2014-09-03 17:36:54 +04:00
Fedor Indutny 68c14d6923 crypto: use less memory for storing keys
Use `BIO_new_mem_buf` where possible to reduce memory usage and
initialization costs.
2014-09-03 17:36:32 +04:00
Fedor Indutny 627c1a92eb configure: add --openssl-no-asm flag
see #8062

Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2014-09-03 17:35:18 +04:00
Jackson Tian 4bd396a9bf net: Improve Socket.prototype.write()
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-09-03 04:43:01 -07:00
Trevor Norris a054f8eb29 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>
2014-09-03 03:36:17 -07:00
Trevor Norris 81a9739108 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>
2014-09-02 11:30:45 -07:00
Julien Gilli 8e60b4523c 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>
2014-09-02 22:22:57 +04:00
Jesús Leganés Combarro "piranna cdc01faed2 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>
2014-09-02 22:20:52 +04:00
Julien Gilli 90d1147b8b 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>
2014-09-02 22:14:04 +04:00
Brian White fcfe820481 crypto: unsigned value can't be negative
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-09-02 17:41:30 +04:00
Brian White 16b0a3393e crypto: avoid memory leak
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-09-02 17:41:21 +04:00
Jackson Tian 92419f8762 src: reading/owner/onread/onconnection for tcp
Initialize fields to avoid Hidden Class creation in runtime.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-09-02 16:20:56 +04:00
Isaac Burns 53fc14c569 crypto: wrap ECDH constants in HAVE_OPENSSL
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-09-01 19:30:13 +04:00
Shigeki Ohtsu f6877f37b2 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>
2014-08-29 00:36:51 +04:00
Shigeki Ohtsu 0dfedb7127 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>
2014-08-29 00:36:48 +04:00
Fedor Indutny 6e453fad87 crypto: introduce ECDH 2014-08-29 00:27:09 +04:00
Mathias Bynens b869797a2d 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>
2014-08-27 14:36:04 +04:00
Jackson Tian f7d6147e43 src: Add function name for .byteLength/.compare
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-08-27 14:13:31 +04:00
Tristan Berger 0f2956192c 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>
2014-08-27 13:49:16 +04:00
Fedor Indutny 6adf3ecebb crypto: allow padding in RSA methods
Reviewed-By: Trevor Norris <trevnorris@gmail.com>
2014-08-27 00:24:57 +04:00
Fedor Indutny f39e608c6e gyp: use --export-dynamic on FreeBSD
Should help addons use OpenSSL functions.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-08-27 00:20:10 +04:00
Fedor Indutny ada85d7307 deps: enable ARM assembly for OpenSSL
fix #8062
2014-08-27 00:18:55 +04:00
Fedor Indutny 8a7d7f8b2b 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>
2014-08-23 23:22:23 +04:00
Fedor Indutny 3122e0eae6 deps: fix up v8 after fd80a3
fd80a31e06 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
2014-08-22 14:19:08 +04:00
Jackson Tian c0f30f6058 http: avoid create difference hidden class
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-08-21 16:29:52 -07:00
Chris Dickinson 4ef2a5a672 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>
2014-08-20 13:58:12 -07:00
cjihrig 5086d6ef94 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>
2014-08-20 13:51:09 -07:00
Timothy J Fontaine adf2cfd54d Now working on 0.10.32 2014-08-19 18:12:30 -04:00
Timothy J Fontaine 3998914ec8 Merge branch 'v0.10.31-release' into v0.10 2014-08-19 18:12:21 -04:00
Ben Noordhuis 437c2f4383 node: add missing Isolate::Scope at startup
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-08-19 10:28:06 -07:00
Yazhong Liu 7be96f5285 src: add missing Isolate arguments
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-08-19 10:23:20 -07:00
Timothy J Fontaine 7fabdc23d8 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)
2014-08-19 11:19:52 -04:00
Timothy J Fontaine 6a11bfe74b npm: Update to v1.4.23 2014-08-19 11:17:36 -04:00
Alex Kocharin b9960eefc2 http: fix bailout for writeHead
Reported-by: Jackson Tian <shyvo1987@gmail.com>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-08-18 16:21:03 -07:00
Fedor Indutny d1dd0d6b38 gyp: preserve v8dbg syms on freebsd too 2014-08-18 17:58:36 +04:00
Fedor Indutny ffd0116eda Revert "gyp: preserve v8dbg syms on freebsd too"
This reverts commit 181b8a5d3a.
2014-08-18 17:57:26 +04:00
Fedor Indutny 181b8a5d3a gyp: preserve v8dbg syms on freebsd too 2014-08-17 14:19:14 +04:00
Fedor Indutny 9134a3bf41 gyp: preserve v8dbg syms on freebsd too 2014-08-17 14:17:30 +04:00
Fedor Indutny fd80a31e06 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
2014-08-14 19:29:28 +04:00
Alexis Campailla 0d357fa135 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>
2014-08-13 11:44:20 -07:00
Julien Gilli 0565d52a71 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>
2014-08-13 11:44:15 -07:00
Fedor Indutny c7b42fe2e5 test: check ipv6 support before testing it
fix #7983
fix #8049

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
2014-08-13 11:43:58 -07:00
Julien Gilli f5f5bd76e6 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>
2014-08-13 11:43:41 -07:00
Julien Gilli 7d1860a678 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>
2014-08-13 11:43:09 -07:00
Fedor Indutny 6b97c2e986 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>
2014-08-13 09:26:53 -07:00
Fedor Indutny 5d824c89c9 deps: update openssl to v1.0.1i 2014-08-13 09:26:42 -07:00
Cheng Zhao 44743eaf24 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>
2014-08-13 13:58:51 +04:00
Trevor Norris 807acf7f98 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>
2014-08-12 21:50:21 -07:00
Jackson Tian a8845ebd45 dgram: remove new keyword from errnoException
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-08-12 21:43:20 -07:00
Kyle Robinson Young 00004160a1 doc: typo fixes on stream, tls and http
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-08-12 21:04:41 -07:00