Commit Graph

3378 Commits

Author SHA1 Message Date
Fedor Indutny
cb4ed3c78f 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
2014-09-18 02:31:47 +04:00
Mickael van der Beek
c615545416 crypto: clarify RandomBytes() error msg
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-09-17 14:40:01 -07:00
Alexis Campailla
03e93526e6 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>
2014-09-17 14:26:35 -07:00
Ben Noordhuis
21e60643b0 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>
2014-09-16 12:28:47 -07:00
Adam Lippai
11d57a535c 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
2014-09-15 17:42:20 +04:00
Ben Noordhuis
06526a2a93 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>
2014-09-05 09:54:10 -07:00
Ben Noordhuis
8e6706ea95 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>
2014-09-05 09:34:27 -07:00
Ben Noordhuis
b33a47ef47 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>
2014-09-05 09:34:15 -07:00
Ben Noordhuis
1e99486cc8 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>
2014-09-05 09:33:58 -07:00
Ben Noordhuis
de9a444ab4 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>
2014-09-05 09:33:49 -07:00
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
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
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
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
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
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
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
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
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
931cbc175f lib: don't use emitter.listeners(type).length
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-08-12 15:57:13 -07:00
Trevor Norris
0718426506 node: set names for prototype methods
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>
2014-08-11 17:10:43 -07:00
seishun
42bda05af8 crypto: add RSA encryption
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-08-11 22:00:34 +04:00
Alexis Campailla
93f3b640d0 windows: fix memory leak in WinapiErrnoException
Fix https://github.com/joyent/node/issues/2341

Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-08-11 18:19:55 +04:00
Saúl Ibarra Corretgé
28eee0adb7 src: handle UV_EAGAIN in TryWrite
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-08-07 15:05:04 +04:00
Trevor Norris
e643fe4c4b dns: fix GetAddrInfo assert
The method GetAddrInfo() is used by more than just dns.lookup(), and in
those cases a third argument isn't passed. This caused the following
check to abort:

  assert(args[3]->IsInt32());

Fixes: 4306786 "net: don't prefer IPv4 addresses during resolution"

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-08-04 18:19:45 -07:00
cjihrig
430678640c net: don't prefer IPv4 addresses during resolution
Currently the address resolution family defaults to IPv4. Instead remove
the preference and instead resolve to a family suitable for the host.

Expose the getaddrinfo flags and allow them to be passed.

Add documentation about new flags.

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-08-04 16:57:18 -07:00
Jackson Tian
962e651476 process: improve process binding
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-08-02 20:14:46 +04:00
Fedor Indutny
f310c0f16b Merge remote-tracking branch 'origin/v0.10' into master
Conflicts:
	doc/api/buffer.markdown
	lib/_stream_readable.js
	lib/assert.js
	lib/buffer.js
	lib/child_process.js
	lib/http.js
	lib/string_decoder.js
	lib/zlib.js
	node.gyp
	test/simple/test-buffer.js
	test/simple/test-https-foafssl.js
	test/simple/test-stream2-compatibility.js
	test/simple/test-tls-server-verify.js
2014-07-29 12:51:27 +04:00
Sam Roberts
832ec1cd50 process: throw TypeError if kill pid not a number
Currently, invalid usage such as:

    process.kill('SIGTERM')
    process.kill(null)
    process.kill(undefined);

all coerce the pid to 0, and signal the current process.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-28 18:30:26 +04:00
Shigeki Ohtsu
2bb4867312 tls: fix to send TLS Alert before socket destroyed
When TLS Alert is occured in handshake, ClearOut only write it into
wbio and does not flush to socket. TLS Alert should be written to
socket with EncOut before socket is destroyed within its error
callback.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-23 23:43:58 +04:00
Dean McNamee
ba09409479 src: export additional startup functions
This allows embedders enough control to initialize node, run the
event loop, and cleanly exit (including calling handlers).

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-23 22:47:05 +04:00
Dean McNamee
da30c0084a src: pass the v8::Context to CreateEnvironment
Pass in the v8::Context, instead of creating it
within CreateEnvironment.  This allows callers
to use a pre-existing context.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-13 23:07:46 +04:00
cjihrig
c4e5fde362 child_process: copy spawnSync() cwd option to proper buffer
The spawnSync() cwd option was being copied to the incorrect
location. This commit copies to the correct location.

Closes #7824

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-12 12:46:16 +03:00
Fedor Indutny
832d4db5f2 contextify: remove useless header file
fix #7910
2014-07-08 21:43:48 +03:00
Andrius Bentkus
a382c9a97c udp: make it possible to receive empty udp packets
A udp packet can have 0 content. In that case nread will be equal to 0,
but addr != NULL.

Add test case for empty data gram packets and fixed test that checked
for OOB when length == 0.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-07-02 20:59:27 -07:00
Fedor Indutny
9cbfd6ef51 constants: add O_NONBLOCK constant
It appears that it is defined unconditionally on all supported unixes.

