platform/upstream/nodejs.git
11 years agoMerge branch 'streams2'
isaacs [Sat, 15 Dec 2012 18:29:16 +0000 (10:29 -0800)]
Merge branch 'streams2'

11 years agotest: Update message tests for streams2
isaacs [Sat, 15 Dec 2012 01:43:02 +0000 (17:43 -0800)]
test: Update message tests for streams2

11 years agotest: Update simple/test-fs-{write,read}-stream-err for streams2
isaacs [Fri, 14 Dec 2012 18:51:04 +0000 (10:51 -0800)]
test: Update simple/test-fs-{write,read}-stream-err for streams2

Streams2 style streams might have already kicked off a read() or write()
before emitting 'data' events.  Make the test less dependent on ordering
of when data events occur.

11 years agostreams2: Still emit error if there was a write() cb
isaacs [Fri, 14 Dec 2012 18:49:16 +0000 (10:49 -0800)]
streams2: Still emit error if there was a write() cb

11 years agotest updates for streams2
isaacs [Thu, 13 Dec 2012 15:47:33 +0000 (07:47 -0800)]
test updates for streams2

11 years agotest: Fix many tests for http streams2 refactor
isaacs [Thu, 13 Dec 2012 17:52:08 +0000 (09:52 -0800)]
test: Fix many tests for http streams2 refactor

11 years agohttp: Refactor for streams2
isaacs [Thu, 13 Dec 2012 06:24:17 +0000 (22:24 -0800)]
http: Refactor for streams2

Because of some of the peculiarities of http, this has a bit of special
magic to handle cases where the IncomingMessage would wait forever in a
paused state.

In the server, if you do not begin consuming the request body by the
time the response emits 'finish', then it will be flushed out.

In the client, if you do not add a 'response' handler onto the request,
then the response stream will be flushed out.

11 years agochild_process: Remove stream.pause/resume calls
isaacs [Thu, 8 Nov 2012 01:19:14 +0000 (17:19 -0800)]
child_process: Remove stream.pause/resume calls

Unnecessary in streams2

11 years agotest updates
isaacs [Thu, 13 Dec 2012 06:07:05 +0000 (22:07 -0800)]
test updates

11 years agotty/stdin: Refactor for streams2
isaacs [Thu, 13 Dec 2012 06:06:35 +0000 (22:06 -0800)]
tty/stdin: Refactor for streams2

11 years agotest: Fix many tests for streams2 net refactor
isaacs [Thu, 13 Dec 2012 17:51:31 +0000 (09:51 -0800)]
test: Fix many tests for streams2 net refactor

11 years agonet: Refactor to use streams2
isaacs [Thu, 13 Dec 2012 05:18:57 +0000 (21:18 -0800)]
net: Refactor to use streams2

This is a combination of 6 commits.

* XXX net fixup lcase stream

* net: Refactor to use streams2

    Use 'socket.resume()' in many tests to trigger old-mode behavior.

* net: Call destroy() if shutdown() is not provided

    This is important for TTY wrap streams

* net: Call .end() in socket.destroySoon if necessary

    This makes the http 1.0 keepAlive test pass, also.

* net wtf-ish stuff kinda busted

* net fixup

11 years agobenchmark: Add once() function to net-pipe benchmark fixture
isaacs [Sun, 9 Dec 2012 23:12:19 +0000 (15:12 -0800)]
benchmark: Add once() function to net-pipe benchmark fixture

11 years agostreams2: Remove extraneous bufferSize setting
isaacs [Thu, 13 Dec 2012 19:15:29 +0000 (11:15 -0800)]
streams2: Remove extraneous bufferSize setting

11 years agodocs: streams2
isaacs [Thu, 13 Dec 2012 19:15:49 +0000 (11:15 -0800)]
docs: streams2

11 years agostreams2: Emit pause/resume events
isaacs [Thu, 13 Dec 2012 06:17:57 +0000 (22:17 -0800)]
streams2: Emit pause/resume events

