platform/upstream/nodejs.git
10 years agotest: use os.EOL when checking output
Alexis Campailla [Fri, 22 Nov 2013 23:18:06 +0000 (15:18 -0800)]
test: use os.EOL when checking output

10 years agoopenssl: more asm
Fedor Indutny [Sun, 24 Nov 2013 15:13:46 +0000 (19:13 +0400)]
openssl: more asm

10 years agoMerge remote-tracking branch 'upstream/v0.10'
Timothy J Fontaine [Tue, 26 Nov 2013 16:41:09 +0000 (08:41 -0800)]
Merge remote-tracking branch 'upstream/v0.10'

10 years agoblog: npm outage postmortem
isaacs [Tue, 26 Nov 2013 15:27:59 +0000 (07:27 -0800)]
blog: npm outage postmortem

10 years agotls: add serialNumber to getPeerCertificate()
Ben Noordhuis [Mon, 25 Nov 2013 14:09:57 +0000 (15:09 +0100)]
tls: add serialNumber to getPeerCertificate()

Add a 'serialNumber' property to the object that is returned by
tls.CryptoStream#getPeerCertificate().  Contains the certificate's
serial number encoded as a hex string.  The format is identical to
`openssl x509 -serial -in path/to/certificate`.

Fixes #6583.

10 years agoutil: Format negative zero as '-0'
David Chan [Wed, 20 Nov 2013 18:10:41 +0000 (23:40 +0530)]
util: Format negative zero as '-0'

Format negative zero as '-0' instead of as '0', as it does not behave
identically to positive zero. ((-0).toString() still returns '0' as
required by ES5 9.8.1.2).

Fixes joyent/node#6548.
Closes joyent/node#6550.

10 years agov8: unbreak freebsd build
Ben Noordhuis [Sat, 23 Nov 2013 22:05:34 +0000 (23:05 +0100)]
v8: unbreak freebsd build

Pending review of https://codereview.appspot.com/31500043/

Fixes #6576.

10 years agonode: fix removing AsyncListener in callback
Vladimir Kurchatkin [Thu, 21 Nov 2013 10:04:39 +0000 (14:04 +0400)]
node: fix removing AsyncListener in callback

context._asyncQueue shouldn't be exposed as asyncQueue, as it allows
modification of queues already attached to an event. Which is not
supposed to happend. Instead context._asyncQueue should be copied.

10 years agodoc: clarify child_process error behaviour
Linus Unnebäck [Thu, 21 Nov 2013 15:39:23 +0000 (16:39 +0100)]
doc: clarify child_process error behaviour

Clarify that an 'error' event may or may not be followed by an 'exit'
event and that it's not safe to make assumptions either way.

10 years agoevents: fix TypeError in removeAllListeners
Jeremy Martin [Fri, 22 Nov 2013 14:17:16 +0000 (09:17 -0500)]
events: fix TypeError in removeAllListeners

Check that `listeners` is actually an array before trying to manipulate it
because it won't be if no regular event listeners have been registered yet
but there are 'removeListener' event listeners.

10 years agonode: allow nextTick infinite recursion
Trevor Norris [Thu, 21 Nov 2013 22:41:40 +0000 (14:41 -0800)]
node: allow nextTick infinite recursion

Removing the depth counter while processing the nextTickQueue made it
possible to run out of memory if in an infinite recursive loop using
nextTick(). There was also an edge case where too many callbacks were
pushed onto the nextTickQueue, while not actually being recursive.

This is being done to prevent possible cryptic FATAL ERROR messages from
popping up, and issues being posted about them.

10 years agoblog: Post for v0.11.9
Timothy J Fontaine [Thu, 21 Nov 2013 00:45:27 +0000 (16:45 -0800)]
blog: Post for v0.11.9

10 years agoNow working on 0.11.10
Timothy J Fontaine [Thu, 21 Nov 2013 00:40:47 +0000 (16:40 -0800)]
Now working on 0.11.10

10 years agoMerge branch 'v0.11.9-release'
Timothy J Fontaine [Thu, 21 Nov 2013 00:40:36 +0000 (16:40 -0800)]
Merge branch 'v0.11.9-release'

10 years ago2013.11.20, Version 0.11.9 (Unstable) v0.11.9
Timothy J Fontaine [Thu, 21 Nov 2013 00:03:31 +0000 (16:03 -0800)]
2013.11.20, Version 0.11.9 (Unstable)

