platform/upstream/nodejs.git
11 years agov8: re-apply floating patches
Timothy J Fontaine [Thu, 23 May 2013 20:40:40 +0000 (13:40 -0700)]
v8: re-apply floating patches

11 years agov8: fix GetLocalizedMessage usage
Timothy J Fontaine [Thu, 23 May 2013 20:57:59 +0000 (13:57 -0700)]
v8: fix GetLocalizedMessage usage

As is the backport of the abort on uncaught exception wouldn't compile
because we it was passing in `this` when it was unnecessary.

11 years agov8: update to 3.14.5.9
Timothy J Fontaine [Thu, 23 May 2013 20:39:12 +0000 (13:39 -0700)]
v8: update to 3.14.5.9

11 years agohttp: save roundtrips, convert buffers to strings
Ben Noordhuis [Wed, 22 May 2013 19:43:35 +0000 (21:43 +0200)]
http: save roundtrips, convert buffers to strings

This commit adds an optimization to the HTTP client that makes it
possible to:

* Pack the headers and the first chunk of the request body into a
  single write().

* Pack the chunk header and the chunk itself into a single write().

Because only one write() system call is issued instead of several,
the chances of data ending up in a single TCP packet are phenomenally
higher: the benchmark with `type=buf size=32` jumps from 50 req/s to
7,500 req/s, a 150-fold increase.

This commit removes the check from e4b716ef that pushes binary encoded
strings into the slow path. The commit log mentions that:

    We were assuming that any string can be concatenated safely to
    CRLF.  However, for hex, base64, or binary encoded writes, this
    is not the case, and results in sending the incorrect response.

For hex and base64 strings that's certainly true but binary strings
are 'das Ding an sich': string.length is the same before and after
decoding.

Fixes #5528.

11 years agodoc: the build requires gcc 4.2 or newer
Ben Noordhuis [Wed, 22 May 2013 11:47:29 +0000 (13:47 +0200)]
doc: the build requires gcc 4.2 or newer

11 years agoconfigure: respect the --dest-os flag consistently
Nathan Rajlich [Tue, 21 May 2013 16:26:42 +0000 (09:26 -0700)]
configure: respect the --dest-os flag consistently

Consider a user on his Mac, who wants to cross-compile for his Linux ARM device:

    ./configure --dest-cpu=arm --dest-os=linux

Before this patch, for example, DTrace probes would incorrectly attempt to be
enabled because the configure script is running on a MacOS machine, even though
we're trying to compile a binary for `linux`.

With this patch, the `--dest-os` flag is respected throughout the configure
script, thus leaving DTrace probes disabled in this cross-compiling scenario.

11 years agonet: use timers._unrefActive for internal timeouts
Timothy J Fontaine [Fri, 17 May 2013 22:07:28 +0000 (15:07 -0700)]
net: use timers._unrefActive for internal timeouts

11 years agotimers: internal unref'd timer for api timeouts
Timothy J Fontaine [Fri, 17 May 2013 22:04:24 +0000 (15:04 -0700)]
timers: internal unref'd timer for api timeouts

When an internal api needs a timeout, they should use
timers._unrefActive since that won't hold the loop open. This solves
the problem where you might have unref'd the socket handle but the
timeout for the socket was still active.

11 years agobuffer: throw when writing beyond buffer
Trevor Norris [Mon, 20 May 2013 21:37:55 +0000 (14:37 -0700)]
buffer: throw when writing beyond buffer

Previously one could write anywhere in a buffer pool if they accidently
got their offset wrong. Mainly because the cc level checks only test
against the parent slow buffer and not against the js object properties.
So now we check to make sure values won't go beyond bounds without
letting the dev know.

11 years agocrypto: Clear error after DiffieHellman key errors
isaacs [Sat, 18 May 2013 00:19:12 +0000 (17:19 -0700)]
crypto: Clear error after DiffieHellman key errors

Fixes #5499

11 years agostring_bytes: strip padding from base64 strings
Trevor Norris [Mon, 20 May 2013 19:35:31 +0000 (12:35 -0700)]
string_bytes: strip padding from base64 strings

Because of variations in different base64 implementation, it's been
decided to strip all padding from the end of a base64 string and
calculate its size from that.