fix #7867 #7855

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-07-02 12:49:59 -07:00
Fedor Indutny
7cb38309fe Revert "constants: export O_NONBLOCK"
This reverts commit 00890e43fb.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-07-02 12:49:59 -07:00
Fedor Indutny
47ee9a48a8 Revert "src: fix _XOPEN_SOURCE redefinition warning"
This reverts commit 885142a5ed.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-07-02 12:49:59 -07:00
Yazhong Liu
6b09f9cd41 node: fix #7841 by overlooking the spare sourceline
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-27 16:09:52 +04:00
Oguz Bastemur
c94afdccf3 util.h: interface compatibility
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-27 14:22:01 +04:00
Saúl Ibarra Corretgé
35b9580cd8
dns: introduce lookupService function
Uses getnameinfo to resolve an address an port into a hostname and
service.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-27 04:02:19 +04:00
Fedor Indutny
c047127410 contextify: throw timeout error properly
fix #7509
2014-06-12 18:30:41 -07:00
Fedor Indutny
d5198768de watchdog: terminate one specific isolate 2014-06-12 18:30:26 -07:00
Fedor Indutny
eef0715db5 tls_wrap: fix interleaving in InvokeQueued
WriteItem callback may add new item to the `pending_write_items`. Ensure
that this item won't be called in the same `InvokeQueued` call, as it
may result in way-to-early `finish` event on js-side.

fix #7733

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-11 16:10:11 -07:00
Fedor Indutny
ca55037380 tls_wrap: fix small obvious memory leak
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-11 16:05:38 -07:00
Timothy J Fontaine
1a09da6ec2 Merge remote-tracking branch 'upstream/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	deps/v8/src/api.cc
	deps/v8/src/unicode-inl.h
	deps/v8/src/unicode.h
	lib/_stream_readable.js
	lib/http.js
	src/cares_wrap.cc
	src/node.cc
	src/node_crypto.cc
	src/node_dtrace.cc
	src/node_file.cc
	src/node_stat_watcher.cc
	src/node_version.h
	src/process_wrap.cc
	src/string_bytes.cc
	src/string_bytes.h
	src/udp_wrap.cc
	src/util.h
	test/simple/test-buffer.js
	test/simple/test-stream2-compatibility.js
2014-06-10 19:36:04 -04:00
Timothy J Fontaine
1cb6f1a46a Now working on 0.10.30 2014-06-09 10:52:27 -07:00
Timothy J Fontaine
ce82d6b847 2014.06.05, Version 0.10.29 (Stable)
* openssl: to 1.0.1h (CVE-2014-0224)

* npm: upgrade to 1.4.10

* utf8: Prevent Node from sending invalid UTF-8 (Felix Geisendörfer)
  - *NOTE* this introduces a breaking change, previously you could construct
invalid UTF-8 and invoke an error in a client that was expecting valid
UTF-8, now unmatched surrogate pairs are replaced with the unknown UTF-8
character. To restore the old functionality simply have NODE_INVALID_UTF8
environment variable set.

* child_process: do not set args before throwing (Greg Sabia Tucker)

* child_process: spawn() does not throw TypeError (Greg Sabia Tucker)

* constants: export O_NONBLOCK (Fedor Indutny)

* crypto: improve memory usage (Alexis Campailla)

* fs: close file if fstat() fails in readFile() (cjihrig)

* lib: name EventEmitter prototype methods (Ben Noordhuis)

* tls: fix performance issue (Alexis Campailla)
2014-06-09 10:04:36 -07:00
Timothy J Fontaine
535c7777ac src: replace usage of String::Utf8Value
v8::String::Utf8Value previously could allow invalid surrogates when
interpreting values.
2014-06-06 15:07:29 -07:00
Felix Geisendörfer
0da4c67165 string_bytes: Guarantee valid utf-8 output
Previously v8's WriteUtf8 function would produce invalid utf-8 output
when encountering unmatched surrogate code units [1]. The new
REPLACE_INVALID_UTF8 option fixes that by replacing invalid code points
with the unicode replacement character.

[1]: JS Strings are defined as arrays of 16 bit unsigned integers. There
is no unicode enforcement, so one can easily end up with invalid unicode
code unit sequences inside a string.
2014-06-06 15:07:29 -07:00
Fedor Indutny
9920ae67b5 Merge branch 'v0.10'
Conflicts:
	ChangeLog
	lib/events.js
	lib/tls.js
	src/node_constants.cc
	src/node_crypto.cc
	src/node_crypto.h
	src/node_version.h
2014-06-05 07:28:39 -07:00
Ben Noordhuis
820aaf5b3d src: replace CONTAINER_OF with type-safe function
Replace the CONTAINER_OF macro with a template function that is as
type-safe as a reinterpret_cast<> of an arbitrary pointer can be made.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-05-30 11:45:37 +01:00
Ben Noordhuis
4394c8a9b3 smalloc: rework double free bug fix
Rework the fix from commit 6810132 in a way that removes ~60 lines of
code.

The bug was introduced in commit e87ceb2 (mea culpa) and is at its core
a pointer aliasing bug where sometimes two independent pointers existed
that pointed to the same chunk of heap memory.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-05-23 15:21:35 -07:00
Ben Noordhuis
6f952845a6 src: kill isolate on exit
Otherwise it's not possible to check from inside a destructor if V8 is
still alive with v8::V8::IsDead().  In V8 3.25, that function returns
true until the last isolate is destroyed.

