platform/upstream/nodejs.git
11 years agonpm: Upgrade to 1.2.18
isaacs [Thu, 11 Apr 2013 16:16:47 +0000 (09:16 -0700)]
npm: Upgrade to 1.2.18

11 years agouv: Upgrade to v0.10.4
isaacs [Thu, 11 Apr 2013 16:07:22 +0000 (09:07 -0700)]
uv: Upgrade to v0.10.4

11 years agochild_process: fix O(n*m) scan of cmd string
Ben Noordhuis [Thu, 11 Apr 2013 11:50:45 +0000 (13:50 +0200)]
child_process: fix O(n*m) scan of cmd string

Don't scan the whole string for a "NODE_" substring, just check that
the string starts with the expected prefix.

This is a reprise of dbbfbe7 but this time for the child_process
module.

11 years agocluster: fix O(n*m) scan of cmd string
Ben Noordhuis [Thu, 11 Apr 2013 11:18:02 +0000 (13:18 +0200)]
cluster: fix O(n*m) scan of cmd string

Don't scan the whole string for a "NODE_CLUSTER_" substring, just check
that the string starts with the expected prefix. The linear scan was
causing a noticeable (but unsurprising) slowdown on messages with a
large .cmd string property.

11 years agosrc: don't SetInternalField() in ObjectWrap dtor
Ben Noordhuis [Wed, 10 Apr 2013 13:25:40 +0000 (15:25 +0200)]
src: don't SetInternalField() in ObjectWrap dtor

Call SetPointerInInternalField(0, NULL) rather than
SetInternalField(0, Undefined()).

Fixes the following spurious NULL pointer dereference in debug builds:

  #0  0x03ad2821 in v8::internal::FixedArrayBase::length ()
  #1  0x03ad1dfc in v8::internal::FixedArray::get ()
  #2  0x03ae05dd in v8::internal::Context::global_object ()
  #3  0x03b6b87d in v8::internal::Context::builtins ()
  #4  0x03ae1871 in v8::internal::Isolate::js_builtins_object ()
  #5  0x03ab4fab in v8::CallV8HeapFunction ()
  #6  0x03ab4d4a in v8::Value::Equals ()
  #7  0x03b4f38b in CheckEqualsHelper ()
  #8  0x03ac0f4b in v8::Object::SetInternalField ()
  #9  0x06a99ddd in node::ObjectWrap::~ObjectWrap ()
  #10 0x06a8b051 in node::Buffer::~Buffer ()
  #11 0x06a8afbb in node::Buffer::~Buffer ()
  #12 0x06a8af5e in node::Buffer::~Buffer ()
  #13 0x06a9e569 in node::ObjectWrap::WeakCallback ()

11 years agoRevert "crypto: use better memory BIO implementation"
Ben Noordhuis [Wed, 10 Apr 2013 11:50:59 +0000 (13:50 +0200)]
Revert "crypto: use better memory BIO implementation"

This change shouldn't have landed in the stable branch. It's a feature,
not a bug fix.

This reverts commit 58f93ffc4a23aa7240808288acf8cf9f3022abea.
This reverts commit 8c8ebe49b62c47b0ac87d697d0bc3515604667c3.
This reverts commit ba0f7b8066cb4dc8cb3cd4931e52aa94af40a709.
This reverts commit 21f3c5c3670861436392f30da2033cccbc137309.

11 years agonet: fix socket.bytesWritten Buffers support
Fedor Indutny [Wed, 10 Apr 2013 10:21:41 +0000 (14:21 +0400)]
net: fix socket.bytesWritten Buffers support

Buffer.byteLength() works only for string inputs. Thus, when connection
has pending Buffer to write, it should just use it's length instead of
throwing exception.

11 years agocrypto: remove unused ClientHelloParser field
Ben Noordhuis [Tue, 9 Apr 2013 23:38:59 +0000 (01:38 +0200)]
crypto: remove unused ClientHelloParser field

11 years agoblog: Post for v0.8.23
isaacs [Tue, 9 Apr 2013 00:41:49 +0000 (17:41 -0700)]
blog: Post for v0.8.23

11 years agobuffer: fix offset checks
Łukasz Walukiewicz [Fri, 5 Apr 2013 14:48:18 +0000 (16:48 +0200)]
buffer: fix offset checks

Fixed offset checks in Buffer.readInt32LE() and Buffer.readInt32BE()
functions.

