platform/upstream/nodejs.git
11 years agoMerge remote-tracking branch 'ry/v0.10' into master
isaacs [Thu, 21 Mar 2013 17:52:01 +0000 (10:52 -0700)]
Merge remote-tracking branch 'ry/v0.10' into master

Conflicts:
src/node.cc
src/node_version.h

11 years agosrc: write ascii strings using WriteOneByte
Trevor Norris [Thu, 21 Mar 2013 16:26:23 +0000 (09:26 -0700)]
src: write ascii strings using WriteOneByte

WriteAscii will be deprecated soon from v8, and performance has
regressed. The v8 team recommended using WriteOneByte instead.

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.

11 years agobench: add dgram send/recv benchmark
Ben Noordhuis [Wed, 20 Mar 2013 15:53:23 +0000 (16:53 +0100)]
bench: add dgram send/recv benchmark

11 years agotls: always reset this.ssl.error after handling
Fedor Indutny [Wed, 20 Mar 2013 13:35:38 +0000 (17:35 +0400)]
tls: always reset this.ssl.error after handling

Otherwise assertion may happen:

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

See #5058

11 years agov8: unbreak build on smartos after 831af97df211f04
Fedor Indutny [Wed, 20 Mar 2013 08:25:46 +0000 (12:25 +0400)]
v8: unbreak build on smartos after 831af97df211f04

11 years agosrc: bump NODE_MODULE_VERSION after abi change
Ben Noordhuis [Wed, 20 Mar 2013 00:56:29 +0000 (01:56 +0100)]
src: bump NODE_MODULE_VERSION after abi change

11 years agotest: fix up weakref.cc after v8 api change
Ben Noordhuis [Wed, 20 Mar 2013 00:53:14 +0000 (01:53 +0100)]
test: fix up weakref.cc after v8 api change

11 years agofs: make write/appendFileSync correctly set file mode
Raymond Feng [Wed, 20 Mar 2013 00:37:03 +0000 (01:37 +0100)]
fs: make write/appendFileSync correctly set file mode

11 years agosrc: pass Isolate to all applicable api
Trevor Norris [Tue, 19 Mar 2013 21:55:05 +0000 (14:55 -0700)]
src: pass Isolate to all applicable api

Update the api to pass node_isolate to all supported methods.

Much thanks to Ben Noordhuis and his work in 51f6e6a.

11 years agodocs: show how to use Isolate
Trevor Norris [Tue, 19 Mar 2013 10:28:17 +0000 (03:28 -0700)]
docs: show how to use Isolate

Part of the 3.17 update is to pass the isolate as an argument. The addon
docs have been updated with this usage.

11 years agodtrace: fix generation of v8 constants on freebsd
Fedor Indutny [Sun, 20 Jan 2013 14:31:30 +0000 (18:31 +0400)]
dtrace: fix generation of v8 constants on freebsd