This used to work in v0.10 and is a standard trick to dispose persistent
handles conditionally.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-05-23 23:10:23 +04:00
Trevor Norris
681013223f smalloc: prevent double free on dispose()
dispose() free's the memory when executed and sets the external array
data to NULL and length to zero.

To prevent the same memory from being free'd twice when the object is
garbage collected we first check if the object's external array data
length == 0. Since alloc() passes NULL to
SetIndexedPropertiesToExternalArrayData() if length == 0 there's no
opportunity for memory leak.
2014-05-23 03:42:46 -07:00
Rohini Harendra
32b4563280 src: NODE_UNIXTIME_V8 needs to use an Isolate
Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
2014-05-22 16:04:27 -07:00
Fedor Indutny
01c2a670a1 contexify: fix infinite recursion in delete cb
Do not ever call `Delete()` on `proxy_global_`, it will invoke
`GlobalPropertyDeleteCallback` and cause crash because of the infinite
recursion.

fix #7529
2014-05-21 17:02:12 -07:00
Andrew Low
929e2ed5ba string_bytes: ucs2 support big endian
64bit constants are keyed for x64 platforms only, add PowerPC based
platform constants.

Node's "ucs2" encoding wants LE character data stored in the Buffer, so
we need to reorder on BE platforms.  See
http://nodejs.org/api/buffer.html regarding Node's "ucs2" encoding
specification

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
2014-05-21 13:16:00 -07:00
Fedor Indutny
765b03255c tls_wrap: do not store TLSCallbacks in SSL_CTX
Storing it in SSL_CTX is incorrect as it may go away and get destructed
earlier, also it'll yield invalid results in SelectSNIContextCallback.

Use `SSL_get_app_data()` instead.

fix #7484

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
2014-05-21 13:14:31 -07:00
Fedor Indutny
4a2c349473 crypto: fix version check in hello parser
This is a follow up for 89cb740fc3
2014-05-16 12:48:58 +04:00
Yazhong Liu
89cb740fc3 crypto: check protocol version at handshake header
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-05-16 12:25:03 +04:00
Alexis Campailla
c06495713a crypto: improve memory usage
ClientHelloParser used to contain an 18k buffer that was kept around
for the life of the connection, even though it was not needed in many
situations. I changed it to be deallocated when it's determined to
be no longer needed.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-05-16 01:33:08 +04:00
Ben Noordhuis
885142a5ed src: fix _XOPEN_SOURCE redefinition warning
Fix the following compiler warning on systems where _XOPEN_SOURCE is
defined by default:

    ../src/node_constants.cc:35:0: warning: "_XOPEN_SOURCE" redefined
     #define _XOPEN_SOURCE 500

Move the (re)definition of _XOPEN_SOURCE to the top of the file while
we're here.  Commit 00890e4 adds a `#define _XOPEN_SOURCE 500` in order
to make <fcntl.h> expose O_NONBLOCK but it does so after other system
headers have been included.  If those headers include <fcntl.h>, then
the #include in node_constants.cc will be a no-op and O_NONBLOCK won't
be visible.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-05-14 15:33:18 +04:00
Fedor Indutny
6569812531 tls_wrap: remove unused variable 2014-05-13 13:13:23 +04:00
Trevor Norris
b1a44dfe9e buffer: remove Buffer#toArrayBuffer()
A recent change to v8's API now makes it impossible to memcpy to a
v8::ArrayBuffer without causing it to be externalized. This means that
the garbage collector will not automatically free the memory when the
object is collected.

When/If the necessary API is included to allow the above
Buffer#toArrayBuffer() will be reintroduced.

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
2014-05-12 16:58:30 -07:00
Trevor Norris
53b2e02a46 node: remove duplicate tickInfo assignment
When process._setupNextTick() was introduced as the means to properly
initialize the mechanism behind process.nextTick() a chunk of code was
left behind that assigned memory to process._tickInfo. This code is no
longer needed.
2014-05-12 13:52:33 -07:00
Refael Ackermann
9b7888ef88 src: fix StringBytes::Write if string is external
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-05-12 14:59:16 +04:00
Trevor Norris
f10fd1ddba src: add --throw-deprecation entry to --help 2014-05-07 14:47:57 -07:00
Fedor Indutny
00890e43fb constants: export O_NONBLOCK
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-05-02 22:54:08 +04:00
Fedor Indutny
8398bf9128 debugger: assign Environment to DebugContext too
fix #7517
2014-05-02 22:12:54 +04:00
Timothy J Fontaine
a6583ebd11 Now working on 0.11.14 2014-05-02 07:53:42 -07:00
Timothy J Fontaine
bfe1fdb8ab Now working on 0.10.29 2014-05-02 07:46:15 -07:00
Timothy J Fontaine
b148cbe09d 2014.05.01, Version 0.10.28 (Stable)
* npm: upgrade to v1.4.9
2014-05-01 17:47:47 -07:00
Timothy J Fontaine
89223ae860 2014.05.01, Version 0.11.13 (Unstable)
* v8: upgrade to 3.24.35.22

* buffer: add compare and equals methods (Sean McArthur)

* buffer: improve {read,write}{U}Int* methods (Nick Apperson)