11 years agostreams2: Support a Readable hwm of 0
isaacs [Thu, 13 Dec 2012 06:03:19 +0000 (22:03 -0800)]
streams2: Support a Readable hwm of 0

Necessary for proper stdin functioning

11 years agostreams2: Writable only emit 'finish' once
isaacs [Wed, 12 Dec 2012 08:59:54 +0000 (00:59 -0800)]
streams2: Writable only emit 'finish' once

11 years agostreams2: Call read(0) on resume()
isaacs [Mon, 10 Dec 2012 23:58:23 +0000 (15:58 -0800)]
streams2: Call read(0) on resume()

Otherwise (especially with stdin) you sometimes end up in cases
where the high water mark is zero, and the current buffer is at 0,
and it doesn't need a readable event, so it never calls _read().

11 years agolint
isaacs [Thu, 6 Dec 2012 18:21:22 +0000 (10:21 -0800)]
lint

11 years agotest: Sync writables may emit finish before callbacks
isaacs [Thu, 6 Dec 2012 15:29:42 +0000 (07:29 -0800)]
test: Sync writables may emit finish before callbacks

11 years agostreams2: NextTick the emit('readable') in resume()
isaacs [Wed, 5 Dec 2012 02:19:07 +0000 (18:19 -0800)]
streams2: NextTick the emit('readable') in resume()

Otherwise resume() will cause data to be emitted before it can be handled.

11 years agostreams2: pause() should be immediate
isaacs [Wed, 5 Dec 2012 01:34:17 +0000 (17:34 -0800)]
streams2: pause() should be immediate

11 years agostreams2: Switch to old-mode immediately, not nextTick
isaacs [Wed, 5 Dec 2012 01:20:12 +0000 (17:20 -0800)]
streams2: Switch to old-mode immediately, not nextTick

This fixes the CONNECT/Upgrade HTTP functionality, which was not getting
sliced properly, because readable wasn't emitted on this tick.

Conflicts:

test/simple/test-http-connect.js

11 years agostreams2: Set readable=false on end
isaacs [Wed, 5 Dec 2012 19:27:46 +0000 (11:27 -0800)]
streams2: Set readable=false on end

11 years agodoc: Crypto streaming interface
isaacs [Tue, 30 Oct 2012 22:46:43 +0000 (15:46 -0700)]
doc: Crypto streaming interface

11 years agotest: Tests for streaming crypto interfaces
isaacs [Tue, 30 Oct 2012 18:19:53 +0000 (11:19 -0700)]
test: Tests for streaming crypto interfaces

11 years agocrypto: Streaming interface for Sign and Verify
isaacs [Tue, 30 Oct 2012 17:18:55 +0000 (10:18 -0700)]
crypto: Streaming interface for Sign and Verify

11 years agocrypto: Streaming interface for cipher/decipher/iv
isaacs [Mon, 29 Oct 2012 23:36:20 +0000 (16:36 -0700)]
crypto: Streaming interface for cipher/decipher/iv

11 years agocrypto: Streaming api for Hmac
isaacs [Mon, 29 Oct 2012 22:21:25 +0000 (15:21 -0700)]
crypto: Streaming api for Hmac

11 years agocrypto: Streaming interface for Hash
isaacs [Mon, 29 Oct 2012 18:31:59 +0000 (11:31 -0700)]
crypto: Streaming interface for Hash

11 years agotest: Writable stream end() method doesn't take a callback
isaacs [Fri, 5 Oct 2012 15:26:49 +0000 (08:26 -0700)]
test: Writable stream end() method doesn't take a callback

11 years agotest: simple/test-file-write-stream needs to use 0 lowWaterMark
isaacs [Fri, 5 Oct 2012 15:07:12 +0000 (08:07 -0700)]
test: simple/test-file-write-stream needs to use 0 lowWaterMark

11 years agotest: Fix test-repl-autolibs inspect call
isaacs [Tue, 2 Oct 2012 23:54:49 +0000 (16:54 -0700)]
test: Fix test-repl-autolibs inspect call