* uv: upgrade to v0.11.15 (Timothy J Fontaine)

* v8: upgrade to 3.22.24.5 (Timothy J Fontaine)

* buffer: remove warning when no encoding is passed (Trevor Norris)

* build: make v8 use random seed for hash tables (Ben Noordhuis)

* crypto: build with shared openssl without NPN (Ben Noordhuis)

* crypto: update root certificates (Ben Noordhuis)

* debugger: pass on v8 debug switches (Ben Noordhuis)

* domain: use AsyncListener API (Trevor Norris)

* fs: add recursive subdirectory support to fs.watch (Nick Simmons)

* fs: make fs.watch() non-recursive by default (Ben Noordhuis)

* http: cleanup freeSockets when socket destroyed (fengmk2)

* http: force socket encoding to be null (isaacs)

* http: make DELETE requests set `req.method` (Nathan Rajlich)

* node: add AsyncListener support (Trevor Norris)

* src: remove global HandleScope that hid memory leaks (Ben Noordhuis)

* tls: add ECDH ciphers support (Erik Dubbelboer)

* tls: do not default to 'localhost' servername (Fedor Indutny)

* tls: more accurate wrapping of connecting socket (Fedor Indutny)

10 years agoMerge remote-tracking branch 'upstream/v0.10'
Timothy J Fontaine [Wed, 20 Nov 2013 23:45:50 +0000 (15:45 -0800)]
Merge remote-tracking branch 'upstream/v0.10'

Conflicts:
lib/events.js
src/udp_wrap.cc

10 years agonpm: Upgrade to v1.3.15
isaacs [Wed, 20 Nov 2013 19:08:52 +0000 (11:08 -0800)]
npm: Upgrade to v1.3.15

10 years agochild_process: deliver ENOENT on nextTick
Timothy J Fontaine [Wed, 20 Nov 2013 16:49:40 +0000 (08:49 -0800)]
child_process: deliver ENOENT on nextTick

After the uv upgrade, uv_spawn will now fail faster for certain
failures like ENOENT. However, our tests and other people may be
depending on that error being passed to the callback instead of a
throw.

10 years agouv: upgrade to v0.11.15
Timothy J Fontaine [Wed, 20 Nov 2013 16:25:24 +0000 (08:25 -0800)]
uv: upgrade to v0.11.15

10 years agoasyncwrap: add missing TryCatch
Trevor Norris [Wed, 20 Nov 2013 00:03:11 +0000 (16:03 -0800)]
asyncwrap: add missing TryCatch

The TryCatch was not being checked after calling the unload asyncQueue
callback in AsyncWrap::MakeCallback.

10 years agosrc: add ASSERT/CHECK/UNREACHABLE macros
Ben Noordhuis [Thu, 14 Nov 2013 00:48:19 +0000 (01:48 +0100)]
src: add ASSERT/CHECK/UNREACHABLE macros

10 years agosrc: make queue.h c++ compatible
Ben Noordhuis [Wed, 13 Nov 2013 23:58:18 +0000 (00:58 +0100)]
src: make queue.h c++ compatible

This is a cherry-pick of commit joyent/libuv@0520464.

10 years agocrypto: `randomBytes` is non-blocking
Fedor Indutny [Sat, 19 Oct 2013 10:38:58 +0000 (14:38 +0400)]
crypto: `randomBytes` is non-blocking

Add NOTE section in documentation, mentioning that `randomBytes` won't
block when entropy sources are drained.

fix #6372

10 years agoevents: do not accept NaN in setMaxListeners
Fedor Indutny [Tue, 19 Nov 2013 06:58:23 +0000 (10:58 +0400)]
events: do not accept NaN in setMaxListeners

10 years agonet: fix `new net.Socket` documentation
Fedor Indutny [Tue, 19 Nov 2013 07:02:26 +0000 (11:02 +0400)]
net: fix `new net.Socket` documentation

`Socket` no longer accepts `type` option, and also accepts `readable`,
`writable` options.

fix #6541

10 years agodgram: fix abort when getting `fd` of closed dgram
Fedor Indutny [Tue, 19 Nov 2013 07:38:48 +0000 (11:38 +0400)]
dgram: fix abort when getting `fd` of closed dgram

v8's `messages.js` file's `CallSiteGetMethodName` is running through all
object properties and getter to figure out method name of function that
appears in stack trace. This run-through will also read `fd` property of
`UDPWrap` instance's javascript object, making `UNWRAP()` fail.