* buffer: return uint if MSB is 1 in readUInt32 (goussardg)

* buffer: truncate buffer after string decode (Fedor Indutny)

* child_process: fix assertion error in spawnSync (Shigeki Ohtsu)

* crypto: fix memory leak in CipherBase::Final (Fedor Indutny)

* crypto: improve error messages (Ingmar Runge)

* crypto: move `createCredentials` to tls (Fedor Indutny)

* crypto: work around OpenSSL oddness (Fedor Indutny)

* dgram: introduce `reuseAddr` option (Fedor Indutny)

* domain: don't crash on "throw null" (Alex Kocharin)

* events: check if _events is an own property (Vladimir Kurchatkin)

* fs: improve performance of all stat functions (James Pickard)

* fs: return blksize on stats object (Trevor Norris)

* http: add request.flush() method (Ben Noordhuis)

* http: better client "protocol not supported" error (Nathan Rajlich)

* http: use defaultAgent.protocol in protocol check (Nathan Rajlich)

* main: Handle SIGINT properly. (Geir Hauge)

* net: bind to `::` TCP address by default (Fedor Indutny)

* readline: consider newlines for cursor position (Yazhong Liu)

* stream: split `objectMode` for Duplex (Vladimir Kurchatkin)

* tls: `getPeerCertificate(detailed)` (Fedor Indutny)

* tls: do not call SNICallback unless present (Fedor Indutny)

* tls: force readable/writable to `true` (Fedor Indutny)

* tls: support OCSP on client and server (Fedor Indutny)

* util: made util.isArray a direct alias for Array.isArray (Evan Carroll)
2014-05-01 16:06:44 -07:00
Timothy J Fontaine
1285008fca Now working on 0.10.28 2014-05-01 15:30:07 -07:00
Timothy J Fontaine
cb7911f78a 2014.05.01, Version 0.10.27 (Stable)
* npm: upgrade to v1.4.8

* openssl: upgrade to 1.0.1g

* uv: update to v0.10.27

* dns: fix certain txt entries (Fedor Indutny)

* assert: Ensure reflexivity of deepEqual (Mike Pennisi)

* child_process: fix deadlock when sending handles (Fedor Indutny)

* child_process: fix sending handle twice (Fedor Indutny)

* crypto: do not lowercase cipher/hash names (Fedor Indutny)

* dtrace: workaround linker bug on FreeBSD (Fedor Indutny)

* http: do not emit EOF non-readable socket (Fedor Indutny)

* http: invoke createConnection when no agent (Nathan Rajlich)

* stream: remove useless check (Brian White)

* timer: don't reschedule timer bucket in a domain (Greg Brail)

* url: treat  the same as / (isaacs)

* util: format as Error if instanceof Error (Rod Vagg)
2014-05-01 14:04:20 -07:00
Timothy J Fontaine
b19b60a05c Merge remote-tracking branch 'upstream/v0.10'
Reverted 9520adeb37

Conflicts:
	deps/cares/src/ares_parse_txt_reply.c
	deps/uv/.mailmap
	deps/uv/AUTHORS
	deps/uv/ChangeLog
	deps/uv/include/uv.h
	deps/uv/src/unix/error.c
	deps/uv/src/unix/process.c
	deps/uv/src/version.c
	deps/uv/src/win/pipe.c
	deps/uv/src/win/signal.c
	deps/uv/src/win/util.c
	deps/uv/test/test-spawn.c
	deps/uv/vcbuild.bat
	deps/v8/src/platform-posix.cc
	deps/v8/tools/gyp/v8.gyp
	lib/util.js
	src/node.cc
	test/simple/test-util-format.js
	test/simple/test-util.js
2014-05-01 13:54:23 -07:00
Trevor Norris
d1fe6857ba buffer: normalize compare() output
Because of differences in memcmp() implementation, normalize output to
return -1, 0 or 1 only.

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
2014-05-01 09:40:54 -07:00
Shigeki Ohtsu
ab7a3d098d child_process: fix assertion error in spawnSync
When ExitCallback was not called with an error such as ENOENT in
uv_spawn, the process handle still remains refed and needs to be closed.

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
2014-04-30 09:02:18 -07:00
Ingmar Runge
26a1b712ec crypto: improve error messages
1) ThrowCryptoTypeErrors was not actually used for
   type-related errors. Removed it.
2) For AEAD modes, OpenSSL does not set any internal
   error information if Final does not complete suc-
   cessfully. Therefore, "TypeError:error:00000000:l
   ib(0):func(0):reason(0)" would be the error mess-
   age. Use a default message for these cases.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-29 14:20:14 +04:00
Rasmus Christian Pedersen
d13e0297c3 crypto: fix a couple of VC++ warnings
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-29 14:13:28 +04:00
Sean McArthur
226f98a356 buffer: add compare and equals methods
compare() works like String.localeCompare such that:

    Buffer.compare(a, b) === a.compare(b);

equals() does a native check to see if two buffers are equal.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-04-28 22:09:48 -07:00
Denys Zariaiev
681fe599d7 vm: assign Environment to created context
ContextifyContext::CreateV8Context is now create context
with Environment pointer

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-26 00:34:55 +04:00
Fedor Indutny
a60a9b0dbd deps: provide TXT chunk info in c-ares
Provide more information in `ares_txt_reply` to coalesce chunks from the
same record into one string.