11 years agostream: call write cb before finish event
isaacs [Mon, 8 Apr 2013 18:00:26 +0000 (11:00 -0700)]
stream: call write cb before finish event

Since 049903e, an end callback could be called before a write
callback if end() is called before the write is done. This patch
resolves the issue.

In collaboration with @gne

Fixes felixge/node-formidable#209
Fixes #5215

11 years agohttp: Support write(data, 'hex')
isaacs [Mon, 8 Apr 2013 15:46:51 +0000 (08:46 -0700)]
http: Support write(data, 'hex')

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.

An unusual edge case, but certainly a bug.

11 years agocrypto: dh secret should be left-padded
Fedor Indutny [Mon, 8 Apr 2013 14:00:18 +0000 (18:00 +0400)]
crypto: dh secret should be left-padded

DH_compute_secret() may return key that is smaller than input buffer,
in such cases key should be left-padded because it is a BN (big number).

fix #5239

11 years agoprocess: expose NODE_MODULE_VERSION in process.versions
Rod Vagg [Mon, 8 Apr 2013 05:13:23 +0000 (15:13 +1000)]
process: expose NODE_MODULE_VERSION in process.versions

11 years agocrypto: move write_head in bio's Reset() method
Fedor Indutny [Sat, 6 Apr 2013 19:26:24 +0000 (23:26 +0400)]
crypto: move write_head in bio's Reset() method

11 years agocrypto: fix changing buffers in bio
Fedor Indutny [Sat, 6 Apr 2013 19:26:00 +0000 (23:26 +0400)]
crypto: fix changing buffers in bio

We should go to next buffer if *current* one is full, not the next one.
Otherwise we may hop through buffers and written data will become
interleaved, which will lead to failure.

11 years agocrypto: fix style issues in bio
Fedor Indutny [Sat, 6 Apr 2013 18:47:53 +0000 (22:47 +0400)]
crypto: fix style issues in bio

Stop changing arguments, use local variables for things that change.

11 years agocrypto: fix constructor call in crypto streams
Andreas Madsen [Mon, 8 Apr 2013 08:32:53 +0000 (10:32 +0200)]
crypto: fix constructor call in crypto streams

When using some stream method on a lazy crypto stream, the transform
constructor wasn't called. This caused the internal state object to
be undefined.

11 years agonet: account encoding in .byteLength
Fedor Indutny [Mon, 8 Apr 2013 07:48:46 +0000 (11:48 +0400)]
net: account encoding in .byteLength

11 years agodoc: document linux pwrite() bug
Ben Noordhuis [Sun, 7 Apr 2013 22:41:33 +0000 (00:41 +0200)]
doc: document linux pwrite() bug

On Linux, positional writes don't work when the file is opened in
append mode. The kernel ignores the position argument and always
appends the data to the end of the file.

To quote the man page:

  POSIX requires that opening a file with the O_APPEND flag should have
  no affect on the location at which pwrite() writes data.  However, on
  Linux, if a file is opened with O_APPEND, pwrite() appends data to the
  end of the file, regardless of the value of offset.

11 years agonet: fix buffer iteration in bytesWritten
Fedor Indutny [Sun, 7 Apr 2013 20:50:40 +0000 (00:50 +0400)]
net: fix buffer iteration in bytesWritten

11 years agocrypto: zero is not an error if writing 0 bytes
Fedor Indutny [Sun, 7 Apr 2013 14:03:27 +0000 (18:03 +0400)]
crypto: zero is not an error if writing 0 bytes

fix #5128

11 years agotls: Re-enable check of CN-ID in cert verification
Tobias Müllerleile [Thu, 4 Apr 2013 19:10:53 +0000 (22:10 +0300)]
tls: Re-enable check of CN-ID in cert verification

RFC 6125 explicitly states that a client "MUST NOT seek a match
for a reference identifier of CN-ID if the presented identifiers
include a DNS-ID, SRV-ID, URI-ID, or any application-specific
identifier types supported by the client", but it MAY do so if
none of the mentioned identifier types (but others) are present.

11 years agostream: unused variable
Rafael Garcia [Thu, 4 Apr 2013 19:54:57 +0000 (12:54 -0700)]
stream: unused variable

11 years agostream: remove vestiges of previous _transform API
Rafael Garcia [Thu, 4 Apr 2013 19:18:21 +0000 (12:18 -0700)]
stream: remove vestiges of previous _transform API