As a simple alternative to the test case above, one could just keep
reference to the dgram handle and try accessing `handle.fd` after it has
been fully closed.

fix #6536

10 years agov8: upgrade to 3.22.24.5
Timothy J Fontaine [Mon, 18 Nov 2013 23:01:38 +0000 (15:01 -0800)]
v8: upgrade to 3.22.24.5

10 years agoMerge remote-tracking branch 'upstream/v0.10'
Timothy J Fontaine [Mon, 18 Nov 2013 21:41:17 +0000 (13:41 -0800)]
Merge remote-tracking branch 'upstream/v0.10'

Conflicts:
AUTHORS
ChangeLog
deps/uv/AUTHORS
deps/uv/ChangeLog
deps/uv/README.md
deps/uv/build.mk
deps/uv/src/unix/core.c
deps/uv/src/unix/darwin-proctitle.c
deps/uv/src/unix/darwin.c
deps/uv/src/unix/fsevents.c
deps/uv/src/unix/udp.c
deps/uv/src/version.c
deps/v8/src/platform-solaris.cc
deps/v8/test/cctest/test-api.cc
lib/tls.js
src/node.h
src/node_version.h

10 years agodebugger: pass on v8 debug switches
Ben Noordhuis [Sat, 16 Nov 2013 13:39:41 +0000 (14:39 +0100)]
debugger: pass on v8 debug switches

Before this commit, passing --debugger and other V8 debug switches to
node.js made node print a usage message and exit.

Rewrite the debug argument parser so it only consumes switches that we
understand and pass everything else as-is to V8.

A side effect of this change is that switches like --debugger_agent and
--debugger_port now work.  That kind of obsoletes our debugger switches
because they implement pretty much the same functionality but let's
leave them in for now for the sake of convenience and backwards
compatibility.

Fixes #6526.

10 years agobuffer: convert values to uint, not int
Trevor Norris [Thu, 14 Nov 2013 23:40:56 +0000 (15:40 -0800)]
buffer: convert values to uint, not int

In many cases values expected to be unsigned were converted to a signed
integer.

Also include some small code cleanup.

10 years agosrc: make buffer size errors more explicit
Trevor Norris [Thu, 14 Nov 2013 01:19:53 +0000 (17:19 -0800)]
src: make buffer size errors more explicit

Fixes #6490

10 years agobuffer: no warning when encoding isn't passed
Trevor Norris [Thu, 14 Nov 2013 00:27:20 +0000 (16:27 -0800)]
buffer: no warning when encoding isn't passed

Buffer#write() was showing the deprecation warning when only
buf.write('string') was passed. This is incorrect since the encoding is
always optional.

Argument order should follow:
  Buffer#write(string[, offset[, length]][, encoding])

(yeah, not confusing at all)

10 years agodoc: add nodejs.vn to community page
Ben Noordhuis [Fri, 15 Nov 2013 15:27:22 +0000 (16:27 +0100)]
doc: add nodejs.vn to community page

Node.js.  It's not just for SF hipsters anymore.

10 years agodoc: sort community page links alphabetically
Ben Noordhuis [Fri, 15 Nov 2013 15:24:46 +0000 (16:24 +0100)]
doc: sort community page links alphabetically

This commit introduces some long lines but it's HTML so it's okay.

10 years agosrc: remove unused import in cares_wrap.cc
Ben Noordhuis [Thu, 14 Nov 2013 00:59:01 +0000 (01:59 +0100)]
src: remove unused import in cares_wrap.cc

10 years agodoc: fix few smalloc entries for proper formatting
Trevor Norris [Wed, 13 Nov 2013 23:14:34 +0000 (15:14 -0800)]
doc: fix few smalloc entries for proper formatting

10 years agosmalloc: check if object has external memory
Trevor Norris [Wed, 13 Nov 2013 22:51:32 +0000 (14:51 -0800)]
smalloc: check if object has external memory

Add HasExternalData API to check if Object has externally allocated
memory, and accompanying tests.

10 years agotls: handle `ssl.start()` errors
Fedor Indutny [Wed, 13 Nov 2013 12:58:46 +0000 (16:58 +0400)]
tls: handle `ssl.start()` errors

10 years agoevents: don't call once twice
Tim Wood [Tue, 12 Nov 2013 20:19:13 +0000 (12:19 -0800)]
events: don't call once twice