fix #7367
2014-04-24 10:40:35 +04:00
Fedor Indutny
89e88e96df crypto: fix memory leak in CipherBase::Final
fix #7497

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-23 14:13:43 +04:00
Fedor Indutny
0f3b72460b crypto: work around OpenSSL oddness
OpenSSL behaves oddly: on client `cert_chain` contains
the `peer_certificate`, but on server it doesn't.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-22 16:19:57 +04:00
Fedor Indutny
afaff70a9b src: lint after OCSP commits 2014-04-18 02:24:48 +04:00
Fedor Indutny
345c40b661 tls: getPeerCertificate(detailed)
Add `raw` property to certificate, add mode to output full certificate
chain.
2014-04-18 02:21:16 +04:00
Fedor Indutny
b3ef289ffb tls: support OCSP on client and server 2014-04-18 02:21:16 +04:00
Trevor Norris
c7f424e44b fs: return blksize on stats object
Oversight to not pass blksize to fs.Stats on initialization.

Also added a test to make sure the object property has been set. Since
now on Windows both blksize and blocks will simply be set to undefined.
2014-04-14 16:35:33 -07:00
Geir Hauge
c61b0e9cbc
main: Handle SIGINT properly.
As explained by http://www.cons.org/cracauer/sigint.html

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-12 12:40:31 +04:00
Fedor Indutny
4c36f3e7e6 buffer: truncate buffer after string decode
When our estimates for a storage size are higher than the actual length
of decoded data, the destination buffer should be truncated. Otherwise
`Buffer::Length` will give misleading information to C++ layer.

fix #7365

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-11 01:20:43 +04:00
Timothy J Fontaine
632c135622 src: use monotonic time for process.uptime()
`process.uptime()` interface will return the amount of time the
current process has been running. To achieve this it was caching the
`uv_uptime` value at program start, and then on the call to
`process.uptime()` returning the delta between the two values.

`uv_uptime` is defined as the number of seconds the operating system
has been up since last boot. On sunos this interface uses `kstat`s
which can be a significantly expensive operation as it requires
exclusive access, but because of the design of `process.uptime()` node
*had* to always call this on start. As a result if you had many node
processes all starting at the same time you would suffer lock
contention as they all tried to read kstats.

Instead of using `uv_uptime` to achieve this, the libuv loop already
has a concept of current loop time in the form of `uv_now()` which is
in fact monotonically increasing, and already stored directly on the
loop. By using this value at start every platform performs at least
one fewer syscall during initialization.

Since the interface to `uv_uptime` is defined as seconds, in the call
to `process.uptime()` we now `uv_update_time` get our delta, divide by
1000 to get seconds, and then convert to an `Integer`. In 0.12 we can
move back to `Number::New` instead and not lose precision.

Caveat: For some platforms `uv_uptime` reports time monotonically
increasing regardless of system hibernation, `uv_now` interface is
also monotonically increasing but may not reflect time spent in
hibernation.
2014-04-10 10:55:02 -07:00
Fedor Indutny
592be014b6
dgram: introduce reuseAddr option
Introduce new signature for both `dgram.createSocket` method and
`dgram.Socket` constructor:

    dgram.createSocket(options, [listener])

Options should contain `type` property and may contain `reuseAddr`
property. When `reuseAddr` is `true` - SO_REUSEADDR will be issued on
socket on bind.

fix #7415

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-10 19:39:49 +04:00
Saúl Ibarra Corretgé
a0a180a0ad src: fix use of uv_cwd, len includes the NULL byte 2014-04-07 16:37:29 +04:00
Saúl Ibarra Corretgé
42b9343710 src: update uv callbacks after API changes
async, timer, prepare, idle and check handles no longer get a status
parameter since they can never fail.
2014-04-07 16:37:20 +04:00
C. Scott Ananian
08a5b442e4 node: add signature to SET_PROTOTYPE_METHOD
This prevents segfaults when a native method is reassigned to a
different object (which corrupts args.This()).  When unwrapping,
clients should use args.Holder() instead of args.This().

Closes #6690.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-04-02 01:48:34 -07:00
Ben Noordhuis
c7214fe355 src: fix up after v8 upgrade
The two biggest changes are that v8::Script::New() has been removed and
that a v8::Script object now has to be explicitly bound to a context if
you want to run it from another context.

We can accommodate both changes without breaking the vm module's public
API or even the internal JS API.
2014-04-02 00:05:25 +04:00
Ben Noordhuis
490d5ab780 configure: make --v8-options switch more robust
Improve on commit b55c9d6 by not requiring that switches are comma
separated.  This commit makes `./configure --v8-options="--foo --bar"`
work and takes special care to properly escape quotes in the options
string.
2014-04-01 18:55:52 +04:00
James Pickard
e9ce8fc82a fs: improve performance of all stat functions
By building the fs.Stats object in JS, which is returned by all fs stat
functions, calls to v8::Object::Set() are removed. This also includes
creating all associated Date objects in JS, rather than using
v8::Date::New(). Both these changes have significant performance gains.