11 years agozlib: streams2
isaacs [Tue, 2 Oct 2012 23:15:39 +0000 (16:15 -0700)]
zlib: streams2

11 years agofs: streams2
isaacs [Fri, 5 Oct 2012 00:44:48 +0000 (17:44 -0700)]
fs: streams2

11 years agostreams2: Unpipe on dest.emit('close')
isaacs [Thu, 29 Nov 2012 06:09:28 +0000 (22:09 -0800)]
streams2: Unpipe on dest.emit('close')

11 years agostreams2: Remove pipe if the dest emits error
isaacs [Thu, 29 Nov 2012 04:45:16 +0000 (20:45 -0800)]
streams2: Remove pipe if the dest emits error

11 years agostreams2: Handle pipeChunkSize properly
isaacs [Wed, 28 Nov 2012 18:46:24 +0000 (10:46 -0800)]
streams2: Handle pipeChunkSize properly

11 years agostreams2: Set 'readable' flag on Readable streams
isaacs [Wed, 28 Nov 2012 02:21:05 +0000 (18:21 -0800)]
streams2: Set 'readable' flag on Readable streams

11 years agostreams2: Refactor out .once() usage from Readable.pipe()
isaacs [Wed, 28 Nov 2012 09:25:39 +0000 (01:25 -0800)]
streams2: Refactor out .once() usage from Readable.pipe()

11 years agostreams2: Get rid of .once() usage in Readable.pipe
isaacs [Wed, 28 Nov 2012 02:20:16 +0000 (18:20 -0800)]
streams2: Get rid of .once() usage in Readable.pipe

Significant performance impact

11 years agostreams2: Remove function.bind() usage
isaacs [Sat, 17 Nov 2012 04:24:14 +0000 (15:24 +1100)]
streams2: Remove function.bind() usage

It's too slow, unfortunately.

11 years agostreams2: Do multipipe without always using forEach
isaacs [Sat, 17 Nov 2012 03:27:41 +0000 (14:27 +1100)]
streams2: Do multipipe without always using forEach

The Array.forEach call is too expensive.

11 years agotest: Update stream2 transform for corrected behavior
isaacs [Tue, 13 Nov 2012 07:41:17 +0000 (23:41 -0800)]
test: Update stream2 transform for corrected behavior

11 years agostreams2: Writable organization, add 'finishing' flag
isaacs [Tue, 13 Nov 2012 07:33:06 +0000 (23:33 -0800)]
streams2: Writable organization, add 'finishing' flag

11 years agostreams2: Only emit 'readable' when needed
isaacs [Tue, 13 Nov 2012 07:32:05 +0000 (23:32 -0800)]
streams2: Only emit 'readable' when needed

11 years agostreams2: Set Readable lwm to 0 by default
isaacs [Tue, 13 Nov 2012 07:31:40 +0000 (23:31 -0800)]
streams2: Set Readable lwm to 0 by default

11 years agostreams2: Add high water mark for Readable
isaacs [Tue, 13 Nov 2012 07:31:25 +0000 (23:31 -0800)]
streams2: Add high water mark for Readable

Also, organize the numeric settings a bit on the ReadableState class

11 years agostreams2: Export Readable/Writable State classes
isaacs [Tue, 13 Nov 2012 07:30:10 +0000 (23:30 -0800)]
streams2: Export Readable/Writable State classes

11 years agostreams2: Fix duplex no-half-open logic
isaacs [Tue, 13 Nov 2012 07:28:56 +0000 (23:28 -0800)]
streams2: Fix duplex no-half-open logic

11 years agostreams2: Abstract out onread function
isaacs [Wed, 31 Oct 2012 21:30:30 +0000 (14:30 -0700)]
streams2: Abstract out onread function

11 years agostreams2: Use StringDecoder.end
isaacs [Fri, 12 Oct 2012 18:45:17 +0000 (11:45 -0700)]
streams2: Use StringDecoder.end