Every constant is certainly 4 bytes now, but freebsd's objdump utility
prints out odd byte sequences (5-bytes, 6-bytes and even 9-bytes long)
for v8's data section. We can safely ignore all upper bytes, because all
constants that we're using are just `int`s. Since on all supported
platforms `int` is 32bit long (and anyway v8's constants are 32bit too),
we ignore all higher bits if they were read.

11 years agodtrace: More style
isaacs [Mon, 7 Jan 2013 20:31:44 +0000 (12:31 -0800)]
dtrace: More style

Continuation lines should be indented with 4 spaces, not a tab.

11 years agodtrace: Make D style more D-ish
isaacs [Mon, 7 Jan 2013 20:20:21 +0000 (12:20 -0800)]
dtrace: Make D style more D-ish

11 years agodtrace: x64 ustack helper
Fedor Indutny [Thu, 27 Dec 2012 03:16:23 +0000 (07:16 +0400)]
dtrace: x64 ustack helper

11 years agodtrace: fix style in ustack helper
Fedor Indutny [Mon, 7 Jan 2013 18:53:50 +0000 (22:53 +0400)]
dtrace: fix style in ustack helper

11 years agov8: revert dtrace fix from 3.14 downgrade
Trevor Norris [Tue, 19 Mar 2013 09:06:13 +0000 (02:06 -0700)]
v8: revert dtrace fix from 3.14 downgrade

Revert "v8: fix postmortem and dtrace helper build"

This reverts commit aa985392777dbe6159ce4ca56ae79d1039e43ec7.

11 years agov8: loosen artificial mmap constraint
Bryan Cantrill [Tue, 18 Sep 2012 22:35:29 +0000 (15:35 -0700)]
v8: loosen artificial mmap constraint

Fixes #4010.

11 years agobindings: update api
Trevor Norris [Mon, 18 Mar 2013 20:54:00 +0000 (13:54 -0700)]
bindings: update api

All compile time warnings about using deprecated APIs have been
suppressed by updating node's API. Though there are still many function
calls that can accept Isolate, and still need to be updated.

node_isolate had to be added as an extern variable in node.h and
node_object_wrap.h

Also a couple small fixes for Error handling.

Before v8 3.16.6 the error stack message was lazily written when it was
needed, which allowed you to change the message after instantiation.
Then the stack would be written with the new message the first time it
was accessed. Though that has changed. Now it creates the stack message
on instantiation. So setting a different message afterwards won't be
displayed.

This is not a complete fix for the problem. Getting error without any
message isn't very useful.

11 years agov8: remove optimization switches
Trevor Norris [Mon, 18 Mar 2013 20:50:55 +0000 (13:50 -0700)]
v8: remove optimization switches

Remove compiler switches from $(TOPLEVEL)/deps/v8/build/common.gypi,
they are set globally in $(TOPLEVEL)/common.gypi.

11 years agodeps: update v8 to 3.17.13
Trevor Norris [Mon, 18 Mar 2013 20:49:34 +0000 (13:49 -0700)]
deps: update v8 to 3.17.13

11 years agodoc: fix streams2 SimpleProtocol example
Iskren Ivov Chernev [Tue, 19 Mar 2013 17:58:18 +0000 (10:58 -0700)]
doc: fix streams2 SimpleProtocol example

A non-existing variable `b` was used to queue data for reading.

11 years agowindows: enable watching signals with process.on('SIGXYZ')
Bert Belder [Tue, 19 Mar 2013 23:16:02 +0000 (00:16 +0100)]
windows: enable watching signals with process.on('SIGXYZ')

This reverts commit ea1cba6246a8b1784e22d076139b9244a9ff42f8.

The offending commit was intended to land on the v0.8 branch only, but
it accidentally got merged at some point.

Closes #5054.

11 years agoUpdate .mailmap and AUTHORS
Bert Belder [Tue, 19 Mar 2013 19:07:38 +0000 (20:07 +0100)]
Update .mailmap and AUTHORS

11 years agotest: Misc Windows unit test fixes
Scott Blomquist [Mon, 18 Mar 2013 17:48:13 +0000 (10:48 -0700)]
test: Misc Windows unit test fixes

Fixes #5071, #5073.

* Normalize capitalization of drive letter
* Fix `exit()` typo in failure path
* Ignore symlink tests (Windows) if not elevated

The `test_relative_input_cwd()` test was failing on Windows when
`skipSymlinks` was `true`. So we won't run it if `skipSymlinks` is
`true`.

When it failed, the unhandled error caused Node to die before
having a chance to clean up, which resulted in two files missing
in subsequent unit tests:

 * `test/fixtures/nested-index/one/hello.js`
 * `test/fixtures/nested-index/one/index.js`

We should probably find a way to isolate this test from the other
test (`simple/test-module-loading`) that was failing when this test
poluted the disk state.

11 years agodoc: fix broken links in blog footer
Ben Noordhuis [Mon, 18 Mar 2013 13:40:03 +0000 (14:40 +0100)]
doc: fix broken links in blog footer

The blog lives at blog.nodejs.org while the main website lives at
nodejs.org. Ergo, use absolute URLs for links to the main website.

Fixes #5062.

11 years agotls: write pending data of opposite side
Fedor Indutny [Fri, 15 Mar 2013 18:49:31 +0000 (22:49 +0400)]
tls: write pending data of opposite side

Fix stucked CryptoStream behaviour, happening when one of the sides
locks-up in queued state.

fix #5023

11 years agotls: write pending data of opposite side
Fedor Indutny [Fri, 15 Mar 2013 18:49:31 +0000 (22:49 +0400)]
tls: write pending data of opposite side

Fix stucked CryptoStream behaviour, happening when one of the sides
locks-up in queued state.

fix #5023

11 years agonode: revert removal of MakeCallback
Trevor Norris [Sun, 17 Mar 2013 04:59:47 +0000 (21:59 -0700)]
node: revert removal of MakeCallback

In 0168109 an implementation of MakeCallback was accidently removed. It
has been re-added.

11 years agodoc: fix typo in crypto docs
JeongHoon Byun [Tue, 12 Mar 2013 12:21:43 +0000 (21:21 +0900)]
doc: fix typo in crypto docs

11 years agodoc: https: Fix the link to tls.connect
Yi EungJun [Fri, 15 Mar 2013 16:31:48 +0000 (01:31 +0900)]
doc: https: Fix the link to tls.connect

11 years agodeps: upgrade libuv to b45a74f
Ben Noordhuis [Sat, 16 Mar 2013 22:32:42 +0000 (23:32 +0100)]
deps: upgrade libuv to b45a74f

11 years agoinstall: don't install man page twice
Ben Noordhuis [Sat, 16 Mar 2013 22:18:50 +0000 (23:18 +0100)]
install: don't install man page twice

Looks like a merge conflict in 77ed12f left in the old, unconditional
install rule. Remove it, the new and improved rule is a few lines down.

Fixes #5044.

11 years agoreadline: handle wide characters properly
Nao Iizuka [Sat, 16 Mar 2013 02:18:30 +0000 (16:18 -1000)]
readline: handle wide characters properly

Handle wide characters (such as あ, 谢, 고) as two column wide to make
cursor move properly.

Closes #555.
Closes #4994.

11 years agov8: move 32 bit heap hint on sunos
Timothy J Fontaine [Thu, 14 Mar 2013 23:06:59 +0000 (16:06 -0700)]
v8: move 32 bit heap hint on sunos

Setting the V8 heap at or near 0x20000000 on 32bit sunos only allows
512 MB of heap space, instead on sunos move this to 0x80000000.

Fixes #4010.

11 years agostream: Return self from readable.wrap
isaacs [Thu, 14 Mar 2013 23:43:19 +0000 (16:43 -0700)]
stream: Return self from readable.wrap

Also, set paused=false *before* calling resume().  Otherwise,
there's an edge case where an immediately-emitted chunk might make
it call pause() again incorrectly.

11 years agotest: No need for kicking in streams2 test
isaacs [Thu, 14 Mar 2013 23:18:42 +0000 (16:18 -0700)]
test: No need for kicking in streams2 test

This was necessary when we weren't auto-starting when a 'readable'
listener is added.

11 years agostream: Never call decoder.end() multiple times
Gil Pedersen [Thu, 14 Mar 2013 13:01:14 +0000 (14:01 +0100)]
stream: Never call decoder.end() multiple times

Updated version that does what it says without assigning state.decoder.

11 years agorepl: Use a domain to catch async errors safely
isaacs [Thu, 14 Mar 2013 21:16:13 +0000 (14:16 -0700)]
repl: Use a domain to catch async errors safely

Fix #2031

11 years agorepl: emit 'reset' event when context is reset
Sami Samhuri [Thu, 14 Mar 2013 20:49:14 +0000 (10:49 -1000)]
repl: emit 'reset' event when context is reset

Closes #1183.

11 years agodoc: don't mark fs callbacks as optional
koichik [Thu, 14 Mar 2013 14:57:13 +0000 (23:57 +0900)]
doc: don't mark fs callbacks as optional

Refs #5005, #5008

11 years agohttp: Don't hot-path end() for large buffers
isaacs [Thu, 14 Mar 2013 14:48:18 +0000 (07:48 -0700)]
http: Don't hot-path end() for large buffers

The benefits of the hot-path optimization below start to fall off when
the buffer size gets up near 128KB, because the cost of the copy is more
than the cost of the extra write() call.  Switch to the write/end method
at that point.

Heuristics and magic numbers are awful, but slow http responses are
worse.

Fix #4975

11 years agonet: improve arbitrary tcp socket support
Ben Noordhuis [Thu, 14 Mar 2013 14:13:58 +0000 (15:13 +0100)]
net: improve arbitrary tcp socket support

Consider this example:

  // fd 3 is a bound tcp socket
  var s = net.createServer(cb);
  s.listen({ fd: 3 });
  console.log(s.address());  // prints null

This commit makes net.Server#address() print the actual address.

Ditto for non-listen sockets; properties like net.Socket#localAddress
and net.Socket#remoteAddress now return the correct value.

Fixes #5009.

11 years agodeps: upgrade libuv to 7b66ea1
Ben Noordhuis [Thu, 14 Mar 2013 12:40:27 +0000 (13:40 +0100)]
deps: upgrade libuv to 7b66ea1

11 years agodoc: change dgram to socket for properties of dgram.Socket
Adam Malcontenti-Wilson [Thu, 14 Mar 2013 02:17:07 +0000 (13:17 +1100)]
doc: change dgram to socket for properties of dgram.Socket

Fixes #4919.

11 years agoRevert "fs: Missing cb errors are deprecated, not a throw"
isaacs [Wed, 13 Mar 2013 22:36:52 +0000 (15:36 -0700)]
Revert "fs: Missing cb errors are deprecated, not a throw"

This reverts commits 6bd8b7e5405e1cdc9f56214f5f6b741806c32e5f
and fa05e8a2706e20a191942fe2b2273481605a1f14.

11 years agoMerge remote-tracking branch 'ry/v0.10'
isaacs [Wed, 13 Mar 2013 22:51:24 +0000 (15:51 -0700)]
Merge remote-tracking branch 'ry/v0.10'

Conflicts:
src/node_version.h

11 years agoRevert "stream: Never call decoder.end() multiple times"
isaacs [Wed, 13 Mar 2013 22:48:56 +0000 (15:48 -0700)]
Revert "stream: Never call decoder.end() multiple times"

This reverts commit 615d809ac684a7d2cc7ee5e1aa58f0a921b529a0.

11 years agofs: Missing cb errors are deprecated, not a throw
isaacs [Wed, 13 Mar 2013 21:59:42 +0000 (14:59 -0700)]
fs: Missing cb errors are deprecated, not a throw

Commit a804347 makes fs function rethrow errors when the callback is
omitted. While the right thing to do, it's a change from the old v0.8
behavior where such errors were silently ignored.

To give users time to upgrade, temporarily disable that and replace it
with a function that warns once about the deprecated behavior.

Close #5005

11 years agodoc: implicit fs callbacks don't throw in v0.10
Ben Noordhuis [Wed, 13 Mar 2013 21:52:33 +0000 (22:52 +0100)]
doc: implicit fs callbacks don't throw in v0.10

But they will in v0.12.

Re #5005.

11 years agodoc: add note on process.title max length
Ben Noordhuis [Wed, 13 Mar 2013 22:22:55 +0000 (23:22 +0100)]
doc: add note on process.title max length

Fixes #5006.

11 years agostream: Never call decoder.end() multiple times
Gil Pedersen [Tue, 12 Mar 2013 14:56:30 +0000 (15:56 +0100)]
stream: Never call decoder.end() multiple times

Fixes decoder.end() being called on every push(null). As the tls module
does this, corrupt stream data could potentially be added to the end.

11 years agocore: Move UNWRAP_NO_ABORT to handle_wrap.h
isaacs [Wed, 13 Mar 2013 18:22:33 +0000 (11:22 -0700)]
core: Move UNWRAP_NO_ABORT to handle_wrap.h

Otherwise it cannot be used in StreamWrap.

Forgot to include in last patch, broke the build.

11 years agodoc: path.join() arguments must be strings
Ben Noordhuis [Wed, 13 Mar 2013 17:27:09 +0000 (18:27 +0100)]
doc: path.join() arguments must be strings

In v0.8, non-string arguments were ignored. v0.10 throws an exception.

11 years agonet: handle 'finish' event only after 'connect'
Fedor Indutny [Wed, 13 Mar 2013 12:53:27 +0000 (16:53 +0400)]
net: handle 'finish' event only after 'connect'

11 years agocore: Unwrap without aborting in handle fd getter
isaacs [Wed, 13 Mar 2013 17:16:26 +0000 (10:16 -0700)]
core: Unwrap without aborting in handle fd getter

11 years agoblog: Fix typo in typo fix
isaacs [Wed, 13 Mar 2013 17:15:30 +0000 (10:15 -0700)]
blog: Fix typo in typo fix

11 years agonet: handle 'finish' event only after 'connect'
Fedor Indutny [Wed, 13 Mar 2013 12:53:27 +0000 (16:53 +0400)]
net: handle 'finish' event only after 'connect'

11 years agoblog: fix small typo in v0.10.0 release article
Nathan Rajlich [Wed, 13 Mar 2013 02:00:48 +0000 (19:00 -0700)]
blog: fix small typo in v0.10.0 release article

11 years agodoc: fix inpect() -> inspect() typo
Nathan Rajlich [Tue, 12 Mar 2013 22:58:27 +0000 (15:58 -0700)]
doc: fix inpect() -> inspect() typo

11 years agocrypto: replace BIO_free with BIO_free_all
Fedor Indutny [Tue, 12 Mar 2013 19:15:21 +0000 (23:15 +0400)]
crypto: replace BIO_free with BIO_free_all

From OpenSSL's documentation:

"If BIO_free() is called on a BIO chain it will only free one BIO
resulting in a memory leak."

and

"BIO_free_all() frees up an entire BIO chain, it does not halt if an
error occurs freeing up an individual BIO in the chain"

11 years agocrypto: refactor crypto classes
Fedor Indutny [Tue, 12 Mar 2013 10:18:24 +0000 (14:18 +0400)]
crypto: refactor crypto classes

11 years agocrypto: merge Cipher and Decipher
Fedor Indutny [Tue, 12 Mar 2013 10:09:27 +0000 (14:09 +0400)]
crypto: merge Cipher and Decipher

11 years agocrypto: split crypto classes
Fedor Indutny [Mon, 11 Mar 2013 21:59:46 +0000 (01:59 +0400)]
crypto: split crypto classes

11 years agoutil: custom `inspect()` method may return an Object
Nathan Rajlich [Wed, 30 Jan 2013 03:06:32 +0000 (19:06 -0800)]
util: custom `inspect()` method may return an Object

This is more like how `JSON.stringify()` works.
Closes #2711.

11 years agoconsole: `console.dir()` bypasses inspect() methods
Nathan Rajlich [Wed, 30 Jan 2013 02:44:29 +0000 (18:44 -0800)]
console: `console.dir()` bypasses inspect() methods

Use the `customInspect: false` option of `util.inspect()` to bypass any custom
inspect() function on the object being logged.

Closes #2717.

11 years agodoc: events: add 'removeListener' event section
Ben Noordhuis [Mon, 11 Mar 2013 23:03:56 +0000 (00:03 +0100)]
doc: events: add 'removeListener' event section

Amends commit 84221fd by (also) documenting the 'removeListener' event
in a dedicated section, like the 'newListener' event.

Fixes #4977.

11 years agoblog: Post about v0.10.0
isaacs [Mon, 11 Mar 2013 15:56:47 +0000 (08:56 -0700)]
blog: Post about v0.10.0

11 years agoNow working on 0.10.1
isaacs [Mon, 11 Mar 2013 15:49:33 +0000 (08:49 -0700)]
Now working on 0.10.1

11 years agoMerge branch 'v0.10.0-release' into v0.10
isaacs [Mon, 11 Mar 2013 15:49:20 +0000 (08:49 -0700)]
Merge branch 'v0.10.0-release' into v0.10

11 years ago2013.03.11, Version 0.10.0 (Stable) v0.10.0
isaacs [Sat, 9 Mar 2013 17:24:56 +0000 (09:24 -0800)]
2013.03.11, Version 0.10.0 (Stable)

* npm: Upgrade to 1.2.14

* core: Append filename properly in dlopen on windows (isaacs)

* zlib: Manage flush flags appropriately (isaacs)

* domains: Handle errors thrown in nested error handlers (isaacs)

* buffer: Strip high bits when converting to ascii (Ben Noordhuis)

* win/msi: Enable modify and repair (Bert Belder)

* win/msi: Add feature selection for various node parts (Bert Belder)

* win/msi: use consistent registry key paths (Bert Belder)

* child_process: support sending dgram socket (Andreas Madsen)

* fs: Raise EISDIR on Windows when calling fs.read/write on a dir (isaacs)

* unix: fix strict aliasing warnings, macro-ify functions (Ben Noordhuis)

* unix: honor UV_THREADPOOL_SIZE environment var (Ben Noordhuis)

* win/tty: fix typo in color attributes enumeration (Bert Belder)

* win/tty: don't touch insert mode or quick edit mode (Bert Belder)

11 years agostream: Don't emit 'end' unless read() called
isaacs [Sun, 10 Mar 2013 02:05:39 +0000 (18:05 -0800)]
stream: Don't emit 'end' unless read() called

This solves the problem of calling `readable.pipe(writable)` after the
readable stream has already emitted 'end', as often is the case when
writing simple HTTP proxies.

The spirit of streams2 is that things will work properly, even if you
don't set them up right away on the first tick.

This approach breaks down, however, because pipe()ing from an ended
readable will just do nothing.  No more data will ever arrive, and the
writable will hang open forever never being ended.

However, that does not solve the case of adding a `on('end')` listener
after the stream has received the EOF chunk, if it was the first chunk
received (and thus, length was 0, and 'end' got emitted).  So, with
this, we defer the 'end' event emission until the read() function is
called.

Also, in pipe(), if the source has emitted 'end' already, we call the
cleanup/onend function on nextTick.  Piping from an already-ended stream
is thus the same as piping from a stream that is in the process of
ending.

Updates many tests that were relying on 'end' coming immediately, even
though they never read() from the req.

Fix #4942

11 years agostream: Avoid nextTick warning filling read buffer
isaacs [Sat, 9 Mar 2013 18:56:17 +0000 (10:56 -0800)]
stream: Avoid nextTick warning filling read buffer

In the function that pre-emptively fills the Readable queue, it relies
on a recursion through:

stream.push(chunk) ->
maybeReadMore(stream, state) ->
  if (not reading more and < hwm) stream.read(0) ->
stream._read() ->
stream.push(chunk) -> repeat.

Since this was only calling read() a single time, and then relying on a
future nextTick to collect more data, it ends up causing a nextTick
recursion error (and potentially a RangeError, even) if you have a very
high highWaterMark, and are getting very small chunks pushed
synchronously in _read (as happens with TLS, or many simple test
streams).

This change implements a new approach, so that read(0) is called
repeatedly as long as it is effective (that is, the length keeps
increasing), and thus quickly fills up the buffer for streams such as
these, without any stacks overflowing.

11 years agoevents: Handle missing error obj when domains in use
Julian Gruber [Fri, 8 Mar 2013 18:41:28 +0000 (19:41 +0100)]
events: Handle missing error obj when domains in use

so `ee.emit('error')` doesn't throw when domains are active

create an empty error only when handled by a domain

test for when no error is provided to an error event

11 years agohttp: ServerRequest does not timeout after 'end'
koichik [Sun, 10 Mar 2013 11:10:19 +0000 (20:10 +0900)]
http: ServerRequest does not timeout after 'end'

Fixes #4967

11 years agohttp: Do not setTimeout a not-yet-existent socket
isaacs [Sun, 10 Mar 2013 02:46:39 +0000 (18:46 -0800)]
http: Do not setTimeout a not-yet-existent socket

Fixes #4967

11 years agouv: Upgrade to 5462dab
isaacs [Sun, 10 Mar 2013 02:34:59 +0000 (18:34 -0800)]
uv: Upgrade to 5462dab

11 years agowin/msi: Fix typos
isaacs [Sat, 9 Mar 2013 17:22:00 +0000 (09:22 -0800)]
win/msi: Fix typos

11 years agonpm: Upgrade to 1.2.14 (fixed)
isaacs [Sat, 9 Mar 2013 17:11:22 +0000 (09:11 -0800)]
npm: Upgrade to 1.2.14 (fixed)

11 years agohttp: check if incoming parser has already been freed
hc [Fri, 8 Mar 2013 11:07:27 +0000 (06:07 -0500)]
http: check if incoming parser has already been freed

Fix #4948

This adds a check before setting the incoming parser
to null. Under certain circumstances it'll already be set to
null by freeParser().

Otherwise this will cause node to crash as it tries to set
null on something that is already null.

11 years agotimers: consistent this keyword in setImmediate
Andreas Madsen [Tue, 26 Feb 2013 17:26:09 +0000 (18:26 +0100)]
timers: consistent this keyword in setImmediate

When calling setImmediate with extra arguments the this keyword in the
callback would refer to the global object, but when not calling
setImmediate with extra arguments this would refer to the returned
handle object.

This commit fixes that inconsistency so its always set handle object.
The handle object was chosen for performance reasons.

11 years agodomain: Fix double-exit on nested domains
isaacs [Sat, 9 Mar 2013 15:00:21 +0000 (07:00 -0800)]
domain: Fix double-exit on nested domains

Minor oversight in fix for #4953.

11 years agoNow working on 0.11.0
isaacs [Sat, 9 Mar 2013 05:52:36 +0000 (21:52 -0800)]
Now working on 0.11.0

11 years agoNow working on 0.10.0
isaacs [Sat, 9 Mar 2013 05:52:09 +0000 (21:52 -0800)]
Now working on 0.10.0

11 years agolint
isaacs [Sat, 9 Mar 2013 04:26:26 +0000 (20:26 -0800)]
lint

11 years agostream: Always defer preemptive reading to improve latency
Gil Pedersen [Fri, 8 Mar 2013 08:26:53 +0000 (09:26 +0100)]
stream: Always defer preemptive reading to improve latency

11 years agoMerge remote-tracking branch 'ry/v0.8' into master
isaacs [Sat, 9 Mar 2013 02:59:44 +0000 (18:59 -0800)]
Merge remote-tracking branch 'ry/v0.8' into master

Conflicts:
AUTHORS
ChangeLog
src/node_version.h

11 years agotest: Fail faster in simple/test-cluster-bind-twice-v2
isaacs [Sat, 9 Mar 2013 02:31:21 +0000 (18:31 -0800)]
test: Fail faster in simple/test-cluster-bind-twice-v2

Crashing on windows, but at least now it's a crash rathert han a timeout.

11 years agotest: Kill zombies when debugger-client fails on windows
isaacs [Fri, 8 Mar 2013 17:29:13 +0000 (09:29 -0800)]
test: Kill zombies when debugger-client fails on windows

11 years agotest: Don't run async operation in process 'exit'
isaacs [Fri, 8 Mar 2013 17:10:57 +0000 (09:10 -0800)]
test: Don't run async operation in process 'exit'

Also, this seems to occasionally cause some annoying file-locking
errors in Windows.  Not sure if this is the best fix, but it seems
to make the warnings go away in that spot.

11 years agotest: Use copy instead of symlink in child-process-fork-exec-path
isaacs [Fri, 8 Mar 2013 16:29:36 +0000 (08:29 -0800)]
test: Use copy instead of symlink in child-process-fork-exec-path

11 years agotest: Trim cat output for windows
isaacs [Fri, 8 Mar 2013 00:29:30 +0000 (16:29 -0800)]
test: Trim cat output for windows