Note that the returned value from fs.stat changes slightly for non-POSIX
systems. Whereas before the stats object would be missing blocks and
blksize keys, it now has these keys with undefined as the value.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-03-31 15:02:17 -07:00
Fedor Indutny
5d2aef17ee
crypto: move createCredentials to tls
Move `createCredentials` to `tls` module and rename it to
`createSecureContext`. Make it use default values from `tls` module:
`DEFAULT_CIPHERS` and `DEFAULT_ECDH_CURVE`.

fix #7249
2014-03-29 12:01:43 +04:00
Fedor Indutny
b55c9d68aa configure: --v8-options option
Introduce a way to set some v8 flags at compile time, the values should
be separated by comma.
2014-03-29 11:51:41 +04:00
Fedor Indutny
e781832ea1 crypto: fix lint 2014-03-26 11:52:00 +04:00
Fedor Indutny
a030c7b902 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	src/node.cc
	src/node_crypto.cc
	src/node_crypto.h
2014-03-26 11:42:57 +04:00
Ben Noordhuis
f68a116c3c src: ensure that openssl's PRNG is fully seeded
Ensure that OpenSSL has enough entropy (at least 256 bits) for its PRNG.

The entropy pool starts out empty and needs to fill up before the PRNG
can be used securely.

OpenSSL normally fills the pool automatically but not when someone
starts generating random numbers before the pool is full: in that case
OpenSSL keeps lowering the entropy estimate to thwart attackers trying
to guess the initial state of the PRNG.

When that happens, we wait until enough entropy is available, something
that normally should never take longer than a few milliseconds.

Fixes #7338.
2014-03-26 11:31:32 +04:00
Ben Noordhuis
70f198ddb1 src: seed V8's random number generator at startup
The default entropy source is /dev/urandom on UNIX platforms, which is
okay but we can do better by seeding it from OpenSSL's entropy pool.

On Windows we can certainly do better; on that platform, V8 seeds the
random number generator using only the current system time.

Fixes #6250.

NB: This is a back-port of commit 7ac2391 from the master branch that
for some reason never got back-ported to the v0.10 branch.

The default on UNIX platforms in v0.10 is different and arguably worse
than it is with master: if no entropy source is provided, V8 3.14 calls
srandom() with a xor of the PID and the current time in microseconds.

That means that on systems with a coarse system clock, the initial
state of the PRNG may be easily guessable.

The situation on Windows is even more dire because there the PRNG is
seeded with only the current time... in milliseconds.
2014-03-26 11:31:32 +04:00
Fedor Indutny
b76a1ff940 vm: share security token between contexts
By default, each `v8::Context` has a different Security Token, which
prevents access to one context from another.

fix #7140
2014-03-21 16:16:58 +04:00
Trevor Norris
b84ebfe886 pipe_wrap: use Instantiate() method
Retrieve a new client object via PipeWrap::Instantiate(). This method
performs appropriate checks to make sure everything is as it should be.
2014-03-17 14:39:37 -07:00
Fedor Indutny
7b9771f569 headers: remove env.h from node_internals.h
`env.h` is an internal header file and should not be copied or exposed
to the users.

Additionally, export convenience `Throw*` methods with `v8::Isolate*` as
a first argument.
2014-03-18 01:16:45 +04:00
Ben Noordhuis
23dfa71dd5 src: fix tracing infrastructure after v8 upgrade
Fix up the dtrace/etw/systemtap infrastructure after the V8 upgrade in
commit 1c7bf24.  The win32 changes are untested but can hardly make
things worse because node doesn't build on windows right now.

Fixes #7313 with some luck.
2014-03-16 16:15:34 +04:00
Ben Noordhuis
c30cc4e3a5 src: don't call DecodeWrite() on Buffers
Don't call DecodeWrite() with a Buffer as its argument because it in
turn calls StringBytes::Write() and that method expects a Local<String>.

"Why then does that function take a Local<Value>?" I hear you ask.
Good question but I don't have the answer.  I added a CHECK for good
measure and what do you know, all of a sudden a large number of crypto
tests started failing.

Calling DecodeWrite(BINARY) on a buffer is nonsensical anyway: if you
want the contents of the buffer, just copy out the data, there is no
need to decode it - and that's exactly what this commit does.

Fixes a great many instances of the following run-time error in debug
builds:

    FATAL ERROR: v8::String::Cast() Could not convert to string
2014-03-16 16:15:34 +04:00
Ben Noordhuis
e87ceb2b42 src: fix up smalloc weak persistent usage
Fix a regression that was introduced in commit ce04c726 after the
upgrade to V8 3.24.

The new weak persistent handle API no longer gives you the original
persistent but still requires that you clear it inside your weak
callback.

Rearrange the code in src/smalloc.cc to keep track of the persistent
handle with the least amount of pain and try hard to share as much
code as possible between the 'just free it' and 'invoke my callback'
versions of the smalloc API.

Fixes #7309.
2014-03-16 16:15:34 +04:00
Ben Noordhuis
ad15d75750 src: add CHECK_{GE,GT,LE,LT} macros
Conform to the Google styleguide more and make cpplint happy, add more
CHECK macros.