Emitting an event within a `EventEmitter#once` callback of the same
event name will cause subsequent `EventEmitter#once` listeners of the
same name to be called multiple times.

    var emitter = new EventEmitter();

    emitter.once('e', function() {
      emitter.emit('e');
      console.log(1);
    });

    emitter.once('e', function() {
      console.log(2);
    });

    emitter.emit('e');

    // Output
    // 2
    // 1
    // 2

Fix the issue, by calling the listener method only if it was not
already called.

10 years agosrc: add comments about implicit dependencies
Trevor Norris [Tue, 5 Nov 2013 00:24:36 +0000 (16:24 -0800)]
src: add comments about implicit dependencies

10 years agobase-object: add BaseObject
Trevor Norris [Mon, 4 Nov 2013 18:49:55 +0000 (10:49 -0800)]
base-object: add BaseObject

BaseObject is a class that just handles the Persistent handle attached
to the class instance.

This also removed WeakObject. Reordering the inheritance chain helps
prevent unneeded calls on instances that don't call MakeCallback.

10 years agoasync-wrap: make typenames consistent
Trevor Norris [Fri, 1 Nov 2013 21:45:46 +0000 (14:45 -0700)]
async-wrap: make typenames consistent

10 years agotls_wrap: move members to initialization list
Trevor Norris [Tue, 5 Nov 2013 19:56:13 +0000 (11:56 -0800)]
tls_wrap: move members to initialization list

They didn't need to be defined in the body of the constructor.

10 years agosrc: use Context::Scope objects in cares_wrap.cc
Ben Noordhuis [Mon, 11 Nov 2013 10:31:36 +0000 (11:31 +0100)]
src: use Context::Scope objects in cares_wrap.cc

Enter the context explicitly, don't rely on the fact that there is a
Context::Scope a few stack frames below because it may be gone someday

10 years agosrc: fix Context::Scope usage
Ben Noordhuis [Mon, 11 Nov 2013 09:53:00 +0000 (10:53 +0100)]
src: fix Context::Scope usage

env->context() may or may not create a new Local.  It currently does
not but don't depend on that behavior, create a HandleScope first.

10 years agocrypto: fix up implicit HandleScope abuse
Ben Noordhuis [Mon, 11 Nov 2013 09:34:16 +0000 (10:34 +0100)]
crypto: fix up implicit HandleScope abuse

Don't depend on any HandleScope objects that may or may not have been
created in src/stream_wrap.cc, create them explicitly.

10 years agosrc: remove global HandleScope
Ben Noordhuis [Mon, 11 Nov 2013 20:03:08 +0000 (21:03 +0100)]
src: remove global HandleScope

Make it more difficult to accidentally leak handles by removing the
top-level HandleScope.  Now if there's no valid HandleScope now, V8
will complain and, in debug builds, abort.

10 years agoblog: Post for v0.10.22
Timothy J Fontaine [Tue, 12 Nov 2013 20:53:45 +0000 (12:53 -0800)]
blog: Post for v0.10.22

10 years agoNow working on 0.10.23
Timothy J Fontaine [Tue, 12 Nov 2013 20:53:45 +0000 (12:53 -0800)]
Now working on 0.10.23

10 years agoMerge branch 'v0.10.22-release' into v0.10
Timothy J Fontaine [Tue, 12 Nov 2013 20:53:28 +0000 (12:53 -0800)]
Merge branch 'v0.10.22-release' into v0.10

10 years ago2013.11.12, Version 0.10.22 (Stable) v0.10.22
Timothy J Fontaine [Tue, 12 Nov 2013 20:22:12 +0000 (12:22 -0800)]
2013.11.12, Version 0.10.22 (Stable)

* npm: Upgrade to 1.3.14

* uv: Upgrade to v0.10.19

* child_process: don't assert on stale file descriptor events (Fedor Indutny)

* darwin: Fix "Not Responding" in Mavericks activity monitor (Fedor Indutny)

* debugger: Fix bug in sb() with unnamed script (Maxim Bogushevich)

* repl: do not insert duplicates into completions (Maciej Małecki)

* src: Fix memory leak on closed handles (Timothy J Fontaine)

* tls: prevent stalls by using read(0) (Fedor Indutny)

* v8: use correct timezone information on Solaris (Maciej Małecki)

10 years agosrc: add HandleScope in HandleWrap::OnClose
Timothy J Fontaine [Tue, 12 Nov 2013 19:23:19 +0000 (11:23 -0800)]
src: add HandleScope in HandleWrap::OnClose