11 years agodoc: Correct caveats for http Readables
isaacs [Fri, 5 Apr 2013 18:07:53 +0000 (11:07 -0700)]
doc: Correct caveats for http Readables

11 years agocrypto: use better memory BIO implementation
Fedor Indutny [Wed, 3 Apr 2013 12:58:10 +0000 (16:58 +0400)]
crypto: use better memory BIO implementation

11 years agoblog: Post about 0.10.3
isaacs [Wed, 3 Apr 2013 18:27:04 +0000 (11:27 -0700)]
blog: Post about 0.10.3

11 years agoNow working on 0.10.4
isaacs [Wed, 3 Apr 2013 18:26:54 +0000 (11:26 -0700)]
Now working on 0.10.4

11 years agoMerge branch 'v0.10.3-release' into v0.10
isaacs [Wed, 3 Apr 2013 18:27:55 +0000 (11:27 -0700)]
Merge branch 'v0.10.3-release' into v0.10

11 years agov8: cherry-pick 75311294 from upstream
Fedor Indutny [Wed, 3 Apr 2013 18:11:32 +0000 (22:11 +0400)]
v8: cherry-pick 75311294 from upstream

Quote from commit message:

    Create a new HandleScope for each JSON-parsed object to avoid
    excessive growth.

11 years ago2013.04.03, Version 0.10.3 (Stable) v0.10.3
isaacs [Wed, 3 Apr 2013 17:30:57 +0000 (10:30 -0700)]
2013.04.03, Version 0.10.3 (Stable)

* npm: Upgrade to 1.2.17

* child_process: acknowledge sent handles (Fedor Indutny)

* etw: update prototypes to match dtrace provider (Timothy J Fontaine)

* dtrace: pass more arguments to probes (Dave Pacheco)

* build: allow building with dtrace on osx (Dave Pacheco)

* http: Remove legacy ECONNRESET workaround code (isaacs)

* http: Ensure socket cleanup on client response end (isaacs)

* tls: Destroy socket when encrypted side closes (isaacs)

* repl: isSyntaxError() catches "strict mode" errors (Nathan Rajlich)

* crypto: Pass options to ctor calls (isaacs)

* src: tie process.versions.uv to uv_version_string() (Ben Noordhuis)

11 years agohttp: Remove legacy ECONNRESET workaround code
isaacs [Mon, 1 Apr 2013 22:46:51 +0000 (15:46 -0700)]
http: Remove legacy ECONNRESET workaround code

Fix #5179

11 years agonpm: Upgrade to 1.2.17
isaacs [Wed, 3 Apr 2013 17:17:04 +0000 (10:17 -0700)]
npm: Upgrade to 1.2.17

11 years agotest: fork-getconnections stricter, less chatty
isaacs [Wed, 3 Apr 2013 17:01:50 +0000 (10:01 -0700)]
test: fork-getconnections stricter, less chatty

11 years agochild_process: acknowledge sent handles
Fedor Indutny [Mon, 1 Apr 2013 20:07:24 +0000 (00:07 +0400)]
child_process: acknowledge sent handles

Fix race-condition when multiple handles are sent and SCM_RIGHTS
messages are gets merged by OS by avoiding sending multiple handles at
once!

fix #4885

11 years agoassert: Simplify AssertError creation
isaacs [Wed, 3 Apr 2013 16:43:17 +0000 (09:43 -0700)]
assert: Simplify AssertError creation

11 years agoetw: update prototypes to match dtrace provider
Timothy J Fontaine [Sat, 30 Mar 2013 03:46:36 +0000 (20:46 -0700)]
etw: update prototypes to match dtrace provider

The DTrace probes were updated to accomodate platforms that can't
handle structs, update the prototypes for ETW but it's not necessary
to do anything with the new arguments as it's redundant information.

11 years agodtrace: check if _handle property is set
Ben Noordhuis [Sat, 30 Mar 2013 00:49:19 +0000 (01:49 +0100)]
dtrace: check if _handle property is set

Check that _handle is an object before trying to read its `fd`
property, avoids bogus values.

11 years agodtrace: actually use the _handle.fd value
Timothy J Fontaine [Thu, 28 Mar 2013 23:51:52 +0000 (16:51 -0700)]
dtrace: actually use the _handle.fd value

When using the DTrace/systemtap subsystems it would be helpful to
actually have an fd associated with the requests and responses.