11 years agosrc: Remove superfluous static_cast
isaacs [Fri, 17 May 2013 23:58:05 +0000 (16:58 -0700)]
src: Remove superfluous static_cast

11 years agoblog: Release 0.10.7
isaacs [Fri, 17 May 2013 21:38:02 +0000 (14:38 -0700)]
blog: Release 0.10.7

11 years agoNow working on 0.10.8
isaacs [Fri, 17 May 2013 21:37:44 +0000 (14:37 -0700)]
Now working on 0.10.8

11 years agoMerge branch 'v0.10.7-release' into v0.10
isaacs [Fri, 17 May 2013 21:37:28 +0000 (14:37 -0700)]
Merge branch 'v0.10.7-release' into v0.10

11 years ago2013.05.17, Version 0.10.7 (Stable) v0.10.7
isaacs [Fri, 17 May 2013 20:59:10 +0000 (13:59 -0700)]
2013.05.17, Version 0.10.7 (Stable)

* uv: upgrade to v0.10.7

* npm: Upgrade to 1.2.21

* crypto: Don't ignore verify encoding argument (isaacs)

* buffer, crypto: fix default encoding regression (Ben Noordhuis)

* timers: fix setInterval() assert (Ben Noordhuis)

11 years agodoc: Fix link to open issues on GitHub.
Brandon Frohs [Thu, 16 May 2013 14:03:25 +0000 (11:03 -0300)]
doc: Fix link to open issues on GitHub.

11 years agocrypto: Don't ignore verify encoding argument
isaacs [Fri, 17 May 2013 20:55:29 +0000 (13:55 -0700)]
crypto: Don't ignore verify encoding argument

11 years agobuffer, crypto: fix default encoding regression
Ben Noordhuis [Wed, 15 May 2013 15:52:00 +0000 (17:52 +0200)]
buffer, crypto: fix default encoding regression