Fixes a 4 byte leak on handles closing. AKA The Walmart leak.

MakeCallback doesn't have a HandleScope. That means the callers scope
will retain ownership of created handles from MakeCallback and related.
There is by default a wrapping HandleScope before uv_run, if the caller
doesn't have a HandleScope on the stack the global will take ownership
which won't be reaped until the uv loop exits.

If a uv callback is fired, and there is no enclosing HandleScope in the
cb, you will appear to leak 4-bytes for every invocation. Take heed.

cc @hueniverse

10 years agouv: Upgrade to v0.10.19
Timothy J Fontaine [Tue, 12 Nov 2013 18:57:57 +0000 (10:57 -0800)]
uv: Upgrade to v0.10.19

10 years agov8: use correct timezone information on Solaris
yangguo@chromium.org [Tue, 23 Oct 2012 13:04:05 +0000 (13:04 +0000)]
v8: use correct timezone information on Solaris

`timezone` variable contains the difference, in seconds, between UTC and
local standard time (see `man 3 localtime` on Solaris).

Call to `tzset` is required to apply contents of `TZ` variable to
`timezone` variable.

BUG=v8:2064

Review URL: https://chromiumcodereview.appspot.com/10967066
Patch from Maciej Małecki <me@mmalecki.com>.

This is a back-port of upstream commit r12802 and a forward port of
commit 9fa953d from the v0.8 branch.  V8 3.22 in the master branch
contains the patch so no further forward-porting is necessary.

10 years agorepl: do not insert duplicates into completions
Maciej Małecki [Mon, 11 Nov 2013 23:03:29 +0000 (00:03 +0100)]
repl: do not insert duplicates into completions

Fix invalid `hasOwnProperty` function usage.

For example, before in the REPL:

```
> Ar<Tab>
Array

Array        ArrayBuffer
```

Now:

```
> Ar<Tab>
Array

ArrayBuffer
```

Fixes #6255.
Closes #6498.

10 years agosrc: fix Environment::GetCurrent() usage
Ben Noordhuis [Mon, 11 Nov 2013 21:02:03 +0000 (22:02 +0100)]
src: fix Environment::GetCurrent() usage

Create a HandleScope before calling the Environment::GetCurrent() that
takes a v8::Isolate* as an argument because it creates a handle with
the call to v8::Isolate::CurrentContext().

10 years agonode: add HandleScope to prevent memory leak
Trevor Norris [Mon, 11 Nov 2013 19:24:31 +0000 (11:24 -0800)]
node: add HandleScope to prevent memory leak

MakeCallback can only be called from a valid v8::HandleScope.

Fixed #6487

10 years agov8: upgrade to 3.22.24
Ben Noordhuis [Sun, 10 Nov 2013 01:02:27 +0000 (02:02 +0100)]
v8: upgrade to 3.22.24

This commit removes the simple/test-event-emitter-memory-leak test for
being unreliable with the new garbage collector: the memory pressure
exerted by the test case is too low for the garbage collector to kick
in.  It can be made to work again by limiting the heap size with the
--max_old_space_size=x flag but that won't be very reliable across
platforms and architectures.

10 years agogyp: update to bebdcea
Timothy J Fontaine [Sun, 10 Nov 2013 23:15:34 +0000 (15:15 -0800)]
gyp: update to bebdcea

10 years agocrypto: update root certificates
Ben Noordhuis [Sat, 9 Nov 2013 22:46:05 +0000 (23:46 +0100)]
crypto: update root certificates

Update the list of root certificates in src/node_root_certs.h with
tools/mk-ca-bundle.pl and update src/node_crypto.cc to make use of
the new format.

Fixes #6013.

10 years agotools: check in certdata.txt from mozilla NSS
Ben Noordhuis [Sat, 9 Nov 2013 22:32:12 +0000 (23:32 +0100)]
tools: check in certdata.txt from mozilla NSS

This is a file from the NSS project containing root certificate data.
It can be downloaded from:

  https://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1

Once downloaded, running `perl tools/mk-ca-bundle.pl` will update
src/node_root_certs.h.  Commit, rebuild and go.

10 years agotools: customize mk-ca-bundle.pl
Ben Noordhuis [Sat, 9 Nov 2013 22:31:54 +0000 (23:31 +0100)]
tools: customize mk-ca-bundle.pl