Preemptively addresses cpplint's readability/check warnings ("Consider
using CHECK_GT instead of CHECK(a > b)".)
2014-03-16 16:15:34 +04:00
Ben Noordhuis
8eb76075cf src: deduplicate CHECK_EQ/CHECK_NE macros
DRY the macros, there is no need to define them twice depending on
whether NDEBUG is defined or not.
2014-03-16 16:15:33 +04:00
Ben Noordhuis
f6ea0c203a src: fix segfaults, fix 32 bits integer negation
Make calls to v8::Isolate::AdjustAmountOfExternalAllocatedMemory() take
special care when negating 32 bits unsigned types like size_t.

Before this commit, values were negated before they got promoted to
64 bits, meaning that on 32 bits architectures, a value like 42 got
cast to 4294967254 instead of -42.

That in turn made the garbage collector start scavenging like crazy
because it thought the system was out of memory.

That's bad enough but calls to AdjustAmountOfExternalAllocatedMemory()
were made from weak callbacks, i.e. at a time when the garbage collector
was already busy.  It triggered asserts in debug builds and caused
random crashes and memory corruption in release builds.

The behavior in release builds is arguably a V8 bug and should perhaps
be reported upstream.

Partially fixes #7309 but requires further bug fixes to src/smalloc.cc
that I'll address in a follow-up commit.
2014-03-16 16:15:33 +04:00
Ben Noordhuis
a3dca9a3a6 src: squelch -Wmaybe-uninitialized warning
The variable isn't actually used uninitialized but g++ 4.8 doesn't know
that.  Set it to NULL to silence the following compiler warning:

    ../src/string_bytes.cc:247:29: warning: 'data' may be used
    uninitialized in this function [-Wmaybe-uninitialized]
         unsigned a = hex2bin(src[i * 2 + 0]);
                                  ^
    ../src/string_bytes.cc:299:15: note: 'data' was declared here
       const char* data;
                   ^
2014-03-16 16:15:33 +04:00
Ben Noordhuis
91b4a561df src: remove unused ExternString constructor
Remove an unused (and unsafe) constructor.  Unsafe because it doesn't
initialize the data_ field.
2014-03-16 16:15:33 +04:00
Ben Noordhuis
1f17f88071 src, test: fix up ObjectWrap, make test-addons
V8 was upgraded from 3.22 to 3.24 in commit 1c7bf24.  Upgrade source
files in test/addons/ and automatically generated tests from
doc/api/addons.markdown to the new V8 API.

This coincidentally fixes a bug in src/node_object_wrap.h where it was
still using the old V8 weak persistent handle interface, which is gone
in 3.24.
2014-03-14 00:41:04 +04:00
Fedor Indutny
d0ff900a65 node: fix exported signatures of MakeCallback
fix #7302
2014-03-13 21:14:54 +04:00
Fedor Indutny
ce04c726a3 src: update to v8 3.24 APIs 2014-03-13 20:56:55 +04:00
Timothy J Fontaine
9bd934cb96 Now working on 0.11.13 2014-03-12 07:56:42 -07:00
Timothy J Fontaine
7d6b8db40f src: accommodate uv_cwd including null on win32 2014-03-11 14:49:48 -07:00
Timothy J Fontaine
0c2e28d68f 2014.03.11, Version 0.11.12 (Unstable)
* uv: Upgrade to v0.11.22 (Timothy J Fontaine)

* buffer: allow toString to accept Infinity for end (Brian White)

* child_process: add spawnSync/execSync (Bert Belder, Timothy J Fontaine)

* cluster: handle bind errors on Windows (Alexis Campailla)

* contextify: handle infinite recursion errors (Fedor Indutny)

* crypto: allow custom generator for DiffieHellman (Brian White)

* crypto: allow setting add'l authenticated data (Brian White)

* crypto: fix CipherFinal return value check (Brian White)

* crypto: make NewSessionDoneCb public (Fedor Indutny)

* dgram: pass the bytes sent to the send callback (Timothy J Fontaine)

* dns: validate arguments in resolver (Kenan Sulayman)

* dns: verify argument is valid function in resolve (Kenan Sulayman)

* http: avoid duplicate keys in writeHead (David Björklund)

* net: add localPort to connect options (Timothy J Fontaine)

* node: do not print SyntaxError hints to stderr (Fedor Indutny)

* node: invoke `beforeExit` again if loop was active (Fedor Indutny)

* node: make AsyncListenerInst field more explicit (Trevor Norris)

* os: networkInterfaces include scopeid for ipv6 (Xidorn Quan)

* process: allow changing `exitCode` in `on('exit')` (Fedor Indutny)

* readline: fix `line` event, if input emit 'end' (Yazhong Liu)

* src: add tracing.v8.on('gc') statistics hooks (Ben Noordhuis)

* src: add v8.getHeapStatistics() function (Ben Noordhuis)

* src: emit 'beforeExit' event on process object (Ben Noordhuis)

* src: move AsyncListener from process to tracing (Trevor Norris)

* tls: fix crash in SNICallback (Fedor Indutny)

* tls: introduce asynchronous `newSession` (Fedor Indutny)

* util: show meaningful values for boxed primitives (Nathan Rajlich)

* vm: don't copy Proxy object from parent context (Ben Noordhuis)

* windows: make stdout/sterr pipes blocking (Alexis Campailla)

