platform/upstream/nodejs.git
11 years agoMerge remote-tracking branch 'upstream/v0.10'
Timothy J Fontaine [Fri, 12 Jul 2013 20:26:56 +0000 (13:26 -0700)]
Merge remote-tracking branch 'upstream/v0.10'

Conflicts:
AUTHORS
ChangeLog
deps/npm/Makefile
deps/npm/doc/api/npm-commands.md
deps/npm/doc/api/npm-deprecate.md
deps/npm/doc/api/npm-init.md
deps/npm/doc/api/npm-owner.md
deps/npm/doc/api/npm-publish.md
deps/npm/doc/api/npm-run-script.md
deps/npm/doc/cli/npm-adduser.md
deps/npm/doc/cli/npm-bin.md
deps/npm/doc/cli/npm-bugs.md
deps/npm/doc/cli/npm-build.md
deps/npm/doc/cli/npm-cache.md
deps/npm/doc/cli/npm-completion.md
deps/npm/doc/cli/npm-deprecate.md
deps/npm/doc/cli/npm-docs.md
deps/npm/doc/cli/npm-edit.md
deps/npm/doc/cli/npm-explore.md
deps/npm/doc/cli/npm-help-search.md
deps/npm/doc/cli/npm-help.md
deps/npm/doc/cli/npm-init.md
deps/npm/doc/cli/npm-install.md
deps/npm/doc/cli/npm-link.md
deps/npm/doc/cli/npm-ls.md
deps/npm/doc/cli/npm-outdated.md
deps/npm/doc/cli/npm-owner.md
deps/npm/doc/cli/npm-pack.md
deps/npm/doc/cli/npm-prefix.md
deps/npm/doc/cli/npm-prune.md
deps/npm/doc/cli/npm-publish.md
deps/npm/doc/cli/npm-restart.md
deps/npm/doc/cli/npm-rm.md
deps/npm/doc/cli/npm-root.md
deps/npm/doc/cli/npm-run-script.md
deps/npm/doc/cli/npm-search.md
deps/npm/doc/cli/npm-shrinkwrap.md
deps/npm/doc/cli/npm-start.md
deps/npm/doc/cli/npm-stop.md
deps/npm/doc/cli/npm-submodule.md
deps/npm/doc/cli/npm-tag.md
deps/npm/doc/cli/npm-test.md
deps/npm/doc/cli/npm-uninstall.md
deps/npm/doc/cli/npm-unpublish.md
deps/npm/doc/cli/npm-update.md
deps/npm/doc/cli/npm-version.md
deps/npm/doc/cli/npm-view.md
deps/npm/doc/cli/npm-whoami.md
deps/npm/doc/files/npm-folders.md
deps/npm/doc/files/package.json.md
deps/npm/doc/misc/npm-coding-style.md
deps/npm/doc/misc/npm-config.md
deps/npm/doc/misc/npm-developers.md
deps/npm/doc/misc/npm-disputes.md
deps/npm/doc/misc/npm-faq.md
deps/npm/doc/misc/npm-registry.md
deps/npm/doc/misc/npm-scripts.md
deps/npm/doc/misc/semver.md
deps/npm/html/doc/README.html
deps/npm/html/doc/api/npm-bin.html
deps/npm/html/doc/api/npm-bugs.html
deps/npm/html/doc/api/npm-commands.html
deps/npm/html/doc/api/npm-config.html
deps/npm/html/doc/api/npm-deprecate.html
deps/npm/html/doc/api/npm-docs.html
deps/npm/html/doc/api/npm-edit.html
deps/npm/html/doc/api/npm-explore.html
deps/npm/html/doc/api/npm-help-search.html
deps/npm/html/doc/api/npm-init.html
deps/npm/html/doc/api/npm-install.html
deps/npm/html/doc/api/npm-link.html
deps/npm/html/doc/api/npm-load.html
deps/npm/html/doc/api/npm-ls.html
deps/npm/html/doc/api/npm-outdated.html
deps/npm/html/doc/api/npm-owner.html
deps/npm/html/doc/api/npm-pack.html
deps/npm/html/doc/api/npm-prefix.html
deps/npm/html/doc/api/npm-prune.html
deps/npm/html/doc/api/npm-publish.html
deps/npm/html/doc/api/npm-rebuild.html
deps/npm/html/doc/api/npm-restart.html
deps/npm/html/doc/api/npm-root.html
deps/npm/html/doc/api/npm-run-script.html
deps/npm/html/doc/api/npm-search.html
deps/npm/html/doc/api/npm-shrinkwrap.html
deps/npm/html/doc/api/npm-start.html
deps/npm/html/doc/api/npm-stop.html
deps/npm/html/doc/api/npm-submodule.html
deps/npm/html/doc/api/npm-tag.html
deps/npm/html/doc/api/npm-test.html
deps/npm/html/doc/api/npm-uninstall.html
deps/npm/html/doc/api/npm-unpublish.html
deps/npm/html/doc/api/npm-update.html
deps/npm/html/doc/api/npm-version.html
deps/npm/html/doc/api/npm-view.html
deps/npm/html/doc/api/npm-whoami.html
deps/npm/html/doc/api/npm.html
deps/npm/html/doc/cli/npm-adduser.html
deps/npm/html/doc/cli/npm-bin.html
deps/npm/html/doc/cli/npm-bugs.html
deps/npm/html/doc/cli/npm-build.html
deps/npm/html/doc/cli/npm-bundle.html
deps/npm/html/doc/cli/npm-cache.html
deps/npm/html/doc/cli/npm-completion.html
deps/npm/html/doc/cli/npm-config.html
deps/npm/html/doc/cli/npm-dedupe.html
deps/npm/html/doc/cli/npm-deprecate.html
deps/npm/html/doc/cli/npm-docs.html
deps/npm/html/doc/cli/npm-edit.html
deps/npm/html/doc/cli/npm-explore.html
deps/npm/html/doc/cli/npm-help-search.html
deps/npm/html/doc/cli/npm-help.html
deps/npm/html/doc/cli/npm-init.html
deps/npm/html/doc/cli/npm-install.html
deps/npm/html/doc/cli/npm-link.html
deps/npm/html/doc/cli/npm-ls.html
deps/npm/html/doc/cli/npm-outdated.html
deps/npm/html/doc/cli/npm-owner.html
deps/npm/html/doc/cli/npm-pack.html
deps/npm/html/doc/cli/npm-prefix.html
deps/npm/html/doc/cli/npm-prune.html
deps/npm/html/doc/cli/npm-publish.html
deps/npm/html/doc/cli/npm-rebuild.html
deps/npm/html/doc/cli/npm-restart.html
deps/npm/html/doc/cli/npm-rm.html
deps/npm/html/doc/cli/npm-root.html
deps/npm/html/doc/cli/npm-run-script.html
deps/npm/html/doc/cli/npm-search.html
deps/npm/html/doc/cli/npm-shrinkwrap.html
deps/npm/html/doc/cli/npm-star.html
deps/npm/html/doc/cli/npm-stars.html
deps/npm/html/doc/cli/npm-start.html
deps/npm/html/doc/cli/npm-stop.html
deps/npm/html/doc/cli/npm-submodule.html
deps/npm/html/doc/cli/npm-tag.html
deps/npm/html/doc/cli/npm-test.html
deps/npm/html/doc/cli/npm-uninstall.html
deps/npm/html/doc/cli/npm-unpublish.html
deps/npm/html/doc/cli/npm-update.html
deps/npm/html/doc/cli/npm-version.html
deps/npm/html/doc/cli/npm-view.html
deps/npm/html/doc/cli/npm-whoami.html
deps/npm/html/doc/cli/npm.html
deps/npm/html/doc/files/npm-folders.html
deps/npm/html/doc/files/npm-global.html
deps/npm/html/doc/files/npm-json.html
deps/npm/html/doc/files/npmrc.html
deps/npm/html/doc/files/package.json.html
deps/npm/html/doc/index.html
deps/npm/html/doc/misc/npm-coding-style.html
deps/npm/html/doc/misc/npm-config.html
deps/npm/html/doc/misc/npm-developers.html
deps/npm/html/doc/misc/npm-disputes.html
deps/npm/html/doc/misc/npm-faq.html
deps/npm/html/doc/misc/npm-index.html
deps/npm/html/doc/misc/npm-registry.html
deps/npm/html/doc/misc/npm-scripts.html
deps/npm/html/doc/misc/removing-npm.html
deps/npm/html/doc/misc/semver.html
deps/npm/man/man1/npm-README.1
deps/npm/man/man1/npm-adduser.1
deps/npm/man/man1/npm-bin.1
deps/npm/man/man1/npm-bugs.1
deps/npm/man/man1/npm-build.1
deps/npm/man/man1/npm-bundle.1
deps/npm/man/man1/npm-cache.1
deps/npm/man/man1/npm-completion.1
deps/npm/man/man1/npm-dedupe.1
deps/npm/man/man1/npm-deprecate.1
deps/npm/man/man1/npm-docs.1
deps/npm/man/man1/npm-edit.1
deps/npm/man/man1/npm-explore.1
deps/npm/man/man1/npm-help-search.1
deps/npm/man/man1/npm-help.1
deps/npm/man/man1/npm-init.1
deps/npm/man/man1/npm-install.1
deps/npm/man/man1/npm-link.1
deps/npm/man/man1/npm-ls.1
deps/npm/man/man1/npm-outdated.1
deps/npm/man/man1/npm-owner.1
deps/npm/man/man1/npm-pack.1
deps/npm/man/man1/npm-prefix.1
deps/npm/man/man1/npm-prune.1
deps/npm/man/man1/npm-publish.1
deps/npm/man/man1/npm-rebuild.1
deps/npm/man/man1/npm-restart.1
deps/npm/man/man1/npm-rm.1
deps/npm/man/man1/npm-root.1
deps/npm/man/man1/npm-run-script.1
deps/npm/man/man1/npm-search.1
deps/npm/man/man1/npm-shrinkwrap.1
deps/npm/man/man1/npm-star.1
deps/npm/man/man1/npm-stars.1
deps/npm/man/man1/npm-start.1
deps/npm/man/man1/npm-stop.1
deps/npm/man/man1/npm-submodule.1
deps/npm/man/man1/npm-tag.1
deps/npm/man/man1/npm-test.1
deps/npm/man/man1/npm-uninstall.1
deps/npm/man/man1/npm-unpublish.1
deps/npm/man/man1/npm-update.1
deps/npm/man/man1/npm-version.1
deps/npm/man/man1/npm-view.1
deps/npm/man/man1/npm-whoami.1
deps/npm/man/man1/npm.1
deps/npm/man/man3/npm-bin.3
deps/npm/man/man3/npm-bugs.3
deps/npm/man/man3/npm-commands.3
deps/npm/man/man3/npm-config.3
deps/npm/man/man3/npm-deprecate.3
deps/npm/man/man3/npm-docs.3
deps/npm/man/man3/npm-edit.3
deps/npm/man/man3/npm-explore.3
deps/npm/man/man3/npm-help-search.3
deps/npm/man/man3/npm-init.3
deps/npm/man/man3/npm-install.3
deps/npm/man/man3/npm-link.3
deps/npm/man/man3/npm-load.3
deps/npm/man/man3/npm-ls.3
deps/npm/man/man3/npm-outdated.3
deps/npm/man/man3/npm-owner.3
deps/npm/man/man3/npm-pack.3
deps/npm/man/man3/npm-prefix.3
deps/npm/man/man3/npm-prune.3
deps/npm/man/man3/npm-publish.3
deps/npm/man/man3/npm-rebuild.3
deps/npm/man/man3/npm-restart.3
deps/npm/man/man3/npm-root.3
deps/npm/man/man3/npm-run-script.3
deps/npm/man/man3/npm-search.3
deps/npm/man/man3/npm-shrinkwrap.3
deps/npm/man/man3/npm-start.3
deps/npm/man/man3/npm-stop.3
deps/npm/man/man3/npm-submodule.3
deps/npm/man/man3/npm-tag.3
deps/npm/man/man3/npm-test.3
deps/npm/man/man3/npm-uninstall.3
deps/npm/man/man3/npm-unpublish.3
deps/npm/man/man3/npm-update.3
deps/npm/man/man3/npm-version.3
deps/npm/man/man3/npm-view.3
deps/npm/man/man3/npm-whoami.3
deps/npm/man/man3/npm.3
deps/npm/man/man5/npm-folders.5
deps/npm/man/man5/npm-global.5
deps/npm/man/man5/npm-json.5
deps/npm/man/man7/npm-coding-style.7
deps/npm/man/man7/npm-config.7
deps/npm/man/man7/npm-developers.7
deps/npm/man/man7/npm-disputes.7
deps/npm/man/man7/npm-faq.7
deps/npm/man/man7/npm-registry.7
deps/npm/man/man7/npm-scripts.7
deps/npm/man/man7/removing-npm.7
deps/npm/man/man7/semver.7
deps/npm/package.json
deps/uv/AUTHORS
deps/uv/ChangeLog
deps/uv/src/version.c
deps/uv/test/test-fs.c
deps/uv/test/test-list.h
lib/http.js
lib/tls.js
src/node_version.h