The default encoding is 'buffer'. When the input is a string, treat it
as 'binary'. Fixes the following assertion:

  node: ../src/string_bytes.cc:309: static size_t
  node::StringBytes::StorageSize(v8::Handle<v8::Value>, node::encoding):
  Assertion `0 && "buffer encoding specified but string provided"'
  failed.

Introduced in 64fc34b2.

Fixes #5482.

11 years agodoc: fix missing Class in header
Ryuichi Okumura [Sun, 7 Apr 2013 08:40:55 +0000 (17:40 +0900)]
doc: fix missing Class in header

11 years agodoc: fix the link to Stream document
Ryuichi Okumura [Sun, 7 Apr 2013 08:19:50 +0000 (17:19 +0900)]
doc: fix the link to Stream document

11 years agotimers: fix setInterval() assert
Ben Noordhuis [Thu, 21 Mar 2013 11:19:03 +0000 (12:19 +0100)]
timers: fix setInterval() assert

Test case:

  var t = setInterval(function() {}, 1);
  process.nextTick(t.unref);

Output:

  Assertion failed: (args.Holder()->InternalFieldCount() > 0),
  function Unref, file ../src/handle_wrap.cc, line 78.

setInterval() returns a binding layer object. Make it stop doing that,
wrap the raw process.binding('timer_wrap').Timer object in a Timeout
object.

Fixes #4261.

11 years agodoc: improve exports/module.exports consistency
Ryan Graham [Mon, 8 Apr 2013 16:59:58 +0000 (09:59 -0700)]
doc: improve exports/module.exports consistency

While they reference the same object, they are only interchangeable
for updates, not assignment.

11 years agodoc: clarify exports and module.exports
Ryan Graham [Mon, 8 Apr 2013 16:59:15 +0000 (09:59 -0700)]
doc: clarify exports and module.exports

When exporting a single function you must use `module.exports` instead
of the `exports` convenience reference.

11 years agouv: upgrade to v0.10.7
Bert Belder [Tue, 14 May 2013 23:52:47 +0000 (16:52 -0700)]
uv: upgrade to v0.10.7

11 years agouv: Upgrade to 0.10.6
isaacs [Tue, 14 May 2013 21:41:41 +0000 (14:41 -0700)]
uv: Upgrade to 0.10.6

11 years agonpm: Upgrade to 1.2.21
isaacs [Tue, 14 May 2013 21:37:59 +0000 (14:37 -0700)]
npm: Upgrade to 1.2.21

11 years agoblog: Release 0.10.6
isaacs [Tue, 14 May 2013 21:35:14 +0000 (14:35 -0700)]
blog: Release 0.10.6

11 years agoNow working on v0.10.7
isaacs [Tue, 14 May 2013 21:33:56 +0000 (14:33 -0700)]
Now working on v0.10.7

11 years agoMerge branch 'v0.10.6-release' into v0.10
isaacs [Tue, 14 May 2013 21:33:33 +0000 (14:33 -0700)]
Merge branch 'v0.10.6-release' into v0.10

11 years agocrypto: Pass encodings for Hmac digest
isaacs [Fri, 3 May 2013 01:38:04 +0000 (18:38 -0700)]
crypto: Pass encodings for Hmac digest

11 years ago2013.05.14, Version 0.10.6 (Stable) v0.10.6
isaacs [Tue, 14 May 2013 18:42:16 +0000 (11:42 -0700)]
2013.05.14, Version 0.10.6 (Stable)

* module: Deprecate require.extensions (isaacs)

* stream: make Readable.wrap support objectMode, empty streams (Daniel Moore)

* child_process: fix handle delivery (Ben Noordhuis)

* crypto: Fix performance regression (isaacs)

* src: DRY string encoding/decoding (isaacs)

11 years agocrypto: Pass encodings to C++ for Sign/Verify
isaacs [Fri, 3 May 2013 01:34:25 +0000 (18:34 -0700)]
crypto: Pass encodings to C++ for Sign/Verify

11 years agocrypto: use StringBytes::Encode
isaacs [Thu, 2 May 2013 22:32:32 +0000 (15:32 -0700)]
crypto: use StringBytes::Encode

11 years agocrypto: Pass strings to binding layer directly
isaacs [Thu, 2 May 2013 19:28:48 +0000 (12:28 -0700)]
crypto: Pass strings to binding layer directly

11 years agobuffer: DRY string encoding using StringBytes
isaacs [Thu, 2 May 2013 17:44:45 +0000 (10:44 -0700)]
buffer: DRY string encoding using StringBytes

This also templatizes the Buffer::*Slice functions, and the template
function probably cannot be safely used outside of Node.  However, it
also SHOULD not be used outside of Node, so this is arguably a feature
as well as a caveat.

11 years agosrc: use StringBytes for DecodeWrite/DecodeBytes/Encode
isaacs [Thu, 2 May 2013 17:49:20 +0000 (10:49 -0700)]
src: use StringBytes for DecodeWrite/DecodeBytes/Encode

Bonus: this makes node::Encode actually work properly with base64,
ucs2, hex, etc.

11 years agosrc: Use StringBytes in StreamWrap
isaacs [Wed, 1 May 2013 22:40:13 +0000 (15:40 -0700)]
src: Use StringBytes in StreamWrap

11 years agosrc: Add StringBytes static util class
isaacs [Wed, 1 May 2013 22:40:43 +0000 (15:40 -0700)]
src: Add StringBytes static util class

Four functions:

- StringBytes::StorageSize()
- StringBytes::Size()
- StringBytes::Write()
- StringBytes::Encode()

11 years agotools: remove unnecessary cpplint rules
isaacs [Wed, 1 May 2013 22:36:09 +0000 (15:36 -0700)]
tools: remove unnecessary cpplint rules

We don't actually care about header order much, and since we never use
stl classes, 'string' isn't an issue for node ever.

11 years agostream: Make default encoding configurable
isaacs [Thu, 2 May 2013 19:25:50 +0000 (12:25 -0700)]
stream: Make default encoding configurable

Pretty much everything assumes strings to be utf-8, but crypto
traditionally used binary strings, so we need to keep the default
that way until most users get off of that pattern.

11 years agostream: don't create unnecessary buffers in Readable
isaacs [Tue, 30 Apr 2013 22:09:54 +0000 (15:09 -0700)]
stream: don't create unnecessary buffers in Readable

If there is an encoding, and we do 'stream.push(chunk, enc)', and the
encoding argument matches the stated encoding, then we're converting from
a string, to a buffer, and then back to a string.  Of course, this is a
completely pointless bit of work, so it's best to avoid it when we know
that we can do so safely.

11 years agolint
isaacs [Tue, 30 Apr 2013 22:02:19 +0000 (15:02 -0700)]
lint

11 years agobenchmark: hash stream
isaacs [Tue, 30 Apr 2013 21:50:21 +0000 (14:50 -0700)]
benchmark: hash stream

11 years agoblog: Release v0.11.2
isaacs [Tue, 14 May 2013 18:35:43 +0000 (11:35 -0700)]
blog: Release v0.11.2

11 years agotest: increase workers to 8 in cluster-disconnect
Benoit Vallée [Tue, 30 Apr 2013 04:25:23 +0000 (12:25 +0800)]
test: increase workers to 8 in cluster-disconnect

Increasing the number of workers from 2 to 8 makes this test
more likely to trigger race conditions. See #5330 for background.

11 years agodoc: clarify subsystems in CONTRIBUTING.md
Ben Noordhuis [Tue, 14 May 2013 10:31:38 +0000 (12:31 +0200)]
doc: clarify subsystems in CONTRIBUTING.md

11 years agochild_process: fix handle delivery
Ben Noordhuis [Fri, 10 May 2013 18:19:17 +0000 (11:19 -0700)]
child_process: fix handle delivery

Commit 9352c19 ("child_process: don't emit same handle twice") trades
one bug for another.

Before said commit, a handle was sometimes delivered with messages it
didn't belong to.

The bug fix introduced another bug that needs some explaining. On UNIX
systems, handles are basically file descriptors that are passed around
with the sendmsg() and recvmsg() system calls, using auxiliary data
(SCM_RIGHTS) as the transport.

node.js and libuv depend on the fact that none of the supported systems
ever emit more than one SCM_RIGHTS message from a recvmsg() syscall.
That assumption is something we should probably address someday for the
sake of portability but that's a separate discussion.

So, SCM_RIGHTS messages are never coalesced. SCM_RIGHTS and normal
messages however _are_ coalesced. That is, recvmsg() might return this:

  recvmsg();  // { "message-with-fd", "message", "message" }

The operating system implicitly breaks pending messages along
SCM_RIGHTS boundaries. Most Unices break before such messages but Linux
also breaks _after_ them.  When the sender looks like this:

  sendmsg("message");
  sendmsg("message-with-fd");
  sendmsg("message");

Then on most Unices the receiver sees messages arriving like this:

  recvmsg();  // { "message" }
  recvmsg();  // { "message-with-fd", "message" }

The bug fix in commit 9352c19 assumes this behavior. On Linux however,
those messages can also come in like this:

  recvmsg();  // { "message", "message-with-fd" }
  recvmsg();  // { "message" }

In other words, it's incorrect to assume that the file descriptor is
always attached to the first message. This commit makes node wise up.

Fixes #5330.

11 years agodoc: s/search.npmjs.org/npmjs.org/
isaacs [Thu, 9 May 2013 22:15:39 +0000 (15:15 -0700)]
doc: s/search.npmjs.org/npmjs.org/

11 years agotest: fix pummel/test-net-many-clients.js
Timothy J Fontaine [Mon, 6 May 2013 23:37:03 +0000 (16:37 -0700)]
test: fix pummel/test-net-many-clients.js

client sockets no longer emit 'connect' event inside the
requestListener, update test-net-many-clients to reflect that

11 years agodoc: document stream.Writable 'error' event
Robert Kowalski [Mon, 6 May 2013 19:53:35 +0000 (21:53 +0200)]
doc: document stream.Writable 'error' event

Fixes #5255.

11 years agostream: make Readable.wrap support empty streams
Daniel Moore [Wed, 1 May 2013 17:46:31 +0000 (13:46 -0400)]
stream: make Readable.wrap support empty streams

This makes Readable.wrap behave properly when the wrapped stream ends
before emitting any data events.

11 years agostream: make Readable.wrap support objectMode
Daniel Moore [Mon, 29 Apr 2013 13:25:08 +0000 (09:25 -0400)]
stream: make Readable.wrap support objectMode

Added a check to see if the stream is in objectMode before deciding
whether to include or exclude data from an old-style wrapped stream.

11 years agotest: don't use total_seconds() because of py2.6
Timothy J Fontaine [Tue, 7 May 2013 22:17:33 +0000 (15:17 -0700)]
test: don't use total_seconds() because of py2.6

11 years agotest: report test duration in TAP progress
Timothy J Fontaine [Tue, 7 May 2013 18:59:22 +0000 (11:59 -0700)]
test: report test duration in TAP progress

11 years agobuild: only use DESTDIR instead of PREFIX for pkg
Timothy J Fontaine [Thu, 2 May 2013 20:54:37 +0000 (13:54 -0700)]
build: only use DESTDIR instead of PREFIX for pkg

Preserve default install prefix seen in process.config, but use DESTDIR
for installing to deliniate 32/64 versions, avoid conflicts with PREFIX
settings in config.mk

11 years agodoc: update options for exec and execFile
Kevin Locke [Fri, 26 Apr 2013 23:14:39 +0000 (17:14 -0600)]
doc: update options for exec and execFile

The stdio and customFds options are never used by exec or execFile,
remove them from the documentation for these functions.

11 years agobuild: vcbuild.bat fix for Visual Studio 2012
Miroslav Bajtoš [Fri, 3 May 2013 06:51:51 +0000 (08:51 +0200)]
build: vcbuild.bat fix for Visual Studio 2012

Change vcbuild.bat to ignore VCINSTALLDIR environment variable,
always check for specific VS version and set GYP_MSVS_VERSION
accordingly. Otherwise GYP generates project files in format
that cannot be compiled by VS2012.

11 years agodoc: document return values of EventEmitter methods
Sam Roberts [Tue, 30 Apr 2013 22:24:48 +0000 (15:24 -0700)]
doc: document return values of EventEmitter methods

11 years agodoc: link joyent logo in website footer
isaacs [Thu, 2 May 2013 16:47:46 +0000 (09:47 -0700)]
doc: link joyent logo in website footer

11 years agodebugger: breakpoints in scripts not loaded yet
Miroslav Bajtoš [Fri, 26 Apr 2013 06:05:33 +0000 (08:05 +0200)]
debugger: breakpoints in scripts not loaded yet

When developer calls setBreakpoint with an unknown script name,
we convert the script name into regular expression matching all
paths ending with given name (name can be a relative path too).

To create such breakpoint in V8, we use type `scriptRegEx`
instead of `scriptId` for `setbreakpoint` request.

To restore such breakpoint, we save the original script name
send by the user. We use this original name to set (restore)
breakpoint in the new child process.

This is a back-port of commit 5db936d from the master branch.

11 years agoRevert "deps: downgrade openssl to v1.0.0f"
Ben Noordhuis [Wed, 1 May 2013 14:21:21 +0000 (16:21 +0200)]
Revert "deps: downgrade openssl to v1.0.0f"

After much investigation it turns out that the affected servers are
buggy.  user-service.condenastdigital.com:443 in particular seems to
reject large TLS handshake records. Cutting down the number of
advertised ciphers or disabling SNI fixes the issue.

Similarly, passing { secureOptions: constants.SSL_OP_NO_TLSv1_2 }
seems to fix most connection issues with IIS servers.

Having to work around buggy servers is annoying for our users but not
a reason to downgrade OpenSSL. Therefore, revert it.

This reverts commit 4fdb8acdaef4c3cb1d855e992ada0e63fee520a6.

11 years agodoc: Fix require.extensions documentation
isaacs [Tue, 30 Apr 2013 14:40:43 +0000 (07:40 -0700)]
doc: Fix require.extensions documentation

1. The stability index must come first, or it messes up the markdown
2. require.extensions is an Object, not an Array.

Close #5387

11 years agodeps: downgrade openssl to v1.0.0f
Ben Noordhuis [Fri, 26 Apr 2013 12:49:54 +0000 (14:49 +0200)]
deps: downgrade openssl to v1.0.0f

Several people have reported issues with IIS and Resin servers (or maybe
SSL terminators sitting in front of those servers) that are fixed by
downgrading OpenSSL. The AESNI performance improvements were nice but
stability is more important. Downgrade OpenSSL from 1.0.1e to 1.0.0f.

Fixes #5360 (and others).

11 years agodoc: cluster: s/server.destroy/server.close/
Ben Noordhuis [Mon, 29 Apr 2013 10:06:30 +0000 (12:06 +0200)]
doc: cluster: s/server.destroy/server.close/

Fixes #5379.

11 years agodoc: Deprecate require.extensions
isaacs [Mon, 29 Apr 2013 05:10:24 +0000 (22:10 -0700)]
doc: Deprecate require.extensions

11 years agodebugger: `restart` with custom debug port
Miroslav Bajtoš [Fri, 26 Apr 2013 19:07:56 +0000 (21:07 +0200)]
debugger: `restart` with custom debug port

Fixed a bug in debugger repl where `restart` command did not work
when a custom debug port was specified via command-line option
--port={number}.

File test/simple/helper-debugger-repl.js was extracted
from test/simple/test-debugger-repl.js

11 years agoChangeLog: Merge in v0.8
isaacs [Tue, 23 Apr 2013 21:43:46 +0000 (14:43 -0700)]
ChangeLog: Merge in v0.8

Close #5355

11 years agoblog: Post for v0.10.5
isaacs [Tue, 23 Apr 2013 21:08:01 +0000 (14:08 -0700)]
blog: Post for v0.10.5

11 years agoNow working on 0.10.6
isaacs [Tue, 23 Apr 2013 21:07:23 +0000 (14:07 -0700)]
Now working on 0.10.6

11 years agoMerge branch 'v0.10.5-release' into v0.10
isaacs [Tue, 23 Apr 2013 21:07:09 +0000 (14:07 -0700)]
Merge branch 'v0.10.5-release' into v0.10

11 years ago2013.04.23, Version 0.10.5 (Stable) v0.10.5
isaacs [Tue, 23 Apr 2013 01:00:41 +0000 (18:00 -0700)]
2013.04.23, Version 0.10.5 (Stable)

* uv: Upgrade to 0.10.5 (isaacs)

* build: added support for Visual Studio 2012 (Miroslav Bajtoš)

* http: Don't try to destroy nonexistent sockets (isaacs)

* crypto: LazyTransform on properties, not methods (isaacs)

* assert: put info in err.message, not err.name (Ryan Doenges)

* dgram: fix no address bind() (Ben Noordhuis)

* handle_wrap: fix NULL pointer dereference (Ben Noordhuis)

* os: fix unlikely buffer overflow in os.type() (Ben Noordhuis)

* stream: Fix unshift() race conditions (isaacs)

11 years agobuild: added support for Visual Studio 2012
Miroslav Bajtoš [Tue, 23 Apr 2013 07:38:17 +0000 (09:38 +0200)]
build: added support for Visual Studio 2012

11 years agouv: Upgrade to 0.10.5
isaacs [Tue, 23 Apr 2013 00:39:05 +0000 (17:39 -0700)]
uv: Upgrade to 0.10.5

11 years agoos: Fix uname() error handling on sunos
isaacs [Mon, 22 Apr 2013 17:18:46 +0000 (10:18 -0700)]
os: Fix uname() error handling on sunos

The uname function can return any non-negative int to indicate success.

Strange, but that's how it is documented.  This also fixes a similar
buffer overflow in the even more unlikely event that info.release is
> 255 characters, similar to how 78c5de5 did for info.sysname.

11 years agohttp: Don't try to destroy nonexistent sockets
isaacs [Mon, 22 Apr 2013 15:52:42 +0000 (08:52 -0700)]
http: Don't try to destroy nonexistent sockets

Fixes #3740

In the case of pipelined requests, you can have a situation where
the socket gets destroyed via one req/res object, but then trying
to destroy *another* req/res on the same socket will cause it to
call undefined.destroy(), since it was already removed from that
message.

Add a guard to OutgoingMessage.destroy and IncomingMessage.destroy
to prevent this error.

11 years agotest: fix dgram-bind-default-address on osx
isaacs [Fri, 19 Apr 2013 15:32:24 +0000 (08:32 -0700)]
test: fix dgram-bind-default-address on osx

Allow the IPv4-mapped-as-IPv6 style address.

11 years agocrypto: LazyTransform on properties, not methods
isaacs [Mon, 8 Apr 2013 15:43:20 +0000 (08:43 -0700)]
crypto: LazyTransform on properties, not methods

It needs to apply the Transform class when the _readableState,
_writableState, or _transformState properties are accessed,
otherwise things like setEncoding and on('data') don't work
properly.

Also, the methods wrappers are no longer needed, since they're only
problematic because they access the undefined properties.

11 years agosrc: fix potential memory leak on early return
mscdex [Sun, 21 Apr 2013 03:21:13 +0000 (23:21 -0400)]
src: fix potential memory leak on early return

11 years agosrc: don't initialize variable before assignment
mscdex [Sun, 21 Apr 2013 03:21:05 +0000 (23:21 -0400)]
src: don't initialize variable before assignment

11 years agoblog: v0.11.1 does not work on windows x64
isaacs [Fri, 19 Apr 2013 16:21:29 +0000 (09:21 -0700)]
blog: v0.11.1 does not work on windows x64

11 years agoblog: Post about 0.11.1
isaacs [Fri, 19 Apr 2013 16:12:34 +0000 (09:12 -0700)]
blog: Post about 0.11.1

11 years agoblog: Post about 0.10.4
isaacs [Fri, 19 Apr 2013 16:12:22 +0000 (09:12 -0700)]
blog: Post about 0.10.4

11 years agodoc: document value of `this` inside listeners
Sean Silva [Thu, 18 Apr 2013 22:34:12 +0000 (18:34 -0400)]
doc: document value of `this` inside listeners

Fixes #5326.

11 years agoassert: put info in err.message, not err.name
Ryan Doenges [Sun, 14 Apr 2013 01:48:00 +0000 (18:48 -0700)]
assert: put info in err.message, not err.name

4716dc6 made assert.equal() and related functions work better by
generating a better toString() from the expected, actual, and operator
values passed to fail(). Unfortunately, this was accomplished by putting
the generated message into the error's `name` property. When you passed
in a custom error message, the error would put the custom error into
`name` *and* `message`, resulting in helpful string representations like
"AssertionError: Oh no: Oh no".

This commit resolves that issue by storing the generated message in the
`message` property while leaving the error's name alone and adding
a regression test so that this doesn't pop back up later.

Closes #5292.

11 years agowebsite: add link to nightlies on download page
Ben Noordhuis [Thu, 18 Apr 2013 20:06:03 +0000 (22:06 +0200)]
website: add link to nightlies on download page

11 years agocrypto: fix return Local Handle w/o scope.Close()
Trevor Norris [Wed, 17 Apr 2013 18:45:13 +0000 (11:45 -0700)]
crypto: fix return Local Handle w/o scope.Close()

A new String was being created and returned, but was not sent through
the scope.Close(), which caused it to be cleaned up before being
returned.

11 years agodgram: fix no address bind()
Ben Noordhuis [Wed, 17 Apr 2013 22:44:53 +0000 (00:44 +0200)]
dgram: fix no address bind()

I broke dgram.Socket#bind(port, cb) almost a year ago in 332fea5a but
it wasn't until today that someone complained and none of the tests
caught it because they all either specify the address or omit the
callback.

Anyway, now it works again and does what you expect: it binds the
socket to the "any" address ("0.0.0.0" for IPv4 and "::" for IPv6.)

11 years agotest: make stdout-close-unref work in test runner
Ben Noordhuis [Wed, 17 Apr 2013 21:59:49 +0000 (23:59 +0200)]
test: make stdout-close-unref work in test runner

process.stdout isn't fully initialized yet by the time the test starts
when invoked with `python tools/test.py`. Use process.stdin instead and
force initialization with process.stdin.resume().

11 years agodocs: update path.join() example for v0.10
Kelly Gerber [Tue, 9 Apr 2013 20:36:34 +0000 (13:36 -0700)]
docs: update path.join() example for v0.10

The current example shows the behavior of v0.8. In v0.10 arguments
to path.join() must be strings; otherwise, an exception is thrown.

11 years agodoc: note a gotcha with http.Server sockets
Ryan Graham [Tue, 16 Apr 2013 20:52:52 +0000 (13:52 -0700)]
doc: note a gotcha with http.Server sockets

11 years agohandle_wrap: fix NULL pointer dereference
Ben Noordhuis [Tue, 16 Apr 2013 20:59:35 +0000 (22:59 +0200)]
handle_wrap: fix NULL pointer dereference

Fix a NULL pointer dereference in src/handle_wrap.cc which is really a
use-after-close bug.

The test checks that unref() after close() works on process.stdout but
this bug affects everything that derives from HandleWrap. I discovered
it because child processes would sometimes quit for no reason (that is,
no reason until I turned on core dumps.)

11 years agotest: preserve process.env after test-init exec
Stanislav Ochotnicky [Tue, 16 Apr 2013 07:51:56 +0000 (09:51 +0200)]
test: preserve process.env after test-init exec

When LD_LIBRARY_PATH is overriden for custom builds we need to preserve
it for child processes. To be sure we preserve whole environment of
parent process and just add TEST_INIT variable to it.

11 years agotest: preserve process.env in forked child_process
Stanislav Ochotnicky [Wed, 10 Apr 2013 13:38:02 +0000 (15:38 +0200)]
test: preserve process.env in forked child_process

When LD_LIBRARY_PATH is overriden for custom builds we need to preserve
it for forked process. There are possibly other environment variables
that could cause test failures so we preserve whole environment of
parent process.

11 years agoos: unbreak windows build
Ben Noordhuis [Mon, 15 Apr 2013 20:36:49 +0000 (22:36 +0200)]
os: unbreak windows build

Windows doesn't have MAXHOSTNAMELEN. Introduced in afbadde.

11 years agoos: handle 256 character hostnames
Ben Noordhuis [Mon, 15 Apr 2013 19:05:20 +0000 (21:05 +0200)]
os: handle 256 character hostnames

Fix a (rather academic) buffer overflow. MAXHOSTNAMELEN is 256 on most
platforms, which means the buffer wasn't big enough to hold the
trailing nul byte on a system with a maximum length hostname.

11 years agoos: fix unlikely buffer overflow in os.type()
Ben Noordhuis [Mon, 15 Apr 2013 18:51:28 +0000 (20:51 +0200)]
os: fix unlikely buffer overflow in os.type()

* Fix a buffer overflow that happens iff strlen(info.sysname) > 255.
* Check the return value of uname().

11 years agobuild: Typo in tools/msvs/msi/product.wxs
isaacs [Fri, 12 Apr 2013 03:40:05 +0000 (20:40 -0700)]
build: Typo in tools/msvs/msi/product.wxs

11 years agostream: Fix unshift() race conditions
isaacs [Thu, 11 Apr 2013 22:01:26 +0000 (15:01 -0700)]
stream: Fix unshift() race conditions

Fix #5272

The consumption of a readable stream is a dance with 3 partners.

1. The specific stream Author (A)
2. The Stream Base class (B), and
3. The Consumer of the stream (C)

When B calls the _read() method that A implements, it sets a 'reading'
flag, so that parallel calls to _read() can be avoided.  When A calls
stream.push(), B knows that it's safe to start calling _read() again.

If the consumer C is some kind of parser that wants in some cases to
pass the source stream off to some other party, but not before "putting
back" some bit of previously consumed data (as in the case of Node's
websocket http upgrade implementation).  So, stream.unshift() will
generally *never* be called by A, but *only* called by C.

Prior to this patch, stream.unshift() *also* unset the state.reading
flag, meaning that C could indicate the end of a read, and B would
dutifully fire off another _read() call to A.  This is inappropriate.
In the case of fs streams, and other variably-laggy streams that don't
tolerate overlapped _read() calls, this causes big problems.

Also, calling stream.shift() after the 'end' event did not raise any
kind of error, but would cause very strange behavior indeed.  Calling it
after the EOF chunk was seen, but before the 'end' event was fired would
also cause weird behavior, and could lead to data being lost, since it
would not emit another 'readable' event.

This change makes it so that:

1. stream.unshift() does *not* set state.reading = false
2. stream.unshift() is allowed up until the 'end' event.
3. unshifting onto a EOF-encountered and zero-length (but not yet
end-emitted) stream will defer the 'end' event until the new data is
consumed.
4. pushing onto a EOF-encountered stream is now an error.

So, if you read(), you have that single tick to safely unshift() data
back into the stream, even if the null chunk was pushed, and the length
was 0.

11 years agoNow working on v0.10.5
isaacs [Thu, 11 Apr 2013 18:07:08 +0000 (11:07 -0700)]
Now working on v0.10.5