11 years agodtrace: pass more arguments to probes
Dave Pacheco [Thu, 28 Mar 2013 20:52:43 +0000 (13:52 -0700)]
dtrace: pass more arguments to probes

OSX and other DTrace implementations don't support dereferencing
structs in probes. To accomodate that pass members from the struct as
arguments so that DTrace is useful on those systems.

11 years agobuild: allow building with dtrace on osx
Dave Pacheco [Thu, 28 Mar 2013 18:36:00 +0000 (11:36 -0700)]
build: allow building with dtrace on osx

11 years agosrc: remove unused variables
Brian White [Tue, 2 Apr 2013 16:27:19 +0000 (12:27 -0400)]
src: remove unused variables

11 years agohttp client: Ensure socket cleanup on response end
isaacs [Tue, 2 Apr 2013 00:19:05 +0000 (17:19 -0700)]
http client: Ensure socket cleanup on response end

If an http response has an 'end' handler that throws, then the socket
will never be released back into the pool.

Granted, we do NOT guarantee that throwing will never have adverse
effects on Node internal state.  Such a guarantee cannot be reasonably
made in a shared-global mutable-state side-effecty language like
JavaScript.  However, in this case, it's a rather trivial patch to
increase our resilience a little bit, so it seems like a win.

There is no semantic change in this case, except that some event
listeners are removed, and the `'free'` event is emitted on nextTick, so
that you can schedule another request which will re-use the same socket.
From the user's point of view, there should be no detectable difference.

Closes #5107

11 years agotest: test intended code-paths
Andrew Hart [Sun, 31 Mar 2013 06:16:52 +0000 (00:16 -0600)]
test: test intended code-paths

The tests did not agree with the test comments. Tests first and second
were both testing the !state.reading case. Now second tests the
state.reading && state.length case.

Fixes joyent/node#5183

11 years agotls: Destroy socket when encrypted side closes
isaacs [Sat, 30 Mar 2013 01:23:39 +0000 (18:23 -0700)]
tls: Destroy socket when encrypted side closes

The v0.8 Stream.pipe() method automatically destroyed the destination
stream whenever the src stream closed.  However, this caused a lot of
problems, and was removed by popular demand.  (Many userland modules
still have a no-op destroy() method just because of this.) It was also
very hazardous because this would be done even if { end: false } was
passed in the pipe options.

In v0.10, we decided that the 'close' event and destroy() method are
application-specific, and pipe() doesn't automatically call destroy().
However, TLS actually depended (silently) on this behavior.  So, in this
case, we should just go ahead and destroy the thing when close happens.

Closes #5145

11 years agoEnsure BAD domain example actually uses domain
Michael Hart [Sat, 30 Mar 2013 01:29:50 +0000 (12:29 +1100)]
Ensure BAD domain example actually uses domain

11 years agoquerystring: Removing unnecessary binding
Mitar [Sun, 31 Mar 2013 10:42:33 +0000 (03:42 -0700)]
querystring: Removing unnecessary binding

Binding of `http_parser` in querystring isn't used anywhere and should
be removed.

11 years agorepl: use more readable RegExp syntax for spaces
Nathan Rajlich [Sat, 30 Mar 2013 20:35:36 +0000 (13:35 -0700)]
repl: use more readable RegExp syntax for spaces

This is just a cosmetic change really, nothing major.

11 years agorepl: isSyntaxError() catches "strict mode" errors
Nathan Rajlich [Sat, 30 Mar 2013 20:10:30 +0000 (13:10 -0700)]
repl: isSyntaxError() catches "strict mode" errors

Closes #5178.

11 years agocrypto: Pass options to ctor calls
isaacs [Fri, 29 Mar 2013 16:39:51 +0000 (09:39 -0700)]
crypto: Pass options to ctor calls

11 years agoblog: v0.11.0 release
isaacs [Thu, 28 Mar 2013 21:53:29 +0000 (14:53 -0700)]
blog: v0.11.0 release

11 years agoblog: Update linux binary tarball shasums
isaacs [Thu, 28 Mar 2013 21:39:52 +0000 (14:39 -0700)]
blog: Update linux binary tarball shasums

I just accidentally the binary release.

11 years agoblog: Post about v0.10.2
isaacs [Thu, 28 Mar 2013 20:06:00 +0000 (13:06 -0700)]
blog: Post about v0.10.2

11 years agoNode working on 0.10.3
isaacs [Thu, 28 Mar 2013 20:06:18 +0000 (13:06 -0700)]
Node working on 0.10.3