11 years agonpm: Upgrade to 1.3.4
isaacs [Fri, 12 Jul 2013 20:14:50 +0000 (13:14 -0700)]
npm: Upgrade to 1.3.4

11 years agonpm: Upgrade to 1.3.3
isaacs [Fri, 12 Jul 2013 15:56:59 +0000 (08:56 -0700)]
npm: Upgrade to 1.3.3

11 years agonpm: Upgrade to 1.3.3
isaacs [Fri, 12 Jul 2013 15:55:57 +0000 (08:55 -0700)]
npm: Upgrade to 1.3.3

11 years agotest: regression test for #5798 setImmediate
Timothy J Fontaine [Thu, 11 Jul 2013 23:04:49 +0000 (16:04 -0700)]
test: regression test for #5798 setImmediate

11 years agotimers: setImmediate process full queue each turn
Ben Noordhuis [Thu, 11 Jul 2013 22:58:11 +0000 (15:58 -0700)]
timers: setImmediate process full queue each turn

Previously only one cb per turn of the event loop was processed at a
time, which is not exactly what is meant by immediate

fixes #5798

11 years agobuild: fix windows build
Ben Noordhuis [Thu, 11 Jul 2013 13:37:00 +0000 (15:37 +0200)]
build: fix windows build

Be very careful with forward declarations, MSVC is quite picky and
rather stupid about it.