11 years agostreams2: flow() is not always bound to src
isaacs [Fri, 12 Oct 2012 17:03:03 +0000 (10:03 -0700)]
streams2: flow() is not always bound to src

11 years agotest: fixture for streams2 testing
isaacs [Wed, 10 Oct 2012 04:56:02 +0000 (21:56 -0700)]
test: fixture for streams2 testing

11 years agostreams2: Fix regression from Duplex ctor assignment
isaacs [Wed, 10 Oct 2012 00:42:47 +0000 (17:42 -0700)]
streams2: Fix regression from Duplex ctor assignment

11 years agotest: Writable bufferizing, non-bufferizing, and callbacks
isaacs [Wed, 10 Oct 2012 00:37:40 +0000 (17:37 -0700)]
test: Writable bufferizing, non-bufferizing, and callbacks

11 years agostreams2: Support write(chunk,[encoding],[callback])
isaacs [Wed, 10 Oct 2012 00:31:29 +0000 (17:31 -0700)]
streams2: Support write(chunk,[encoding],[callback])

11 years agostreams2: Allow Writables to opt out of pre-buffer-izing
isaacs [Tue, 9 Oct 2012 18:01:53 +0000 (11:01 -0700)]
streams2: Allow Writables to opt out of pre-buffer-izing

11 years agostreams2: ctor guards on Stream classes
isaacs [Mon, 8 Oct 2012 21:43:17 +0000 (14:43 -0700)]
streams2: ctor guards on Stream classes

11 years agostreams2: Tests of new interfaces
isaacs [Sun, 7 Oct 2012 20:26:03 +0000 (13:26 -0700)]
streams2: Tests of new interfaces

11 years agostreams2: Handle immediate synthetic transforms properly
isaacs [Sun, 7 Oct 2012 20:12:21 +0000 (13:12 -0700)]
streams2: Handle immediate synthetic transforms properly

11 years agostreams2: Correct drain/return logic
isaacs [Fri, 5 Oct 2012 14:45:03 +0000 (07:45 -0700)]
streams2: Correct drain/return logic

It was testing the length *before* adding the current chunk, which
is the opposite of correct.

Also, the return value was flipped.

11 years agostreams2: Allow 0 as a lowWaterMark value
isaacs [Fri, 5 Oct 2012 14:43:34 +0000 (07:43 -0700)]
streams2: Allow 0 as a lowWaterMark value

11 years agotransform: Automatically read() on _write when read buffer is empty
isaacs [Thu, 4 Oct 2012 23:58:43 +0000 (16:58 -0700)]
transform: Automatically read() on _write when read buffer is empty

11 years agostreams2: Make Transform streams pull-style
isaacs [Thu, 4 Oct 2012 20:26:16 +0000 (13:26 -0700)]
streams2: Make Transform streams pull-style

That is, the transform is triggered by a _read, not by a _write.

This way, backpressure works properly.

11 years agostreams2: setEncoding and abstract out endReadable
isaacs [Wed, 3 Oct 2012 23:52:14 +0000 (16:52 -0700)]
streams2: setEncoding and abstract out endReadable

11 years agostreams2: Set flowing=true when flowing
isaacs [Thu, 4 Oct 2012 00:43:27 +0000 (17:43 -0700)]
streams2: Set flowing=true when flowing

11 years agostreams2: Convert strings to buffers before passing to _write()
isaacs [Tue, 2 Oct 2012 23:28:02 +0000 (16:28 -0700)]
streams2: Convert strings to buffers before passing to _write()

11 years agostreams2: The new stream base classes
isaacs [Tue, 2 Oct 2012 22:44:50 +0000 (15:44 -0700)]
streams2: The new stream base classes

11 years agoAdd 'stream' as a native module in repl
isaacs [Tue, 2 Oct 2012 23:11:36 +0000 (16:11 -0700)]
Add 'stream' as a native module in repl

11 years agomodule: Support cycles in native module requires
isaacs [Tue, 2 Oct 2012 23:10:58 +0000 (16:10 -0700)]
module: Support cycles in native module requires