* zlib: add sync versions for convenience methods (Nikolai Vavilov)
2014-03-11 13:49:52 -07:00
Timothy J Fontaine
e2fcfea46e src: update from uv_read2_start removal
Previously if you wanted to be notified of pending handles for pipes
you needed to use uv_read2_start, however in v0.11.22 you can query for
pending handles independently.
2014-03-10 17:51:47 -07:00
Saúl Ibarra Corretgé
d2f2a32b89 src: adapt to API change in uv_cwd 2014-03-10 17:01:47 -07:00
Timothy J Fontaine
b444392a98 Merge remote-tracking branch 'upstream/v0.10'
Conflicts:
	src/node.cc
	src/node.js
	test/message/max_tick_depth_trace.out
2014-03-10 16:50:00 -07:00
Ben Noordhuis
bd8a5755dc src: add default visibility to NODE_MODULE
It's currently not really possible to compile native add-ons with
-fvisibility=hidden because that also hides the struct containing
the module definition.

The NODE_MODULE() and NODE_MODULE_DECL() macros are structured in
a way that makes it impossible to add a visibility attribute manually
so there is no escape hatch there.

That's why this commit adds an explicit visibility attribute to
the module definition.  It doesn't help with node.js releases that
are already out there but at least it improves the situation going
forward.
2014-03-05 15:26:09 +04:00
Brian White
31ce34887f crypto: allow setting add'l authenticated data 2014-03-04 12:42:03 +04:00
Brian White
caca4f33aa crypto: fix CipherFinal return value check 2014-03-04 12:42:03 +04:00
Timothy J Fontaine
06453a94a7 src: domain should not replace nextTick function
Previously if you cached process.nextTick and then require('domain')
subsequent nextTick() calls would not be caught because enqueued
functions were taking the wrong path. This keeps nextTick to a single
function reference and changes the implementation details after domain
has been required.
2014-03-03 16:27:58 -08:00
Fedor Indutny
78d245f5b2 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	configure
	lib/_stream_readable.js
	lib/http.js
	src/node_dtrace.cc
2014-03-02 23:54:19 +04:00
Fedor Indutny
34bf6e46be smalloc: remove env.h include
Since `smalloc.h` is included in a `node_buffer.h`, including private
headers in it is strictly prohibited.

fix #7206
2014-03-02 12:05:13 +04:00
Fedor Indutny
5596f936d8 node: invoke beforeExit again if loop was active
When `setImmediate(cb)` is called in `beforeExit` event handler the
consequent `uv_run(..., UV_RUN_NOWAIT)` may return `0`, even if there
was some active handles at start.

Fixes simple/test-beforeexit-event.js.
2014-03-01 21:30:17 +04:00
Fedor Indutny
3b88dc6f19 stream_wrap: don't write twice on uv_try_write err
fix #7155
2014-02-28 18:02:02 +04:00
Ben Noordhuis
a2eeb43ded src: emit 'beforeExit' event on process object
Unlike the 'exit' event, this event allows the user to schedule more
work and thereby postpone the exit.  That also means that the
'beforeExit' event may be emitted many times, see the attached test
case for an example.

Refs #6305.
2014-02-28 14:43:30 +04:00
Saúl Ibarra Corretgé
6e1eac744b src: use new loop API
uv_loop_new and uv_loop_delete are considered deprecated now.
2014-02-28 14:01:52 +04:00
Saúl Ibarra Corretgé
269de79fbf src: spawn_sync should close handles upon exit
When the exit callback is fired for the child process we should close
the handle associated with it.
2014-02-26 18:16:07 -08:00
Timothy J Fontaine
afc29ed397 src: update to latest libuv api
libuv gyp builds now require you to define the library disposition
(static or shared).

Also, libuv now supports vectored IO for file system reads and writes,
update to those function signatures
2014-02-26 18:15:07 -08:00
Alexis Campailla
20176a9841 src: make stdout/sterr pipes blocking
Expose `setBlocking` on Pipe's and if a pipe is being created for stdio
on windows then make the pipes blocking.

This fixes test-stream2-stderr-sync.js on Windows.

Fixes #3584
2014-02-26 10:36:58 -08:00
Maxwell Krohn
a22a2d8656 tls: stop NodeBIO::Gets from reading off end of buffer
NodeBIO::Gets was reading off the end of a buffer if it
didn't find a "\n" before the EOF.  This behavior
was causing X509 certificates passed to `https.Agent`
via the "ca" option to be silently discarded. It also
was causing improper parsing of certs and keys
passed to https.Agent, but those problems were worked
around in cdde9a3.

Backed out workaround in `lib/crypto.js` from ccde9a3,
which now isn't needed.  But keep the test introduced
in that commit, which tests properly for this
bug.

This bug was first introduced in a58f93f

Gist containing test code, bisection log, and notes:
   https://gist.github.com/maxtaco/9211605
2014-02-26 17:33:10 +04:00
Alexis Campailla
b5f9779c2f windows: fix module registration
The linker was optimizing the static variables that were supposed
to trigger module initialization.

I am making them non-static, and dllexport so that they don't get
optimized away.

Fixes #7116
2014-02-25 13:44:38 -08:00