Remove unneeded functionality and tweak the generated output so we
can #include it in C++ source code.

10 years agotools: bundle mk-ca-bundle.pl from upstream curl
Ben Noordhuis [Sat, 9 Nov 2013 22:01:26 +0000 (23:01 +0100)]
tools: bundle mk-ca-bundle.pl from upstream curl

10 years agov8: unbreak `make native` build
Ben Noordhuis [Sat, 9 Nov 2013 21:24:22 +0000 (22:24 +0100)]
v8: unbreak `make native` build

The security fix from commit 6b92a713 also back-ported the test case.
Said test case relies on API that is only available in newer versions
of V8 and, as a result, broke the `make native` and `make <arch.mode>`
builds.  This commit reverts that part of the back-port.  Fixes the
following build error:

  ../test/cctest/test-api.cc: In function ‘void TestRegress260106()’:
  ../test/cctest/test-api.cc:17712:34: error: ‘class v8::Context’ has
  no member named ‘GetIsolate’

10 years agotls: prevent stalls by using read(0)
Fedor Indutny [Thu, 7 Nov 2013 21:22:02 +0000 (01:22 +0400)]
tls: prevent stalls by using read(0)

Do not `.push()` the same data as just passed to `.ondata()`, it
may be read by 'data' event listeners.

fix #6277

10 years agoMerge remote-tracking branch 'ry/v0.10'
isaacs [Fri, 8 Nov 2013 21:41:44 +0000 (13:41 -0800)]
Merge remote-tracking branch 'ry/v0.10'

10 years agonpm: Upgrade to 1.3.14
isaacs [Fri, 8 Nov 2013 21:41:21 +0000 (13:41 -0800)]
npm: Upgrade to 1.3.14

10 years agobuild: make v8 use random seed for hash tables
Ben Noordhuis [Fri, 8 Nov 2013 21:23:59 +0000 (22:23 +0100)]
build: make v8 use random seed for hash tables

Upstream V8 as of commit v8/v8@4bc70e8 uses a fixed seed of 314159265
for hash tables unless instructed otherwise.  Tell V8 to keep using a
random seed.

10 years agosrc: remove container_of, use CONTAINER_OF
Ben Noordhuis [Fri, 8 Nov 2013 20:44:32 +0000 (21:44 +0100)]
src: remove container_of, use CONTAINER_OF

CONTAINER_OF was introduced a while ago but was not used consistently
everywhere yet.  This commit fixes that.

Why CONTAINER_OF instead of container_of?  The former makes it crystal
clear that it's a macro, not a function.

10 years agocrypto: unbreak build with no-NPN shared openssl
Ben Noordhuis [Fri, 8 Nov 2013 16:47:39 +0000 (17:47 +0100)]
crypto: unbreak build with no-NPN shared openssl

Unbreak the build when linking against a shared version of OpenSSL that
doesn't support NPN (Next Protocol Negotiation.)

Fixes the following build error:

  ../src/node_crypto.cc:140: error: no member function
  'AdvertiseNextProtoCallback' declared in
  'node::crypto::SSLWrap<node::TLSCallbacks>'
  ../src/node_crypto.cc:147: error: no member function
  'SelectNextProtoCallback' declared in
  'node::crypto::SSLWrap<node::TLSCallbacks>'

10 years agocrypto: try moving read head in Peek()
Fedor Indutny [Thu, 15 Aug 2013 21:30:47 +0000 (01:30 +0400)]
crypto: try moving read head in Peek()

Otherwise it might get stall (`Peek()` will return zero-length chunk)
in following situation:

1. `Write(kBufferLength)`
2. `Read(kBufferLength)`
3. `Write(anything)`
4. `Peek()` => `len=0`

10 years agodoc: encoding is ignored if input is a Buffer
Fedor Indutny [Mon, 21 Oct 2013 12:26:29 +0000 (16:26 +0400)]
doc: encoding is ignored if input is a Buffer

NOTE: it wasn't in 0.8

fixes #6386

10 years agohttp: force socket encoding to be null
isaacs [Sun, 3 Nov 2013 22:32:03 +0000 (14:32 -0800)]
http: force socket encoding to be null

Otherwise the string triggers an assertion error in node_http_parser.c,
line 370:

    assert(Buffer::HasInstance(args[0]) == true);

because the first argument is not a Buffer object.