Fixes #5810.

11 years agonode: call MakeDomainCallback in all domain cases
Trevor Norris [Wed, 10 Jul 2013 17:35:57 +0000 (10:35 -0700)]
node: call MakeDomainCallback in all domain cases

Previously there was no way to pass a Function callback directly to
MakeCallback and support domains. The check has been added so that users
never have to worry about supporting domains while using MakeCallback.

11 years agocrypto: fix memory leak in LoadPKCS12
Fedor Indutny [Thu, 27 Jun 2013 17:53:29 +0000 (19:53 +0200)]
crypto: fix memory leak in LoadPKCS12

X509_STORE_add_cert increment reference of passed `x509` cert,
`X509_free` must be called to avoid memory leak.

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

11 years agotest: fix up indentation, replace tabs with spaces
Ben Noordhuis [Wed, 10 Jul 2013 07:48:55 +0000 (09:48 +0200)]
test: fix up indentation, replace tabs with spaces

11 years agotools: Add next/prev version scripts
isaacs [Tue, 9 Jul 2013 22:58:15 +0000 (15:58 -0700)]
tools: Add next/prev version scripts

11 years agoblog: Post for v0.10.13
Timothy J Fontaine [Tue, 9 Jul 2013 21:29:16 +0000 (14:29 -0700)]
blog: Post for v0.10.13

11 years agoNow working v0.10.14
Timothy J Fontaine [Tue, 9 Jul 2013 21:28:37 +0000 (14:28 -0700)]
Now working v0.10.14

11 years agoMerge branch 'v0.10.13-release' into v0.10
Timothy J Fontaine [Tue, 9 Jul 2013 21:28:05 +0000 (14:28 -0700)]
Merge branch 'v0.10.13-release' into v0.10

11 years ago2013.07.09, Version 0.10.13 (Stable) upstream/0.10.13 v0.10.13
Timothy J Fontaine [Tue, 9 Jul 2013 20:32:22 +0000 (13:32 -0700)]
2013.07.09, Version 0.10.13 (Stable)

* uv: Upgrade to v0.10.12

* npm: Upgrade to 1.3.2

* windows: get proper errno (Ben Noordhuis)

* tls: only wait for finish if we haven't seen it (Timothy J Fontaine)

* http: Dump response when request is aborted (isaacs)

* http: use an unref'd timer to fix delay in exit (Peter Rust)

* zlib: level can be negative (Brian White)

* zlib: allow zero values for level and strategy (Brian White)

* buffer: add comment explaining buffer alignment (Ben Noordhuis)

* string_bytes: properly detect 64bit (Timothy J Fontaine)

* src: fix memory leak in UsingDomains() (Ben Noordhuis)

11 years agobuild: use separate env vars for signing
Timothy J Fontaine [Tue, 9 Jul 2013 20:48:24 +0000 (13:48 -0700)]
build: use separate env vars for signing