11 years agoDon't allow invalid encodings in StringDecoder class
isaacs [Fri, 5 Oct 2012 00:43:15 +0000 (17:43 -0700)]
Don't allow invalid encodings in StringDecoder class

11 years agoMerge remote-tracking branch 'ry/v0.8' into master
isaacs [Fri, 14 Dec 2012 00:57:58 +0000 (16:57 -0800)]
Merge remote-tracking branch 'ry/v0.8' into master

Conflicts:
AUTHORS
ChangeLog
deps/uv/test/test-spawn.c
deps/uv/uv.gyp
src/cares_wrap.cc
src/node.cc
src/node_version.h
test/simple/test-buffer.js
tools/gyp/pylib/gyp/common.py
tools/install.py

11 years agoblog: Post for 0.8.16
isaacs [Thu, 13 Dec 2012 19:50:47 +0000 (11:50 -0800)]
blog: Post for 0.8.16

11 years agoNow working on 0.8.17
isaacs [Thu, 13 Dec 2012 19:50:35 +0000 (11:50 -0800)]
Now working on 0.8.17

11 years agoMerge commit 'v0.8.16' into v0.8
isaacs [Thu, 13 Dec 2012 19:50:15 +0000 (11:50 -0800)]
Merge commit 'v0.8.16' into v0.8

11 years ago2012.12.13, Version 0.8.16 (Stable) v0.8.16
isaacs [Wed, 12 Dec 2012 22:44:54 +0000 (14:44 -0800)]
2012.12.13, Version 0.8.16 (Stable)

* npm: Upgrade to 1.1.69

* fs: fix WriteStream/ReadStream fd leaks (Ben Noordhuis)

* crypto: fix leak in GetPeerCertificate (Fedor Indutny)

* buffer: Don't double-negate numeric buffer arg (Trevor Norris)

* net: More accurate IP address validation and IPv6 dotted notation. (Joshua Erickson)

11 years agodeps: upgrade libuv to e079a99
Ben Noordhuis [Thu, 13 Dec 2012 19:23:01 +0000 (20:23 +0100)]
deps: upgrade libuv to e079a99

11 years agonpm: Upgrade to v1.1.69
isaacs [Wed, 12 Dec 2012 22:41:28 +0000 (14:41 -0800)]
npm: Upgrade to v1.1.69

11 years agofs: fix WriteStream fd leak
Ben Noordhuis [Tue, 11 Dec 2012 15:01:58 +0000 (16:01 +0100)]
fs: fix WriteStream fd leak

Close the file descriptor when a write operation fails.

Fixes #4387.

11 years agofs: fix ReadStream fd leak
Ben Noordhuis [Tue, 11 Dec 2012 13:45:45 +0000 (14:45 +0100)]
fs: fix ReadStream fd leak

Close the file descriptor when a read operation fails.

Fixes #4387.

11 years agotest: add common.mustCall function
Ben Noordhuis [Tue, 31 Jul 2012 15:47:53 +0000 (17:47 +0200)]
test: add common.mustCall function

Verifies that the callback gets invoked <n> times during the lifetime of the
test script.

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

11 years agodoc: Add nodejstr to community page
isaacs [Tue, 11 Dec 2012 00:56:49 +0000 (16:56 -0800)]
doc: Add nodejstr to community page

11 years agoevents: fix typos in code comment
Ryunosuke SATO [Mon, 10 Dec 2012 09:32:56 +0000 (18:32 +0900)]
events: fix typos in code comment

- newListeners -> newListener

11 years agoevents: setMaxListeners() should not have side effects
Ryunosuke SATO [Mon, 10 Dec 2012 09:16:13 +0000 (18:16 +0900)]
events: setMaxListeners() should not have side effects

This object initialization has been unnecessary since 12cf730b.

Ref #3803.

11 years agoevents: use assigned variable instead of arguments
Ryunosuke SATO [Mon, 10 Dec 2012 09:07:23 +0000 (18:07 +0900)]
events: use assigned variable instead of arguments