10 years agodoc: cluster: bump stability level to 'unstable'
Ben Noordhuis [Thu, 7 Nov 2013 11:34:22 +0000 (12:34 +0100)]
doc: cluster: bump stability level to 'unstable'

As discussed on the mailing list: the module will not go away but the
API will continue to receive updates as the need arises.

Link: https://groups.google.com/forum/#!topic/nodejs/uqyTcQfimAI
Message-ID: <7384b30e-b64c-4086-b78f-b5acca9842a9@googlegroups.com>

10 years agohttp: cleanup freeSockets when socket destroyed
fengmk2 [Wed, 6 Nov 2013 11:58:03 +0000 (19:58 +0800)]
http: cleanup freeSockets when socket destroyed

If the socket was destroyed, we need to remove it from the agent's
`freeSockets` list, otherwise dead socket could be reused by new
request.

10 years agobenchmark: Correct the bufferSize to highWaterMark
Jackson Tian [Sun, 1 Sep 2013 17:41:00 +0000 (01:41 +0800)]
benchmark: Correct the bufferSize to highWaterMark

  The bufferSize has been removed. Use highWaterMark instead of.

10 years agotls: more accurate wrapping of connecting socket
Fedor Indutny [Tue, 5 Nov 2013 14:14:28 +0000 (18:14 +0400)]
tls: more accurate wrapping of connecting socket

When socket, passed in `tls.connect()` `options` argument is not yet
connected to the server, `_handle` gets assigned to a `net.Socket`,
instead of `TLSSocket`.

When socket is connecting to the remote server (i.e. not yet connected,
but already past dns resolve phase), derive `_connecting` property from
it, because otherwise `afterConnect()` will throw an assertion.

fix #6443

10 years agofs: make fs.watch() non-recursive by default
Ben Noordhuis [Tue, 5 Nov 2013 07:23:58 +0000 (08:23 +0100)]
fs: make fs.watch() non-recursive by default

Fixes a behavioral regression introduced in commit 691b9eb.

10 years agosrc: fix whitespace/braces lint error from 962686b
Ben Noordhuis [Mon, 4 Nov 2013 21:42:48 +0000 (22:42 +0100)]
src: fix whitespace/braces lint error from 962686b

Silly warning.  One day I'll probably remove it altogether, see if I
don't.

10 years agohttp: make DELETE requests set `req.method`
Nathan Rajlich [Mon, 4 Nov 2013 17:39:29 +0000 (09:39 -0800)]
http: make DELETE requests set `req.method`

Fixes #6461.

10 years agosrc: squelch unused variable warning
Ben Noordhuis [Sun, 3 Nov 2013 20:00:37 +0000 (21:00 +0100)]
src: squelch unused variable warning

|i| and |j| arent't used when building without crypto support.  Hat tip
to Brian White.

Rename |l| to |k| while we're here because it's quite hard to discern
from |i| or |j| with some fonts.

10 years agodoc: Correct and add several items
isaacs [Thu, 31 Oct 2013 20:35:54 +0000 (13:35 -0700)]
doc: Correct and add several items

Several names/urls were out of date, and some really
awesome stuff was missing.

10 years agodoc: document node signal handling
Sam Roberts [Wed, 30 Oct 2013 23:19:17 +0000 (16:19 -0700)]
doc: document node signal handling

Partly lifted from uv.h, partly from observation of node.cc.

10 years agoblog: Post for v0.11.8
Timothy J Fontaine [Wed, 30 Oct 2013 16:09:04 +0000 (09:09 -0700)]
blog: Post for v0.11.8

10 years agotls: add ECDH ciphers support
Erik Dubbelboer [Mon, 14 Oct 2013 14:53:59 +0000 (16:53 +0200)]
tls: add ECDH ciphers support

Switch test fixtures to 1024 bit keys.

10 years agotest: fix async listener test for windows
Trevor Norris [Fri, 1 Nov 2013 20:57:09 +0000 (13:57 -0700)]
test: fix async listener test for windows

10 years agobenchmark: add http chunked encoding benchmarks
Ben Noordhuis [Fri, 1 Nov 2013 14:44:43 +0000 (15:44 +0100)]
benchmark: add http chunked encoding benchmarks

Test both "Content-Length: xxx" and "Transfer-Encoding: chunked" responses in
the http/simple benchmark.

10 years agodoc: add docs for AsyncListeners
Trevor Norris [Wed, 30 Oct 2013 00:05:40 +0000 (17:05 -0700)]
doc: add docs for AsyncListeners