11 years agoMerge branch 'v0.10.2-release' into v0.10
isaacs [Thu, 28 Mar 2013 20:05:37 +0000 (13:05 -0700)]
Merge branch 'v0.10.2-release' into v0.10

11 years agosrc: tie process.versions.uv to uv_version_string()
Ben Noordhuis [Thu, 28 Mar 2013 19:12:02 +0000 (20:12 +0100)]
src: tie process.versions.uv to uv_version_string()

11 years ago2013.03.28, Version 0.10.2 (Stable) v0.10.2
isaacs [Thu, 28 Mar 2013 18:46:21 +0000 (11:46 -0700)]
2013.03.28, Version 0.10.2 (Stable)

* npm: Upgrade to 1.2.15

* uv: Upgrade to 0.10.3

* tls: handle SSL_ERROR_ZERO_RETURN (Fedor Indutny)

* tls: handle errors before calling C++ methods (Fedor Indutny)

* tls: remove harmful unnecessary bounds checking (Marcel Laverdet)

* crypto: make getCiphers() return non-SSL ciphers (Ben Noordhuis)

* crypto: check randomBytes() size argument (Ben Noordhuis)

* timers: do not calculate Timeout._when property (Alexey Kupershtokh)

* timers: fix off-by-one ms error (Alexey Kupershtokh)

* timers: handle signed int32 overflow in enroll() (Fedor Indutny)

* stream: Fix stall in Transform under very specific conditions (Gil Pedersen)

* stream: Handle late 'readable' event listeners (isaacs)

* stream: Fix early end in Writables on zero-length writes (isaacs)

* domain: fix domain callback from MakeCallback (Trevor Norris)

* child_process: don't emit same handle twice (Ben Noordhuis)

* child_process: fix sending utf-8 to child process (Ben Noordhuis)

11 years agodeps: upgrade libuv to v0.10.3
Bert Belder [Thu, 28 Mar 2013 19:05:33 +0000 (20:05 +0100)]
deps: upgrade libuv to v0.10.3

11 years agonpm: Upgrade to v1.2.15
isaacs [Thu, 28 Mar 2013 18:35:12 +0000 (11:35 -0700)]
npm: Upgrade to v1.2.15

11 years agotls: handle SSL_ERROR_ZERO_RETURN
Fedor Indutny [Thu, 28 Mar 2013 16:55:51 +0000 (20:55 +0400)]
tls: handle SSL_ERROR_ZERO_RETURN

see #5004

11 years agosetTimeout: do not calculate Timeout._when property
wicked [Thu, 25 Oct 2012 04:53:35 +0000 (11:53 +0700)]
setTimeout: do not calculate Timeout._when property

Dramatically improves Timer performance.

11 years agostream: Emit readable on ended streams via read(0)
isaacs [Wed, 27 Mar 2013 05:43:53 +0000 (22:43 -0700)]
stream: Emit readable on ended streams via read(0)

cc: @mjijackson

11 years agostream: Handle late 'readable' event listeners
isaacs [Tue, 26 Mar 2013 21:42:56 +0000 (14:42 -0700)]
stream: Handle late 'readable' event listeners

In cases where a stream may have data added to the read queue before the
user adds a 'readable' event, there is never any indication that it's
time to start reading.

True, there's already data there, which the user would get if they
checked However, as we use 'readable' event listening as the signal to
start the flow of data with a read(0) call internally, we ought to
trigger the same effect (ie, emitting a 'readable' event) even if the
'readable' listener is added after the first emission.

To avoid confusing weirdness, only the *first* 'readable' event listener
is granted this privileged status.  After we've started the flow (or,
alerted the consumer that the flow has started) we don't need to start
it again.  At that point, it's the consumer's responsibility to consume
the stream.

Closes #5141

11 years agodoc: Add 'don't ignore errors' section to domain
isaacs [Thu, 28 Mar 2013 01:41:41 +0000 (18:41 -0700)]
doc: Add 'don't ignore errors' section to domain

Also, an example program of using cluster and domain to handle errors
safely, with zero downtime, using process isolation.

11 years agodoc: debugger, dns, http: fix grammar
Benjamin Ruston [Thu, 28 Mar 2013 14:19:10 +0000 (14:19 +0000)]
doc: debugger, dns, http: fix grammar