11 years agouv: Upgrade to v0.10.12
isaacs [Tue, 9 Jul 2013 20:20:38 +0000 (13:20 -0700)]
uv: Upgrade to v0.10.12

11 years agonpm: Upgrade to 1.3.2
isaacs [Tue, 9 Jul 2013 20:09:02 +0000 (13:09 -0700)]
npm: Upgrade to 1.3.2

11 years agotls: only wait for finish if we haven't seen it
Timothy J Fontaine [Sun, 23 Jun 2013 22:33:13 +0000 (22:33 +0000)]
tls: only wait for finish if we haven't seen it

A pooled https agent may get a Connection: close, but never finish
destroying the socket as the prior request had already emitted finish
likely from a pipe.

Since the socket is not marked as destroyed it may get reused by the
agent pool and result in an ECONNRESET.

re: #5712 #5739

11 years agodoc: fix bad markdown parsing in list
Nathan Rajlich [Mon, 8 Jul 2013 18:25:40 +0000 (11:25 -0700)]
doc: fix bad markdown parsing in list

11 years agohttp: Dump response when request is aborted
isaacs [Wed, 26 Jun 2013 16:13:48 +0000 (09:13 -0700)]
http: Dump response when request is aborted

Fixes #5695

11 years agosrc: remove unnecessary calls to Local<T>::New()
Ben Noordhuis [Sun, 7 Jul 2013 12:34:49 +0000 (14:34 +0200)]
src: remove unnecessary calls to Local<T>::New()

11 years agosrc: cast strong persistent handles to locals
Ben Noordhuis [Sun, 7 Jul 2013 12:24:18 +0000 (14:24 +0200)]
src: cast strong persistent handles to locals

Avoids the overhead of creating a new Local every time we unwrap a
Persistent handle.

11 years agosmalloc: don't take address of stack var
Ben Noordhuis [Tue, 9 Jul 2013 16:54:10 +0000 (18:54 +0200)]
smalloc: don't take address of stack var

11 years agohttp: Use OOP for OutgoingMessage._finish
isaacs [Thu, 30 May 2013 23:08:03 +0000 (16:08 -0700)]
http: Use OOP for OutgoingMessage._finish

Sniffing instanceof a child class in the parent class's method
is Doing It Wrong.

11 years agohttp: Reuse more http/https Agent code
isaacs [Thu, 23 May 2013 01:44:24 +0000 (18:44 -0700)]
http: Reuse more http/https Agent code

11 years agohttp: Add agent.get/request methods
isaacs [Tue, 21 May 2013 21:02:18 +0000 (14:02 -0700)]
http: Add agent.get/request methods

11 years agohttp: Proper KeepAlive behavior
isaacs [Wed, 15 May 2013 22:10:53 +0000 (15:10 -0700)]
http: Proper KeepAlive behavior

Instead of destroying sockets when there are no pending requests, put
them in a freeSockets list, and unref() them so that they do not keep
the event loop open.

Also, set the default max sockets to Infinity, to prevent the awful
surprising deadlocks that happen when more connections are made.

11 years agohttp: style
isaacs [Wed, 15 May 2013 21:24:08 +0000 (14:24 -0700)]
http: style

11 years agocrypto: throw a helpful error message for "tls" and "crypto"
Nathan Rajlich [Mon, 8 Jul 2013 02:11:07 +0000 (19:11 -0700)]
crypto: throw a helpful error message for "tls" and "crypto"

When node is compiled with the --without-ssl flag.

11 years agoconfigure: fix the --without-ssl option
Nathan Rajlich [Sat, 6 Jul 2013 03:53:23 +0000 (20:53 -0700)]
configure: fix the --without-ssl option

Closes #5807.

11 years agobuffer: propagate originating parent
Trevor Norris [Tue, 9 Jul 2013 03:58:39 +0000 (20:58 -0700)]
buffer: propagate originating parent

When creating a slice, make sure to propagate the originating parent.
This is to prevent a buf.parent.parent.(etc) scenario.