Documentation has been added on how to use the AsyncListener API.

10 years agotest: add additional async listener tests
Jacob Groundwater [Tue, 15 Oct 2013 20:50:00 +0000 (13:50 -0700)]
test: add additional async listener tests

10 years agodomain: use AsyncListener API
Trevor Norris [Tue, 29 Oct 2013 23:35:32 +0000 (16:35 -0700)]
domain: use AsyncListener API

The domain module has been switched over to use the domain module API as
much as currently possible. There are still some hooks in the
EventEmitter, but hopefully we can remove those in the future.

10 years agocares: add AsyncListener support
Trevor Norris [Sat, 28 Sep 2013 00:04:30 +0000 (17:04 -0700)]
cares: add AsyncListener support

10 years agocrypto: convert pbkdf2_req to a class
Trevor Norris [Tue, 1 Oct 2013 00:24:41 +0000 (17:24 -0700)]
crypto: convert pbkdf2_req to a class

pbkdf2_req has been renamed to PBKDF2Request and converted to a class.
It now uses AsyncWrap::MakeCallback.

Also includes, using env()->ondone_string() instead of "ondone" and
using malloc instead of new char[].

10 years agocrypto: convert RandomBytesRequest to a class
Trevor Norris [Sun, 29 Sep 2013 06:33:29 +0000 (23:33 -0700)]
crypto: convert RandomBytesRequest to a class

Since RandomBytesRequest makes a call to MakeCallback, needed it to be
a class so AsyncWrap could handle any async listeners.

Also added a simple test for an issue had during implementation where
the memory was being released and returned.

10 years agoasync-wrap: add methods to udp/tcp/pipe/timers
Trevor Norris [Mon, 7 Oct 2013 19:39:52 +0000 (12:39 -0700)]
async-wrap: add methods to udp/tcp/pipe/timers

Now it's possible to add/remove an async listener to an individual
handle created by UDP, TCP, Pipe or Timer.

10 years agoasync-wrap: integrate with WeakObject
Trevor Norris [Fri, 27 Sep 2013 17:30:02 +0000 (10:30 -0700)]
async-wrap: integrate with WeakObject

Making WeakObject inherit from AsyncWrap allows us to peak into almost
all the MakeCallback calls in Node internals.

10 years agonode: add AsyncListener support
Trevor Norris [Tue, 24 Sep 2013 21:12:11 +0000 (14:12 -0700)]
node: add AsyncListener support

AsyncListener is a JS API that works in tandem with the AsyncWrap class
to allow the user to be alerted to key events in the life cycle of an
asynchronous event. The AsyncWrap class has its own MakeCallback
implementation that core will be migrated to use, and uses state sharing
techniques to allow quicker communication between JS and C++ whether the
async event callbacks need to be called.

10 years agotest: fix tls-client-reject after ba7c9ce96
Fedor Indutny [Thu, 31 Oct 2013 19:39:43 +0000 (23:39 +0400)]
test: fix tls-client-reject after ba7c9ce96

10 years agobuild: use zero overhead systemtap probes
Ben Noordhuis [Mon, 28 Oct 2013 19:18:59 +0000 (20:18 +0100)]
build: use zero overhead systemtap probes

Profiling suggested that on Linux sometimes over 10% of CPU time was
being spent inside the systemtap probe entry points in the binding
layer, even when the process was not actively being traced with the
`stap` tool.

That's why this commit makes it possible to use the *_ENABLED() macros
and bail out early when we're not being traced, reducing the overhead
of unused probes to (almost) zero.

Said macros were already being generated by `dtrace -h` but were not
usable because they rely on external definitions.  To remedy that, we
now generate the accompanying object files with `dtrace -G`.

This commit includes a change to libuv that has been landed upstream in
commit joyent/libuv@3c172ea.

10 years agotls: do not default to 'localhost' servername
Fedor Indutny [Mon, 28 Oct 2013 12:10:10 +0000 (16:10 +0400)]
tls: do not default to 'localhost' servername

10 years agotls: reuse hostname from underlying net.Socket
Fedor Indutny [Mon, 28 Oct 2013 10:25:27 +0000 (14:25 +0400)]
tls: reuse hostname from underlying net.Socket

When `tls.connect()` is called with `socket` option, it should try to
reuse hostname previously passed to `net.connect()` and only after that
fall back to `'localhost'`.

fix #6409