11 years agodeps: upgrade libuv to 7514149
Ben Noordhuis [Wed, 27 Mar 2013 23:28:45 +0000 (00:28 +0100)]
deps: upgrade libuv to 7514149

11 years agotest: Accept either kind of NaN
isaacs [Wed, 27 Mar 2013 16:47:16 +0000 (09:47 -0700)]
test: Accept either kind of NaN

A llvm/clang bug on Darwin ia32 makes these tests fail 100% of
the time.  Since no one really seems to mind overly much, and we
can't reasonably fix this in node anyway, just accept both types
of NaN for now.

11 years agotls: handle errors before calling C++ methods
Fedor Indutny [Wed, 27 Mar 2013 08:18:43 +0000 (12:18 +0400)]
tls: handle errors before calling C++ methods

Calling `this.pair.encrypted._internallyPendingBytes()` before
handling/resetting error will result in assertion failure:

../src/node_crypto.cc:962: void node::crypto::Connection::ClearError():
Assertion `handle_->Get(String::New("error"))->BooleanValue() == false'
failed.

see #5058

11 years agodoc: addon: fix grammar
Benjamin Ruston [Wed, 27 Mar 2013 10:09:37 +0000 (10:09 +0000)]
doc: addon: fix grammar

11 years agoopenssl: disable HEARTBEAT TLS extension
Fedor Indutny [Tue, 26 Mar 2013 18:33:14 +0000 (22:33 +0400)]
openssl: disable HEARTBEAT TLS extension

Microsoft's IIS doesn't support it, and is not replying with ServerHello
after receiving ClientHello which contains it.

The good way might be allowing to opt-out this at runtime from
javascript-land, but unfortunately OpenSSL doesn't support it right now.

see #5119

11 years agodomain: fix domain callback from MakeCallback
Trevor Norris [Tue, 26 Mar 2013 05:32:41 +0000 (22:32 -0700)]
domain: fix domain callback from MakeCallback

Since _tickCallback and _tickDomainCallback were both called from
MakeCallback, it was possible for a callback to be called that required
a domain directly to _tickCallback.

The fix was to implement process.usingDomains(). This will set all
applicable functions to their domain counterparts, and set a flag in cc
to let MakeCallback know domain callbacks always need to be checked.

Added test in own file. It's important that the test remains isolated.

11 years agodoc: child_process: document 'error' event
Ben Noordhuis [Tue, 26 Mar 2013 15:34:42 +0000 (16:34 +0100)]
doc: child_process: document 'error' event

Fixes #5130.

11 years agodoc: fix formatting in tty.markdown
Ben Noordhuis [Tue, 26 Mar 2013 15:09:48 +0000 (16:09 +0100)]
doc: fix formatting in tty.markdown

Fixes #5135.

11 years agotest: test name is the last elem, not second
Timothy J Fontaine [Mon, 25 Mar 2013 23:16:44 +0000 (16:16 -0700)]
test: test name is the last elem, not second

When a test requires node to have parameters passed (--expose-gc) the
test name will be the last element in the command array, not the second.

11 years agochild_process: don't emit same handle twice
Ben Noordhuis [Sun, 24 Mar 2013 23:29:55 +0000 (00:29 +0100)]
child_process: don't emit same handle twice

It's possible to read multiple messages off the parent/child channel.
When that happens, make sure that recvHandle is cleared after emitting
the first message so it doesn't get emitted twice.

11 years agocrypto: make getCiphers() return non-SSL ciphers
Ben Noordhuis [Mon, 18 Mar 2013 23:16:55 +0000 (00:16 +0100)]
crypto: make getCiphers() return non-SSL ciphers

Commit f53441a added crypto.getCiphers() as a function that returns the
names of SSL ciphers.

Commit 14a6c4e then added crypto.getHashes(), which returns the names of
digest algorithms, but that creates a subtle inconsistency: the return
values of crypto.getHashes() are valid arguments to crypto.createHash()
but that is not true for crypto.getCiphers() - the returned values are
only valid for SSL/TLS functions.

Rectify that by adding tls.getCiphers() and making crypto.getCiphers()
return proper cipher names.

11 years agodoc: mention `process.*.isTTY` under `process`
Mathias Bynens [Tue, 19 Mar 2013 08:10:23 +0000 (09:10 +0100)]
doc: mention `process.*.isTTY` under `process`

11 years agochild_process: fix sending utf-8 to child process
Ben Noordhuis [Thu, 14 Mar 2013 15:59:07 +0000 (16:59 +0100)]
child_process: fix sending utf-8 to child process

In process#send() and child_process.ChildProcess#send(), use 'utf8' as
the encoding instead of 'ascii' because 'ascii' mutilates non-ASCII
input. Correctly handle partial character sequences by introducing
a StringDecoder.

Sending over UTF-8 no longer works in v0.10 because the high bit of
each byte is now cleared when converting a Buffer to ASCII. See
commit 96a314b for details.

Fixes #4999 and #5011.

11 years agobench: add child process read perf benchmark
Ben Noordhuis [Thu, 21 Mar 2013 12:12:41 +0000 (13:12 +0100)]
bench: add child process read perf benchmark

11 years agodeps: fix openssl build on windows
Ben Noordhuis [Sun, 24 Mar 2013 21:53:07 +0000 (22:53 +0100)]
deps: fix openssl build on windows

Commit 8632af3 ("tools: update gyp to r1601") broke the Windows build.

Older versions of GYP link to kernel32.lib, user32.lib, etc. but that
was changed in r1584. See https://codereview.chromium.org/12256017

Fix the build by explicitly linking to the required libraries.

11 years agostream: Fix early end in Writables on zero-length writes
isaacs [Fri, 22 Mar 2013 01:18:55 +0000 (18:18 -0700)]
stream: Fix early end in Writables on zero-length writes

Doing this causes problems:

    z.write(Buffer(0));
    z.end();

Fix by not ending Writable streams while they're still in the process of
writing something.

11 years agotools: update gyp to r1601
Ben Noordhuis [Sun, 24 Mar 2013 13:29:17 +0000 (14:29 +0100)]
tools: update gyp to r1601

Among other things, this should make it easier for people to build
node.js on openbsd.

11 years agodoc: update CONTRIBUTING.md
Ben Noordhuis [Sun, 24 Mar 2013 12:22:01 +0000 (13:22 +0100)]
doc: update CONTRIBUTING.md

* Latest stable is v0.10 now.
* Add example of what the first line of the commit log should look like.

11 years agotimer: fix off-by-one ms error
Alexey Kupershtokh [Fri, 26 Oct 2012 05:49:22 +0000 (12:49 +0700)]
timer: fix off-by-one ms error

Fix #5103

11 years agotls: remove harmful unnecessary bounds checking
Marcel Laverdet [Thu, 21 Mar 2013 21:56:02 +0000 (16:56 -0500)]
tls: remove harmful unnecessary bounds checking

The EncIn, EncOut, ClearIn & ClearOut functions are victims of some code
copy + pasting. A common line copied to all of them is:

`if (off >= buffer_length) { ...`

448e0f43 corrected ClearIn's check from `>=` to `>`, but left the others
unchanged (with an incorrect bounds check). However, if you look down at
the next very next bounds check you'll see:

`if (off + len > buffer_length) { ...`

So the check is actually obviated by the next line, and should be
removed.

This fixes an issue where writing a zero-length buffer to an encrypted
pair's *encrypted* stream you would get a crash.

11 years agov8: Unify kMaxArguments with number of bits used to encode it.
verwaest@chromium.org [Mon, 18 Mar 2013 13:35:17 +0000 (13:35 +0000)]
v8: Unify kMaxArguments with number of bits used to encode it.

Increase the number of bits by 1 by making Flags unsigned.

BUG=chromium:211741

Review URL: https://chromiumcodereview.appspot.com/12886008

This is a back-port of commits 13964 and 13988 addressing CVE-2013-2632.

11 years agocrypto: check randomBytes() size argument
Ben Noordhuis [Sat, 23 Mar 2013 14:48:56 +0000 (15:48 +0100)]
crypto: check randomBytes() size argument

Throw a TypeError if size > 0x3fffffff. Avoids the following V8 fatal
error:

  FATAL ERROR: v8::Object::SetIndexedPropertiesToExternalArrayData()
  length exceeds max acceptable value

Fixes #5126.

11 years agodoc: document that stdio is usually blocking
Ben Noordhuis [Sat, 23 Mar 2013 14:38:17 +0000 (15:38 +0100)]
doc: document that stdio is usually blocking

11 years agostream: Fix stall in Transform under very specific conditions
Gil Pedersen [Sun, 17 Mar 2013 14:04:01 +0000 (15:04 +0100)]
stream: Fix stall in Transform under very specific conditions

The stall is exposed in the test, though the test itself asserts before
it stalls.

The test is constructed to replicate the stalling state of a complex
Passthrough usecase since I was not able to reliable trigger the stall.

Some of the preconditions for triggering the stall are:
  * rs.length >= rs.highWaterMark
  * !rs.needReadable
  * _transform() handler that can return empty transforms
  * multiple sync write() calls

Combined this can trigger a case where rs.reading is not cleared when
further progress requires this. The fix is to always clear rs.reading.

11 years agotimers: handle signed int32 overflow in enroll()
Fedor Indutny [Thu, 21 Mar 2013 17:38:30 +0000 (21:38 +0400)]
timers: handle signed int32 overflow in enroll()

Before this patch calling `socket.setTimeout(0xffffffff)` will result in
signed int32 overflow in C++ which resulted in assertion error:

    Assertion failed: (timeout >= -1), function uv__io_poll, file
    ../deps/uv/src/unix/kqueue.c, line 121.

see #5101

11 years agoblog: Post for v0.10.1
isaacs [Thu, 21 Mar 2013 16:14:01 +0000 (09:14 -0700)]
blog: Post for v0.10.1

11 years agoNow working on v0.10.2
isaacs [Thu, 21 Mar 2013 16:14:23 +0000 (09:14 -0700)]
Now working on v0.10.2

11 years agoMerge branch 'v0.10.1-release' into v0.10
isaacs [Thu, 21 Mar 2013 16:13:45 +0000 (09:13 -0700)]
Merge branch 'v0.10.1-release' into v0.10

11 years agodeps: upgrade libuv to 9b61939
Ben Noordhuis [Thu, 21 Mar 2013 13:59:16 +0000 (14:59 +0100)]
deps: upgrade libuv to 9b61939

11 years ago2013.03.21, Version 0.10.1 (Stable) v0.10.1
isaacs [Thu, 21 Mar 2013 01:15:04 +0000 (18:15 -0700)]
2013.03.21, Version 0.10.1 (Stable)

* npm: upgrade to 1.2.15

* crypto: Improve performance of non-stream APIs (Fedor Indutny)

* tls: always reset this.ssl.error after handling (Fedor Indutny)

* tls: Prevent mid-stream hangs (Fedor Indutny, isaacs)

* net: improve arbitrary tcp socket support (Ben Noordhuis)

* net: handle 'finish' event only after 'connect' (Fedor Indutny)

* http: Don't hot-path end() for large buffers (isaacs)

* fs: Missing cb errors are deprecated, not a throw (isaacs)

* fs: make write/appendFileSync correctly set file mode (Raymond Feng)

* stream: Return self from readable.wrap (isaacs)

* stream: Never call decoder.end() multiple times (Gil Pedersen)

* windows: enable watching signals with process.on('SIGXYZ') (Bert Belder)

* node: revert removal of MakeCallback (Trevor Norris)

* node: Unwrap without aborting in handle fd getter (isaacs)

11 years agonpm: upgrade to 1.2.15
isaacs [Thu, 21 Mar 2013 00:49:57 +0000 (17:49 -0700)]
npm: upgrade to 1.2.15

11 years agocrypto: initialize transform lazily
Fedor Indutny [Fri, 15 Mar 2013 08:59:30 +0000 (12:59 +0400)]
crypto: initialize transform lazily

11 years agotls: Prevent hang in readStart
isaacs [Wed, 20 Mar 2013 23:14:36 +0000 (16:14 -0700)]
tls: Prevent hang in readStart

This is not a great fix, and it's a bug that's very tricky to reproduce.

Occasionally, while downloading a file, especially on Linux for some
reason, the pause/resume timing will be just right such that the
CryptoStream is in a 'reading' state, but actually has no data, so it
ought to pull more in.  Because there's no reads happening, it just sits
there, and the process will exit

This is, fundamentally, a factor of how the HTTP implementation sits
atop CryptoStreams and TCP Socket objects, which is utterly horrible,
and needs to be rewritten.  However, in the meantime, npm downloads are
prematurely exiting, causing hard-to-debug "cb() never called!" errors.

11 years agobench: compare binaries equal times
Trevor Norris [Wed, 20 Mar 2013 08:58:11 +0000 (01:58 -0700)]
bench: compare binaries equal times

The benchmark compare would drop the last run of the binary pairs. So
when they were only run once an error would arise because no data was
generated for the second binary.