Also speed up the constructor by preventing lookup of non-existant
properties by setting them beforehand in the prototype. (see
https://github.com/joyent/node/commit/7ce5a31#commitcomment-3332779)

11 years agotls_wrap: return Error not throw for missing cert
Timothy J Fontaine [Mon, 8 Jul 2013 05:03:57 +0000 (05:03 +0000)]
tls_wrap: return Error not throw for missing cert

11 years agobenchmark: update callbacks only receive data
Trevor Norris [Mon, 8 Jul 2013 23:53:41 +0000 (16:53 -0700)]
benchmark: update callbacks only receive data

Since the SlabAllocator was removed the buffer length/offset is no
longer sent to the onread callback. The benchmarks have been updated to
reflect that.

11 years agosmalloc: call callback if set on AllocDispose
Trevor Norris [Fri, 5 Jul 2013 23:21:09 +0000 (16:21 -0700)]
smalloc: call callback if set on AllocDispose

Fix bug where if dev passed a callback to Alloc then called AllocDispose
it wouldn't bother to pass the data to the callback and instead would
just free it.

11 years agosmalloc: zero size allocs may need to be free'd
Trevor Norris [Fri, 5 Jul 2013 23:31:27 +0000 (16:31 -0700)]
smalloc: zero size allocs may need to be free'd

Zero size allocations don't necessarily mean that data == NULL. So
instead check each value seperately and perform necessary operations.

11 years agodeps: upgrade c-ares to piscisaureus/cares@805d153
Ben Noordhuis [Sat, 6 Jul 2013 20:18:39 +0000 (22:18 +0200)]
deps: upgrade c-ares to piscisaureus/cares@805d153

This should fix the Android build.

11 years agohttp: use an unref'd timer to fix delay in exit
Peter Rust [Mon, 8 Jul 2013 04:11:22 +0000 (21:11 -0700)]
http: use an unref'd timer to fix delay in exit

There was previously up to a second exit delay when exiting node
right after an http request/response, due to the utcDate() function
doing a setTimeout to update the cached date/time.

Fixing this should increase the performance of our http tests.

11 years agotimers: internal unref timers should use Timer.now
Timothy J Fontaine [Mon, 8 Jul 2013 01:20:07 +0000 (18:20 -0700)]
timers: internal unref timers should use Timer.now

11 years agobuild: don't enable --gc-sections on sunos
Ben Noordhuis [Sat, 6 Jul 2013 16:48:52 +0000 (18:48 +0200)]
build: don't enable --gc-sections on sunos

The SunOS linker doesn't support it. Fixes build breakage introduced
in commit 9b3de60.

11 years agotest: fix up weakref.cc after v8 api change
Ben Noordhuis [Sat, 6 Jul 2013 02:31:02 +0000 (04:31 +0200)]
test: fix up weakref.cc after v8 api change

11 years agotools: add check-imports.sh script
Ben Noordhuis [Fri, 5 Jul 2013 20:42:06 +0000 (22:42 +0200)]
tools: add check-imports.sh script

Checks that `using` statements in src/*.cc are properly sorted and
actually used.

11 years agosrc: enable native v8 typed arrays
Ben Noordhuis [Sat, 29 Jun 2013 06:16:25 +0000 (08:16 +0200)]
src: enable native v8 typed arrays

This commit removes our homegrown typed arrays implementation and
enables V8's built-in typed arrays implementation.

11 years agosrc: abort() on fatal error in debug mode
Ben Noordhuis [Sat, 29 Jun 2013 05:30:11 +0000 (07:30 +0200)]
src: abort() on fatal error in debug mode

abort() generates a nice core dump and makes it easy to catch fatal
errors in one's debugger of choice.

11 years agostring_bytes: stop using String::AsciiValue
Ben Noordhuis [Sat, 29 Jun 2013 05:16:46 +0000 (07:16 +0200)]
string_bytes: stop using String::AsciiValue

Debug builds of V8 now actively check that the string only contains
ASCII characters (i.e. doesn't contain bytes with the high bit set.)

11 years agolib, src: upgrade after v8 api change
Ben Noordhuis [Wed, 3 Jul 2013 02:23:44 +0000 (04:23 +0200)]
lib, src: upgrade after v8 api change

This is a big commit that touches just about every file in the src/
directory. The V8 API has changed in significant ways. The most
important changes are:

* Binding functions take a const v8::FunctionCallbackInfo<T>& argument
  rather than a const v8::Arguments& argument.

* Binding functions return void rather than v8::Handle<v8::Value>. The
  return value is returned with the args.GetReturnValue().Set() family
  of functions.

* v8::Persistent<T> no longer derives from v8::Handle<T> and no longer
  allows you to directly dereference the object that the persistent
  handle points to. This means that the common pattern of caching
  oft-used JS values in a persistent handle no longer quite works,
  you first need to reconstruct a v8::Local<T> from the persistent
  handle with the Local<T>::New(isolate, persistent) factory method.

A handful of (internal) convenience classes and functions have been
added to make dealing with the new API a little easier.

The most visible one is node::Cached<T>, which wraps a v8::Persistent<T>
with some template sugar. It can hold arbitrary types but so far it's
exclusively used for v8::Strings (which was by far the most commonly
cached handle type.)

11 years agobuild: remove --unsafe-optimizations flag
Ben Noordhuis [Sat, 6 Jul 2013 12:59:15 +0000 (14:59 +0200)]
build: remove --unsafe-optimizations flag

The previous commit removes our patch that builds V8 at -O2 rather
than -O3 so there is not much point in keeping the configure switch
around.

The reason it did so was to work around an assortment of compiler and
linker bugs. In particular, certain combinations of g++ and binutils
generate bad or no code when -ffunction-sections or -finline-functions
is enabled (which -O3 implicitly does.)

It was quite the problem back in the day because everyone and his dog
built from source. Now that we have prebuilt binaries and packages
available, there is no longer a pressing need to be so accommodating.

If you experience spurious (or possibly not so spurious) segmentation
faults after this commit, you need to upgrade your compiler/linker
toolchain.

11 years agov8: reapply floating patches
Ben Noordhuis [Wed, 3 Jul 2013 02:23:36 +0000 (04:23 +0200)]
v8: reapply floating patches

11 years agov8: upgrade to v3.20.2
Ben Noordhuis [Tue, 2 Jul 2013 15:11:31 +0000 (17:11 +0200)]
v8: upgrade to v3.20.2

11 years agosmalloc: revert change to use pointer indirection
Trevor Norris [Sat, 6 Jul 2013 22:05:04 +0000 (15:05 -0700)]
smalloc: revert change to use pointer indirection

Better to compare fixed addresses than to use pointer indirection.

11 years agobuffer: use macro
Fedor Indutny [Fri, 5 Jul 2013 23:59:45 +0000 (03:59 +0400)]
buffer: use macro

11 years agosmalloc: fix style, use macro
Fedor Indutny [Fri, 5 Jul 2013 23:49:11 +0000 (03:49 +0400)]
smalloc: fix style, use macro

11 years agodoc: remove mention of maxTickDepth
Trevor Norris [Fri, 5 Jul 2013 22:03:04 +0000 (15:03 -0700)]
doc: remove mention of maxTickDepth

maxTickDepth has been removed, but mention of it was left in the docs.
Also added explanation that nextTick is allowed to starve I/O.

11 years agodoc: remove obsolete spawn() stdio options
Tim Oxley [Fri, 5 Jul 2013 03:57:13 +0000 (11:57 +0800)]
doc: remove obsolete spawn() stdio options

11 years agoMerge remote-tracking branch 'origin/v0.10'
Ben Noordhuis [Fri, 5 Jul 2013 00:40:39 +0000 (02:40 +0200)]
Merge remote-tracking branch 'origin/v0.10'

Conflicts:
lib/buffer.js
lib/http.js
src/node.cc

11 years agosrc: fix memory leak in UsingDomains()
Ben Noordhuis [Fri, 5 Jul 2013 00:20:37 +0000 (02:20 +0200)]
src: fix memory leak in UsingDomains()

UsingDomains() assigned process_tickCallback when it had already
been set by MakeCallback() a few frames down the call stack.

Dispose the handle first or we'll retain whatever is in the lexical
closure of the old process._tickCallback function.

Fixes #5795.

11 years agostream: objectMode transform should allow falsey values
Jeff Barczewski [Sun, 31 Mar 2013 03:32:06 +0000 (22:32 -0500)]
stream: objectMode transform should allow falsey values

If a transform stream has objectMode = true, it should
allow falsey values other than (null) like 0, false, ''.

null is reserved to indicate stream eof but other falsey
values should flow through properly.

11 years ago{stream,udp,tls}_wrap: remove unused offset/length
Trevor Norris [Fri, 21 Jun 2013 18:35:29 +0000 (11:35 -0700)]
{stream,udp,tls}_wrap: remove unused offset/length

The function arguments offset and length are now no longer used since
all I/O requests now use discretely allocated memory.

11 years agosmalloc: use malloc instead of new
Trevor Norris [Thu, 20 Jun 2013 23:44:02 +0000 (16:44 -0700)]
smalloc: use malloc instead of new

To use realloc the implementation had to be changed to use malloc/free.

11 years agoslab_allocator: remove SlabAllocator
Trevor Norris [Wed, 19 Jun 2013 18:20:45 +0000 (11:20 -0700)]
slab_allocator: remove SlabAllocator

Now that Buffer instantiation has improved, the SlabAllocator is an
unnecessary layer of complexity preventing further performance
optimizations.

Currently there is a small performance loss with very small stream
requests, but this will soon be addressed.

11 years agocrypto: fix memory leak in LoadPKCS12
Fedor Indutny [Thu, 27 Jun 2013 17:53:29 +0000 (19:53 +0200)]
crypto: fix memory leak in LoadPKCS12

X509_STORE_add_cert increment reference of passed `x509` cert,
`X509_free` must be called to avoid memory leak.

11 years agotls: export TLSSocket
Fedor Indutny [Wed, 3 Jul 2013 07:46:01 +0000 (11:46 +0400)]
tls: export TLSSocket

11 years agotest: fix tls-hello-parser-failure on smartos
Timothy J Fontaine [Mon, 1 Jul 2013 21:29:15 +0000 (21:29 +0000)]
test: fix tls-hello-parser-failure on smartos

Assert that when the client closes it has seen an error, this prevents
the test from timing out.

Also queue a second write in the case that we were able to send the
buffer before the other side closed the connection.

11 years agohttp: use an unref'd timer to fix delay in exit
Peter Rust [Mon, 1 Jul 2013 22:46:49 +0000 (15:46 -0700)]
http: use an unref'd timer to fix delay in exit

There was previously up to a second exit delay when exiting node
right after an http request/response, due to the utcDate() function
doing a setTimeout to update the cached date/time.

Fixing this should increase the performance of our http tests.

11 years agotest: fix tls-hello-parser-failure on smartos
Timothy J Fontaine [Mon, 1 Jul 2013 21:29:15 +0000 (21:29 +0000)]
test: fix tls-hello-parser-failure on smartos

Assert that when the client closes it has seen an error, this prevents
the test from timing out.

Also queue a second write in the case that we were able to send the
buffer before the other side closed the connection.

11 years agozlib: level can be negative
Brian White [Mon, 1 Jul 2013 09:42:36 +0000 (05:42 -0400)]
zlib: level can be negative

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

11 years agozlib: allow zero values for level and strategy
Brian White [Mon, 1 Jul 2013 09:42:19 +0000 (05:42 -0400)]
zlib: allow zero values for level and strategy

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

11 years agozlib: allow changing of level and strategy
Brian White [Mon, 1 Jul 2013 09:44:17 +0000 (05:44 -0400)]
zlib: allow changing of level and strategy

11 years agozlib: allow custom flush type for flush()
Brian White [Mon, 1 Jul 2013 09:44:03 +0000 (05:44 -0400)]
zlib: allow custom flush type for flush()

11 years agozlib: remove unused parameter
Brian White [Mon, 1 Jul 2013 09:42:57 +0000 (05:42 -0400)]
zlib: remove unused parameter

11 years agozlib: level can be negative
Brian White [Mon, 1 Jul 2013 09:42:36 +0000 (05:42 -0400)]
zlib: level can be negative

11 years agozlib: allow zero values for level and strategy
Brian White [Mon, 1 Jul 2013 09:42:19 +0000 (05:42 -0400)]
zlib: allow zero values for level and strategy

11 years agodoc: vm: update github issues link
Ben Noordhuis [Fri, 28 Jun 2013 10:31:37 +0000 (12:31 +0200)]
doc: vm: update github issues link

11 years agobuffer: add comment explaining buffer alignment
Ben Noordhuis [Thu, 27 Jun 2013 01:18:41 +0000 (03:18 +0200)]
buffer: add comment explaining buffer alignment

Avoids alignment issues (unaligned loads/stores) on ARM. Originally
added in commit 285d8c6.

Fixes #3030.

11 years agoblog: v0.11.3 release
isaacs [Thu, 27 Jun 2013 00:06:40 +0000 (17:06 -0700)]
blog: v0.11.3 release

11 years agoMerge branch 'v0.11.3-release'
isaacs [Wed, 26 Jun 2013 23:55:46 +0000 (16:55 -0700)]
Merge branch 'v0.11.3-release'

11 years agodoc: tls: ECDH ciphers are not supported
Ben Noordhuis [Wed, 26 Jun 2013 23:37:29 +0000 (01:37 +0200)]
doc: tls: ECDH ciphers are not supported

11 years ago2013.06.26, Version 0.11.3 (Unstable) v0.11.3
isaacs [Wed, 26 Jun 2013 18:03:29 +0000 (11:03 -0700)]
2013.06.26, Version 0.11.3 (Unstable)

* uv: Upgrade to v0.11.5

* c-ares: upgrade to 1.10.0

* v8: upgrade to v3.19.13

* punycode: update to v1.2.3 (Mathias Bynens)

* debugger: break on uncaught exception (Miroslav Bajtos)

* child_process: emit 'disconnect' asynchronously (Ben Noordhuis)

* dtrace: enable uv's probes if enabled (Timothy J Fontaine)

* dtrace: unify dtrace and systemtap interfaces (Timothy J Fontaine)

* buffer: New API for backing data store (Trevor Norris)

* buffer: return `this` in fill() for chainability (Brian White)

* build: fix include order for building on windows (Timothy J Fontaine)

* build: add android support (Linus Mårtensson)

* readline: strip ctrl chars for prompt width calc (Krzysztof Chrapka)

* tls: introduce TLSSocket based on tls_wrap binding (Fedor Indutny)

* tls: add localAddress and localPort properties (Ben Noordhuis)

* crypto: free excessive memory in NodeBIO (Fedor Indutny)

* process: remove maxTickDepth (Trevor Norris)

* timers: use uv_now instead of Date.now (Timothy J Fontaine)

* util: Add debuglog, deprecate console lookalikes (isaacs)

* module: use path.sep instead of a custom solution (Robert Kowalski)

* http: don't escape request path, reject bad chars (Ben Noordhuis)

* net: emit dns 'lookup' event before connect (Ben Noordhuis)

* dns: add getServers and setServers (Timothy J Fontaine)

11 years agosrc: break on uncaught exception
Miroslav Bajtos [Mon, 17 Jun 2013 19:19:59 +0000 (21:19 +0200)]
src: break on uncaught exception

Most TryCatch blocks have SetVerbose flag on, this tells V8 to report
uncaught exceptions to debugger.

FatalException handler is called from V8 Message listener instead from
the place where TryCatch was used. Otherwise uncaught exceptions are
logged twice.

See comment in `deps/v8/include/v8.h` for explanation of SetVerbose
flag:

>  By default, exceptions that are caught by an external exception
>  handler are not reported.  Call SetVerbose with true on an
>  external exception handler to have exceptions caught by the
>  handler reported as if they were not caught.

The flag is used by `Isolate::ShouldReportException()`, which is called
by `Isolate::DoThrow()` to decide whether an exception is considered
uncaught.

11 years agouv: Upgrade to v0.11.5
isaacs [Wed, 26 Jun 2013 17:48:10 +0000 (10:48 -0700)]
uv: Upgrade to v0.11.5

11 years agocrypto: do not move half-filled write head
Fedor Indutny [Tue, 25 Jun 2013 21:31:10 +0000 (23:31 +0200)]
crypto: do not move half-filled write head

Might cause write head running over read head, when there were no
allocation and `Commit()` was called. Source of at least one test
failure on windows (`simple/test-https-drain.js`).

11 years agoMerge remote-tracking branch 'ry/v0.10' into master
isaacs [Tue, 25 Jun 2013 18:12:33 +0000 (11:12 -0700)]
Merge remote-tracking branch 'ry/v0.10' into master

Conflicts:
ChangeLog
deps/uv/ChangeLog
deps/uv/src/unix/stream.c
deps/uv/src/version.c
deps/v8/build/common.gypi
deps/v8/src/frames.h
deps/v8/src/runtime.cc
deps/v8/test/mjsunit/debug-set-variable-value.js
lib/http.js
src/node_version.h

11 years agoRevert "configure: fix cross-compilation host_arch_cc()"
Ben Noordhuis [Tue, 25 Jun 2013 10:47:24 +0000 (12:47 +0200)]
Revert "configure: fix cross-compilation host_arch_cc()"

Several people have reported cross-compiling build breakage, see e.g.
https://groups.google.com/forum/#!topic/nodejs/k8HzqpqPkJQ

Message-Id: <823c3bd1-e104-4409-86ad-0ab6de936fec@googlegroups.com>
Subject: [nodejs] nodejs 0.10.12 and Angstrom issues

This reverts commit acbdabb74b1b8484671fd3c44cd9eb9a7ea11f41.

11 years agodoc: fs: synchronize watchFile/unwatchFile warning
Ben Noordhuis [Mon, 24 Jun 2013 09:16:48 +0000 (11:16 +0200)]
doc: fs: synchronize watchFile/unwatchFile warning

One said "if available", the other "if possible". Now they both say
"if possible."

11 years agochild_process: emit 'disconnect' asynchronously
Ben Noordhuis [Thu, 20 Jun 2013 21:13:28 +0000 (23:13 +0200)]
child_process: emit 'disconnect' asynchronously

Deferring I/O-triggered events to the next event loop tick is not just
a good idea, IT'S THE LAW!

11 years agodoc: improve punycode.js documentation
Mathias Bynens [Sun, 2 Jun 2013 12:25:51 +0000 (15:25 +0300)]
doc: improve punycode.js documentation

11 years agobuffer: fix gcc 4.2 build breakage
Ben Noordhuis [Thu, 20 Jun 2013 11:21:05 +0000 (13:21 +0200)]
buffer: fix gcc 4.2 build breakage

gcc 4.2 on OS X gets confused about the call to node::Buffer::Data().
Fully qualify the function name to help it along.

Fixes the following build error:

    ../../deps/v8/include/v8.h: In function ‘char*
    node::Buffer::Data(v8::Handle<v8::Value>)’:
    ../../deps/v8/include/v8.h:900: error: ‘class v8::Data’
    is not a function,
    ../../src/node_buffer.h:38: error:
    conflict with ‘char* node::Buffer::Data(v8::Handle<v8::Object>)’
    ../../src/node_buffer.cc:94: error:
    in call to ‘Data’

11 years agopunycode: update to v1.2.3
Mathias Bynens [Thu, 20 Jun 2013 10:40:44 +0000 (12:40 +0200)]
punycode: update to v1.2.3

11 years agostring_bytes: properly detect 64bit
Timothy J Fontaine [Thu, 20 Jun 2013 00:10:02 +0000 (17:10 -0700)]
string_bytes: properly detect 64bit

11 years agobuffer: write strings directly from call
Trevor Norris [Wed, 19 Jun 2013 20:07:24 +0000 (13:07 -0700)]
buffer: write strings directly from call

Buffer(<String>) used to pass the string to js where it would then be
passed back to cpp for processing. Now only the buffer object
instantiation is done in js and the string is processed in cpp.

Also added a Buffer api that also accepts the encoding.

11 years agocrypto: change assertion to condition in bio
Fedor Indutny [Wed, 19 Jun 2013 08:16:59 +0000 (10:16 +0200)]
crypto: change assertion to condition in bio

Read head can be the same as write head, even if there's some data to
read.

11 years agobuffer: proper API export for Windows
Trevor Norris [Fri, 7 Jun 2013 17:31:53 +0000 (10:31 -0700)]
buffer: proper API export for Windows

So that Windows users can properly include smalloc and node_buffer,
NODE_EXTERN was added to the headers that export this functionality.

11 years agobuffer: implement new fill behavior
Trevor Norris [Fri, 24 May 2013 17:58:30 +0000 (10:58 -0700)]
buffer: implement new fill behavior

Old fill would take the char code of the first character and wrap around
the int to fit in the 127 range. Now fill will duplicate whatever string
is given through the entirety of the buffer.

Note: There is one bug around ending on a partial fill of any character
outside the ASCII range.

11 years agobuffer: deprecate legacy code
Trevor Norris [Fri, 26 Apr 2013 23:58:18 +0000 (16:58 -0700)]
buffer: deprecate legacy code

Several things are now no longer necessary. These have been deprecated,
and will be removed in v0.13.

11 years agobuffer: remove c-style casts
Trevor Norris [Mon, 29 Apr 2013 05:13:45 +0000 (22:13 -0700)]
buffer: remove c-style casts

11 years agobuffer: expose class methods alloc and dispose
Trevor Norris [Wed, 15 May 2013 18:01:33 +0000 (11:01 -0700)]
buffer: expose class methods alloc and dispose

Expose the ability for users to allocate and manually dispose data on
any object. These are user-safe versions of internal smalloc functions.

11 years agobuffer: reimplement Buffer pools
Trevor Norris [Wed, 17 Apr 2013 23:29:14 +0000 (16:29 -0700)]
buffer: reimplement Buffer pools

While the new Buffer implementation is much faster we still have the
necessity of using Buffer pools. This is undesirable because it may
still lead to unwanted memory retention, but for the time being this is
the best solution.

Because of this re-introduction, and since there is no more SlowBuffer
type, the SlowBuffer method has been re-purposed to return a non-pooled
Buffer instance. This will be helpful for developers to store data for
indeterminate lengths of time without introducing a memory leak.

Another change to Buffer pools was that they are only allocated if the
requested chunk is < poolSize / 2. This was done because allocations are
much quicker now, and it's a better use of the pool.

11 years agobuffer: use smalloc as backing data store
Trevor Norris [Wed, 17 Apr 2013 23:26:15 +0000 (16:26 -0700)]
buffer: use smalloc as backing data store

Memory allocations are now done through smalloc. The Buffer cc class has
been removed completely, but for backwards compatibility have left the
namespace as Buffer.

The .parent attribute is only set if the Buffer is a slice of an
allocation. Which is then set to the alloc object (not a Buffer).

The .offset attribute is now a ReadOnly set to 0, for backwards
compatibility. I'd like to remove it in the future (pre v1.0).

A few alterations have been made to how arguments are either coerced or
thrown. All primitives will now be coerced to their respective values,
and (most) all out of range index requests will throw.

The indexes that are coerced were left for backwards compatibility. For
example: Buffer slice operates more like Array slice, and coerces
instead of throwing out of range indexes. This may change in the future.

The reason for wanting to throw for out of range indexes is because
giving js access to raw memory has high potential risk. To mitigate that
it's easier to make sure the developer is always quickly alerted to the
fact that their code is attempting to access beyond memory bounds.

Because SlowBuffer will be deprecated, and simply returns a new Buffer
instance, all tests on SlowBuffer have been removed.

Heapdumps will now show usage under "smalloc" instead of "Buffer".

ParseArrayIndex was added to node_internals to support proper uint
argument checking/coercion for external array data indexes.

SlabAllocator had to be updated since handle_ no longer exists.

11 years agosmalloc: add api to manually dispose Persistent
Trevor Norris [Tue, 14 May 2013 23:27:10 +0000 (16:27 -0700)]
smalloc: add api to manually dispose Persistent

If the user knows the allocation is no longer needed then the memory can
be manually released.

Currently this will not ClearWeak the Persistent, so the callback will
still run.

If the user passed a ClearWeak callback, and then disposed the object,
the buffer callback argument will == NULL.

11 years agosmalloc: initial implementation
Trevor Norris [Wed, 17 Apr 2013 23:18:47 +0000 (16:18 -0700)]
smalloc: initial implementation

smalloc is a simple utility for quickly allocating external memory onto
js objects. This will be used to centralize how memory is managed in
node, and will become the backer for Buffers. So in the future crypto's
SlabBuffer, stream's SlabAllocator will be removed.

Note on the js API: because no arguments are optional the order of
arguments have been placed to match their cc counterparts as closely as
possible.