Always `arguments[0]` is used when `EventEmitter#emit` called.
Using assigned variable is faster than `arguments[0]`.

11 years agoevents: use null assignment instead of deleting property
Ryunosuke SATO [Mon, 10 Dec 2012 04:34:33 +0000 (13:34 +0900)]
events: use null assignment instead of deleting property

11 years agohttp: protect against response splitting attacks
Bert Belder [Mon, 19 Nov 2012 19:42:35 +0000 (20:42 +0100)]
http: protect against response splitting attacks

11 years agolint
isaacs [Sat, 8 Dec 2012 00:58:16 +0000 (16:58 -0800)]
lint

introduced in 5b65638.

11 years agofs: Raise error when null bytes detected in paths
isaacs [Sat, 8 Dec 2012 00:50:12 +0000 (16:50 -0800)]
fs: Raise error when null bytes detected in paths

Reworking of @bnoordhuis's more aggressive approach.

11 years agodoc: remove broken require.extensions example
Ben Noordhuis [Thu, 6 Dec 2012 20:58:29 +0000 (21:58 +0100)]
doc: remove broken require.extensions example

Fixes #4384.

11 years agotls, https: add tls handshake timeout
Ben Noordhuis [Mon, 3 Dec 2012 17:29:01 +0000 (18:29 +0100)]
tls, https: add tls handshake timeout

Don't allow connections to stall indefinitely if the SSL/TLS handshake does
not complete.

Adds a new tls.Server and https.Server configuration option, handshakeTimeout.

Fixes #4355.

11 years agoprocess: add getgroups(), setgroups(), initgroups()
Ben Noordhuis [Tue, 4 Dec 2012 05:36:23 +0000 (06:36 +0100)]
process: add getgroups(), setgroups(), initgroups()

DRY the getuid(), getgid(), etc. functions while we're at it.

11 years agobuffer: remove unused #includes
Ben Noordhuis [Thu, 6 Dec 2012 03:45:11 +0000 (04:45 +0100)]
buffer: remove unused #includes

11 years agotest: remove simple/test-child-process-fork2
Ben Noordhuis [Wed, 5 Dec 2012 04:43:29 +0000 (05:43 +0100)]
test: remove simple/test-child-process-fork2

The test assumes the parent and the child are scheduled fairly. Probably true
most of the time but not always, making it fail spuriously.

Bad test, remove it.

11 years agotest: fix simple/test-debug-brk-file race condition
Shigeki Ohtsu [Wed, 28 Nov 2012 08:18:06 +0000 (17:18 +0900)]
test: fix simple/test-debug-brk-file race condition

V8 debug agent needs some time to be ready and no longer sends the first event
break response to a debug client. We wait some time to connect the agent and
check its break status by obtaining breakpoint list and seeing if it exists on
line 0.

11 years agofs: add long stacktrace debugging facility
Ben Noordhuis [Tue, 4 Dec 2012 02:35:54 +0000 (03:35 +0100)]
fs: add long stacktrace debugging facility

Enable long stacktraces if NODE_DEBUG=fs is set in the environment. Only
applies to the default rethrow callback; it's to help you find places where
you forgot to pass in a callback.

11 years agofs: fix 'object is not a function' callback errors
Ben Noordhuis [Tue, 4 Dec 2012 02:17:52 +0000 (03:17 +0100)]
fs: fix 'object is not a function' callback errors

Use a default callback if the user omitted one. Avoids errors like the one
below:

  fs.js:777
      if (err) return callback(err);
                      ^
  TypeError: object is not a function
          at fs.appendFile (fs.js:777:21)
          at Object.oncomplete (fs.js:297:15)

This commit fixes the behavior of fs.lchmod(), fs.lchown() and fs.readFile()
when the callback is omitted. Before, they silently swallowed errors.

Fixes #4352.

11 years agoos: throw when os.networkInterfaces() fails
Bert Belder [Mon, 3 Dec 2012 21:34:27 +0000 (22:34 +0100)]
os: throw when os.networkInterfaces() fails