platform/upstream/nodejs.git
11 years agonet: s/closed/ended/ in write-after-fin message
isaacs [Sat, 2 Mar 2013 19:50:33 +0000 (11:50 -0800)]
net: s/closed/ended/ in write-after-fin message

11 years agonet: Provide better error when writing after FIN
isaacs [Sat, 2 Mar 2013 18:20:33 +0000 (10:20 -0800)]
net: Provide better error when writing after FIN

The stock writable stream "write after end" message is overly vague, if
you have clearly not called end() yourself yet.

When we receive a FIN from the other side, and call destroySoon() as a
result, then generate an EPIPE error (which is what would happen if you
did actually write to the socket), with a message explaining what
actually happened.

11 years agowindows/msi: fix msi build issue with WiX 3.7/3.8
Raymond Feng [Sat, 2 Mar 2013 18:08:08 +0000 (10:08 -0800)]
windows/msi: fix msi build issue with WiX 3.7/3.8

The `heat` tool that gathers NPM source files wasn't getting called.
Closes #4896

11 years agotest: unlink temp file at test start
Ben Noordhuis [Sat, 2 Mar 2013 01:43:01 +0000 (02:43 +0100)]
test: unlink temp file at test start

The file has a long name that's apparently impossible to remove with
`git clean` on Windows.

11 years agoevents: add type checks to once
Trevor Norris [Wed, 27 Feb 2013 08:15:28 +0000 (00:15 -0800)]
events: add type checks to once

Also cleanup unnecessary use of "self" since it will always be called
using .apply() from emit.

11 years agoevents: emit cleanup
Trevor Norris [Tue, 26 Feb 2013 19:20:19 +0000 (11:20 -0800)]
events: emit cleanup

Cleanup check logic. Place vars at top. Remove PROCESS.

11 years agoevents: additional type check for addListener
Trevor Norris [Tue, 26 Feb 2013 18:20:44 +0000 (10:20 -0800)]
events: additional type check for addListener

Check both passed args to addListener.

Place var at beginning.

11 years agoevents: _events to object and undefined not null
Trevor Norris [Tue, 26 Feb 2013 17:47:36 +0000 (09:47 -0800)]
events: _events to object and undefined not null

By making sure the _events is always an object there is one less check
that needs to be performed by emit.

Use undefined instead of null. typeof checks are a lot faster than
isArray.

There are a few places where the this._events check cannot be removed
because it is possible for the user to call those methods after using
utils.extend to create their own EventEmitter, but before it has
actually been instantiated.

11 years agoevents: removeListener add checks and cleanup
Trevor Norris [Thu, 21 Feb 2013 07:54:38 +0000 (23:54 -0800)]
events: removeListener add checks and cleanup

Remove unecessary splice for single listener events. Add type check for
"type" argument.

11 years agoevents: type check listeners
Trevor Norris [Wed, 20 Feb 2013 23:33:24 +0000 (15:33 -0800)]
events: type check listeners

Make sure the argument passed is a string. Also use typeof === function
check instead of isArray().

11 years agoevents: simplify removeAllListeners logic
Trevor Norris [Wed, 20 Feb 2013 23:19:05 +0000 (15:19 -0800)]
events: simplify removeAllListeners logic

Unnecessary checks were being performed on if the event existed before
being removed.

_events starts out as null, so reset to null when emptied.

Checking typeof is a lot cheaper than isArray().

11 years agoevents: type check setMaxListeners, cleanup throws
Trevor Norris [Wed, 20 Feb 2013 23:04:58 +0000 (15:04 -0800)]
events: type check setMaxListeners, cleanup throws

setMaxListeners will now make sure a positive number is passed. Also
throwing more definitive Error types.

11 years agoevents: ensure usingDomain is always boolean
Trevor Norris [Wed, 20 Feb 2013 22:52:46 +0000 (14:52 -0800)]
events: ensure usingDomain is always boolean

Small addition to ensure that exports.usingDomains is always a bool.

11 years agoevents: add check for listeners length
Trevor Norris [Thu, 14 Feb 2013 08:48:11 +0000 (00:48 -0800)]
events: add check for listeners length

Ability to return just the length of listeners for a given type, using
EventEmitter.listenerCount(emitter, event). This will be a lot cheaper
than creating a copy of the listeners array just to check its length.

11 years agodeps: upgrade libuv to 7e59f9b
Ben Noordhuis [Sat, 2 Mar 2013 00:49:19 +0000 (01:49 +0100)]
deps: upgrade libuv to 7e59f9b

11 years agodoc change for Readable._read()
Lars-Magnus Skog [Fri, 1 Mar 2013 20:09:36 +0000 (21:09 +0100)]
doc change for Readable._read()

11 years agodoc: Clarify advisory-ness of stream._read() argument
isaacs [Fri, 1 Mar 2013 22:26:35 +0000 (14:26 -0800)]
doc: Clarify advisory-ness of stream._read() argument

11 years agodoc: Update to reflect new _read() interface
Gil Pedersen [Fri, 1 Mar 2013 22:15:28 +0000 (23:15 +0100)]
doc: Update to reflect new _read() interface

11 years agodoc: Fix readable.unshift() example
Evan Oxfeld [Fri, 1 Mar 2013 20:10:36 +0000 (15:10 -0500)]
doc: Fix readable.unshift() example

Slice the portion of the buffer to unshift back into the read queue

11 years agobuild/windows: don't use wrong version number
Scott Blomquist [Fri, 1 Mar 2013 20:03:44 +0000 (12:03 -0800)]
build/windows: don't use wrong version number

We were using a global temp file while setting the NODE_VERSION
environment variable. This resulted in simultaneous builds swapping
version numbers on occasion.

This patch removes the use of a temp file for this.

11 years agodoc: Correct version in changelog
isaacs [Fri, 1 Mar 2013 19:23:55 +0000 (11:23 -0800)]
doc: Correct version in changelog

11 years agoNow working on 0.9.12
isaacs [Fri, 1 Mar 2013 19:19:38 +0000 (11:19 -0800)]
Now working on 0.9.12

11 years agoMerge branch 'v0.9.11-release'
isaacs [Fri, 1 Mar 2013 19:19:20 +0000 (11:19 -0800)]
Merge branch 'v0.9.11-release'

11 years ago2013.03.01, Version 0.9.10 (Unstable) v0.9.11
isaacs [Fri, 1 Mar 2013 17:58:35 +0000 (09:58 -0800)]
2013.03.01, Version 0.9.10 (Unstable)

* V8: downgrade 3.14.5

* openssl: update to 1.0.1e

* darwin: Make process.title work properly (Ben Noordhuis)

* fs: Support mode/flag options to read/append/writeFile (isaacs)

* stream: _read() no longer takes a callback (isaacs)

* stream: Add stream.unshift(chunk) (isaacs)

* stream: remove lowWaterMark feature (isaacs)

* net: omit superfluous 'connect' event (Ben Noordhuis)

* build, windows: disable SEH (Ben Noordhuis)

* core: remove errno global (Ben Noordhuis)

* core: Remove the nextTick for running the main file (isaacs)

* core: Mark exit() calls with status codes (isaacs)

* core: Fix debug signal handler race condition lock (isaacs)

* crypto: clear error stack (Ben Noordhuis)

* test: optionally set common.PORT via env variable (Timothy J Fontaine)

* path: Throw TypeError on non-string args to path.resolve/join (isaacs, Arianit Uka)

* crypto: fix uninitialized memory access in openssl (Ben Noordhuis)

11 years agoblog: Do not pass undefined to path.join
isaacs [Fri, 1 Mar 2013 18:21:21 +0000 (10:21 -0800)]
blog: Do not pass undefined to path.join

11 years agofs: Support mode/flag options to read/append/writeFile
isaacs [Fri, 1 Mar 2013 17:10:26 +0000 (09:10 -0800)]
fs: Support mode/flag options to read/append/writeFile

Fix #4841

11 years agotest: Put fs write test files in tmp
isaacs [Fri, 1 Mar 2013 16:54:49 +0000 (08:54 -0800)]
test: Put fs write test files in tmp

This prevents fixture litter when these tests fail.

11 years agobuild: windows should append date if nightly
Timothy J Fontaine [Fri, 1 Mar 2013 00:56:37 +0000 (16:56 -0800)]
build: windows should append date if nightly

11 years agodoc: Provide 2 examples of SimpleProtocol parser
isaacs [Thu, 28 Feb 2013 23:42:55 +0000 (15:42 -0800)]
doc: Provide 2 examples of SimpleProtocol parser

The first example uses Readable, and shows the use of
readable.unshift().  The second uses the Transform class, showing that
it's much simpler in this case.

11 years agostream: There is no _read cb, there is only push
isaacs [Thu, 28 Feb 2013 23:32:32 +0000 (15:32 -0800)]
stream: There is no _read cb, there is only push

This makes it so that `stream.push(chunk)` is the only way to signal the
end of reading, removing the confusing disparity between the
callback-style _read method, and the fact that most real-world streams
do not have a 1:1 corollation between the "please give me data" event,
and the actual arrival of a chunk of data.

It is still possible, of course, to implement a `CallbackReadable` on
top of this.  Simply provide a method like this as the callback:

    function readCallback(er, chunk) {
      if (er)
        stream.emit('error', er);
      else
        stream.push(chunk);
    }

However, *only* fs streams actually would behave in this way, so it
makes not a lot of sense to make TCP, TLS, HTTP, and all the rest have
to bend into this uncomfortable paradigm.

11 years agostream: Add stream.unshift(chunk)
isaacs [Thu, 28 Feb 2013 03:32:19 +0000 (19:32 -0800)]
stream: Add stream.unshift(chunk)

11 years agostream: Break up the onread function
isaacs [Thu, 28 Feb 2013 00:56:30 +0000 (16:56 -0800)]
stream: Break up the onread function

A primary motivation of this is to make the onread function more
inline-friendly, but also to make it more easy to explore not having
onread at all, in favor of always using push() to signal the end of
reading.

11 years agonet: omit superfluous 'connect' event
Ben Noordhuis [Thu, 28 Feb 2013 22:25:29 +0000 (23:25 +0100)]
net: omit superfluous 'connect' event

Don't emit a 'connect' event on sockets that are handed off to
net.Server 'connection' event listeners.

1. It's superfluous because the connection has already been established
   at that point.

2. The implementation is arguably wrong because the event is emitted on
   the same tick of the event loop while the rule of thumb is to always
   emit it on the next one.

This has been tried before in commit f0a440d but was reverted again in
ede1acc because the change was incomplete (at least one test hadn't
been updated).

Fixes #1047 (again).

11 years agodeps: upgrade libuv to 2a8d2a5
Ben Noordhuis [Fri, 1 Mar 2013 01:04:29 +0000 (02:04 +0100)]
deps: upgrade libuv to 2a8d2a5

11 years agotest: disable simple/test-process-getgroups on os x
Ben Noordhuis [Thu, 28 Feb 2013 23:44:55 +0000 (00:44 +0100)]
test: disable simple/test-process-getgroups on os x

The output of `id -G` is unreliable on OS X. It uses an undocumented
Libsystem function called getgrouplist_2() that includes some auxiliary
groups that the POSIX getgroups() function does not return.

Or rather, not always. It leads to fun bug chases where the test fails
in one terminal but not in another.

11 years agoMerge remote-tracking branch 'origin/v0.8'
Ben Noordhuis [Thu, 28 Feb 2013 22:13:54 +0000 (23:13 +0100)]
Merge remote-tracking branch 'origin/v0.8'

11 years agotest: fix tap output on windows
Timothy J Fontaine [Thu, 28 Feb 2013 19:46:59 +0000 (11:46 -0800)]
test: fix tap output on windows

Test output is always \n and not platform dependent

11 years agolib, src: remove errno global
Ben Noordhuis [Thu, 28 Feb 2013 16:50:14 +0000 (17:50 +0100)]
lib, src: remove errno global

Remove the errno global. It's a property on the process object now.

Fixes #3095.

11 years agotest: add cleanup to long path test
Scott Blomquist [Thu, 28 Feb 2013 17:18:12 +0000 (09:18 -0800)]
test: add cleanup to long path test

11 years agoMerge remote-tracking branch 'origin/v0.8'
Ben Noordhuis [Thu, 28 Feb 2013 15:58:24 +0000 (16:58 +0100)]
Merge remote-tracking branch 'origin/v0.8'

Conflicts:
AUTHORS
ChangeLog
deps/uv/src/unix/pipe.c
lib/http.js
src/node_version.h

11 years agobuild, windows: disable SEH
Ben Noordhuis [Thu, 28 Feb 2013 15:35:17 +0000 (16:35 +0100)]
build, windows: disable SEH

Turn off safe exception handlers, they're incompatible with how
openssl is compiled / linked under MSVS 2012.

Addresses the following build error:

  openssl.lib(x86cpuid.obj) : error LNK2026: module unsafe for SAFESEH
  image. [g:\jenkins\workspace\nodejs-oneoff\node.vcxproj]
  openssl.lib(x86.obj) : error LNK2026: module unsafe for SAFESEH
  image. [g:\jenkins\workspace\nodejs-oneoff\node.vcxproj]
  # etc. etc.
  g:\jenkins\workspace\nodejs-oneoff\Release\node.exe : fatal error
  LNK1281: Unable to generate SAFESEH image.
  [g:\jenkins\workspace\nodejs-oneoff\node.vcxproj]

Fixes #4242.

11 years agodoc: update instructions on home page
Ben Noordhuis [Thu, 28 Feb 2013 15:30:45 +0000 (16:30 +0100)]
doc: update instructions on home page

Document how to run the example on the home page in more detail.

Apparently our Windows brethren are prone to double-clicking on the
binary instead of running it from the command line.

Fixes #4854.

11 years agoprocess: separate nextTick domain logic
Trevor Norris [Wed, 27 Feb 2013 19:46:35 +0000 (11:46 -0800)]
process: separate nextTick domain logic

It's cleaner to only load domain ticker logic when the domains are being
used. This makes execution slightly quicker in both cases, and simpler
from the spinner since there is no need to check if the latest callback
requires use of domains.

11 years agocore: Remove the nextTick for running the main file
isaacs [Wed, 27 Feb 2013 19:24:02 +0000 (11:24 -0800)]
core: Remove the nextTick for running the main file

Not necessary, since we can handle the error properly on the first tick
now, even if there are event listeners, etc.

Additionally, this removes the unnecessary "_needTickCallback" from
startup, since Module.loadMain() will kick off a nextTick callback right
after it runs the main module.

Fix #4856

11 years agocore: Mark exit() calls with status codes
isaacs [Wed, 27 Feb 2013 19:23:20 +0000 (11:23 -0800)]
core: Mark exit() calls with status codes

Also, exit with 128+n for signal exit n, as is The Unix Way.

11 years agocrypto: clear error stack
Ben Noordhuis [Wed, 27 Feb 2013 22:31:38 +0000 (23:31 +0100)]
crypto: clear error stack

Clear OpenSSL's error stack on return from Connection::HandleSSLError().
This stops stale errors from popping up later in the lifecycle of the
SSL connection where they would cause spurious failures.

This commit causes a 1-2% performance regression on `make bench-tls`.
We'll address that in follow-up commits if possible but let's ensure
correctness first.

Fixes #4771.

11 years agoopenssl: regenerate asm files for openssl 1.0.1e
Scott Blomquist [Wed, 27 Feb 2013 06:52:58 +0000 (22:52 -0800)]
openssl: regenerate asm files for openssl 1.0.1e

11 years agostream: Writables are not pipe()able
isaacs [Mon, 25 Feb 2013 06:14:30 +0000 (22:14 -0800)]
stream: Writables are not pipe()able

This handles the fact that stream.Writable inherits from the Stream class,
meaning that it has the legacy pipe() method.  Override that with a pipe()
method that emits an error.

Ensure that Duplex streams ARE still pipe()able, however.

Since the 'readable' flag on streams is sometimes temporary, it's probably
better not to put too much weight on that.  But if something is an instanceof
Writable, rather than of Readable or Duplex, then it's safe to say that
reading from it is the wrong thing to do.

Fix #3647

11 years agotest: Use common.PORT in simple/test-http-timeout
isaacs [Wed, 27 Feb 2013 01:54:18 +0000 (17:54 -0800)]
test: Use common.PORT in simple/test-http-timeout

11 years agotest: Move test-net-connect-timeout to test/internet
isaacs [Wed, 27 Feb 2013 01:39:04 +0000 (17:39 -0800)]
test: Move test-net-connect-timeout to test/internet

It is not a valid test unless you're connected to the internet, and causes
a lot of spurious failures on Linux anyway, as it's highly dependent on
timing of things that we don't have any control over.

11 years agotest: Use common.PORT to determine debugger port
isaacs [Wed, 27 Feb 2013 01:33:30 +0000 (17:33 -0800)]
test: Use common.PORT to determine debugger port

11 years agotest: Fix debugger repl tests
isaacs [Wed, 27 Feb 2013 00:42:47 +0000 (16:42 -0800)]
test: Fix debugger repl tests

This makes the output of simple/test-debugger-repl and
simle/test-debugger-repl-utf8 mirror an actual debugger session, so it's
a bit easier to reason about.

Also, it uses the same code for both, and fixes it so that it doesn't
leave zombie processes lying around when it crashes.

Run 1000 times without any failures or zombies.

11 years agotest: catch break in simple/test-debugger-client
isaacs [Tue, 26 Feb 2013 01:46:48 +0000 (17:46 -0800)]
test: catch break in simple/test-debugger-client

Handle break events that come out sometimes, by telling it to continue.

Also, send the child a SIGTERM when it times out.

11 years agocore: Use a uv_signal for debug listener
isaacs [Wed, 27 Feb 2013 00:36:56 +0000 (16:36 -0800)]
core: Use a uv_signal for debug listener

Starting the debugger directly in the SIGUSR1 signal handler results in
a malloc lock contention ~1% of the time.  It hangs the test, which is
annoying on a daily basis to all of us, but it also is pretty terrible
if you actually want to debug a node process that has gone sideways.

Credit to @bnoordhuis for most of this.  I just added the unref which
keeps it from messing up the event loop for other stuff.

11 years agodeps: upgrade libuv to a0c1d84
Ben Noordhuis [Tue, 26 Feb 2013 19:30:12 +0000 (20:30 +0100)]
deps: upgrade libuv to a0c1d84

11 years agotest: merge environment, don't overwrite
Ben Noordhuis [Tue, 26 Feb 2013 18:38:15 +0000 (19:38 +0100)]
test: merge environment, don't overwrite

The CI system requires that some environment variables are set so merge
our variables into the current environment instead of blindly replacing
it.

This will probably have to be repeated for other tests. C'est la vie.

11 years agov8: Hardfloat does not imply VFPv3, only VFPv2.
yangguo@chromium.org [Tue, 18 Dec 2012 09:48:51 +0000 (09:48 +0000)]
v8: Hardfloat does not imply VFPv3, only VFPv2.

Raspberry Pi is an example.

BUG=v8:2393

Review URL: https://chromiumcodereview.appspot.com/11570061
Patch from Chi-Thanh Christopher Nguyen <nguyenchithanh@gmail.com>.

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@13232 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

This is a backport of v8/v8@44419ad089b729a1aab4a5f27c0833e2ce69d28b.

11 years agov8: work around String::WriteAscii segfault
Ben Noordhuis [Tue, 15 Jan 2013 22:42:23 +0000 (23:42 +0100)]
v8: work around String::WriteAscii segfault

See http://code.google.com/p/v8/issues/detail?id=2493 for details.

This commit reapplies 9668df8. The issue has been fixed upstream but
reappeared after last night's downgrade to V8 3.14.5 in commit b15a10e.

Conflicts:
test/simple/test-buffer.js

11 years agotest: optionally set common.PORT via env variable
Timothy J Fontaine [Tue, 26 Feb 2013 06:19:16 +0000 (22:19 -0800)]
test: optionally set common.PORT via env variable

11 years agomips: fix openssl build
Andrei Sedoi [Tue, 26 Feb 2013 14:28:53 +0000 (16:28 +0200)]
mips: fix openssl build

11 years agobuild: automatically add tag for nightly builds
Timothy J Fontaine [Tue, 26 Feb 2013 06:51:00 +0000 (22:51 -0800)]
build: automatically add tag for nightly builds

11 years agohttp: fix case in 505 response status line
Ben Noordhuis [Tue, 26 Feb 2013 14:17:26 +0000 (15:17 +0100)]
http: fix case in 505 response status line

Fixes #4850.

11 years agov8: fix postmortem and dtrace helper build
Fedor Indutny [Tue, 26 Feb 2013 08:16:35 +0000 (08:16 +0000)]
v8: fix postmortem and dtrace helper build

Regardless of previous @bnoordhuis' changes

11 years agoRevert "sunos: unbreak build after v8 downgrade"
Fedor Indutny [Tue, 26 Feb 2013 07:57:12 +0000 (07:57 +0000)]
Revert "sunos: unbreak build after v8 downgrade"

This reverts commit f80f3c5f62a3955636c1af1872ef9539a0b01cb0.

11 years agobench: Make http easier to profile
isaacs [Mon, 25 Feb 2013 16:30:05 +0000 (08:30 -0800)]
bench: Make http easier to profile

Do not run the http/simple.js server in a child process.

Fix #4831

11 years agosunos: unbreak build after v8 downgrade
Ben Noordhuis [Tue, 26 Feb 2013 00:21:23 +0000 (01:21 +0100)]
sunos: unbreak build after v8 downgrade

Commit 3d67f89 ("fix generation of v8 constants on freebsd") is an
unfortunate victim of this rollback.

Revert "dtrace: fix generation of v8 constants on freebsd"
Revert "dtrace: More style"
Revert "dtrace: Make D style more D-ish"
Revert "dtrace: x64 ustack helper"
Revert "dtrace: fix style in ustack helper"
Revert "dtrace: SeqAsciiString was renamed to SeqOneByteString in v8"

This reverts commit 3d67f895521cf905922d20af9b03e5c73c363868.
This reverts commit 321b8eec08d445d60a4149bfa71959936fc189c6.
This reverts commit 38df9d51a229e1d74b2d1c2835353f07c784cfc3.
This reverts commit f9afb3f01002e5667a0df80ee784af0dfe2305c2.
This reverts commit 13296e4b13b5ed192c4faa6501f3efec2ded8ac1.
This reverts commit 3b715edda97c8edfd95cc1fb8d31f92cef6bcc52.

11 years agosrc, test: downgrade to v8 3.14 api
Ben Noordhuis [Mon, 25 Feb 2013 22:25:21 +0000 (23:25 +0100)]
src, test: downgrade to v8 3.14 api

11 years agov8: reapply floating patches
Ben Noordhuis [Mon, 25 Feb 2013 22:00:08 +0000 (23:00 +0100)]
v8: reapply floating patches

Reapply floating patches. Special mention: also reapplies 017009f but
with the extra change of removing DescriptorArray::kTransitionsIndex
from the postmortem metadata generator because said field no longer
exists in V8 3.14.

11 years agodeps: downgrade v8 to 3.14.5
Ben Noordhuis [Mon, 25 Feb 2013 21:45:23 +0000 (22:45 +0100)]
deps: downgrade v8 to 3.14.5

V8 3.15 and newer have stability and performance issues. Roll back to
a known-good version.

11 years agoblog: Update with EINPROGRESS changelog item
isaacs [Mon, 25 Feb 2013 22:17:11 +0000 (14:17 -0800)]
blog: Update with EINPROGRESS changelog item

11 years agoChangeLog: Missed item about EINPROGRESS
isaacs [Mon, 25 Feb 2013 21:57:02 +0000 (13:57 -0800)]
ChangeLog: Missed item about EINPROGRESS

11 years agoblog: Post for v0.8.21
isaacs [Mon, 25 Feb 2013 21:56:46 +0000 (13:56 -0800)]
blog: Post for v0.8.21

11 years agoNow working on 0.8.22
isaacs [Mon, 25 Feb 2013 21:52:13 +0000 (13:52 -0800)]
Now working on 0.8.22

11 years agoMerge branch 'v0.8.21-release' into v0.8
isaacs [Mon, 25 Feb 2013 21:51:15 +0000 (13:51 -0800)]
Merge branch 'v0.8.21-release' into v0.8

11 years ago2013.02.25, Version 0.8.21 (Stable) v0.8.21
isaacs [Mon, 25 Feb 2013 18:58:10 +0000 (10:58 -0800)]
2013.02.25, Version 0.8.21 (Stable)

* http: Do not free the wrong parser on socket close (isaacs)

* http: Handle hangup writes more gently (isaacs)

* zlib: fix assert on bad input (Ben Noordhuis)

* test: add TAP output to the test runner (Timothy J Fontaine)

* unix: Handle EINPROGRESS from domain sockets (Ben Noordhuis)

11 years agouv: Upgrade to 86ae8b3c
isaacs [Mon, 25 Feb 2013 21:07:08 +0000 (13:07 -0800)]
uv: Upgrade to 86ae8b3c

11 years agohttp: Do not free the wrong parser on socket close
isaacs [Mon, 25 Feb 2013 17:06:44 +0000 (09:06 -0800)]
http: Do not free the wrong parser on socket close

This appears to fix #4673.  That bug is very hard to reproduce, so it's
hard to tell for certain, but this approach is more correct anyway.

Hat-tip: @dougwilson

11 years agostream: Do not switch to objectMode implicitly
isaacs [Sat, 23 Feb 2013 00:47:27 +0000 (16:47 -0800)]
stream: Do not switch to objectMode implicitly

Only handle objects if explicitly told to do so in the options
object.  Non-buffer/string chunks are an error if not already in
objectMode.

Close #4662

11 years agostream: Start out in sync=true state
isaacs [Sat, 23 Feb 2013 00:45:22 +0000 (16:45 -0800)]
stream: Start out in sync=true state

The Readable and Writable classes will nextTick certain things
if in sync mode.  The sync flag gets unset after a call to _read
or _write.  However, most of these behaviors should also be
deferred until nextTick if no reads have been made (for example,
the automatic '_read up to hwm' behavior on Readable.push(chunk))

Set the sync flag to true in the constructor, so that it will not
trigger an immediate 'readable' event, call to _read, before the
user has had a chance to set a _read method implementation.

11 years agocrypto: fix base64 padding regression
Ben Noordhuis [Sat, 23 Feb 2013 22:43:52 +0000 (23:43 +0100)]
crypto: fix base64 padding regression

Commit 9901b69c introduces a small regression where the trailing base64
padding is no longer written out when Cipher#final is called. Rectify
that.

Fixes #4837.

11 years agotest: re-enable simple/test-setproctitle on darwin
Ben Noordhuis [Sun, 24 Feb 2013 03:06:14 +0000 (04:06 +0100)]
test: re-enable simple/test-setproctitle on darwin

The functionality is available again per joyent/libuv@14eb8b0
and joyent/libuv@e89aced.

Fixes #3687.

11 years agodeps: upgrade libuv to e89aced
Ben Noordhuis [Sun, 24 Feb 2013 03:03:49 +0000 (04:03 +0100)]
deps: upgrade libuv to e89aced

11 years agolint
isaacs [Sat, 23 Feb 2013 00:30:27 +0000 (16:30 -0800)]
lint

11 years agostreams: Pre-emptively buffer readables up to the highWaterMark
isaacs [Fri, 22 Feb 2013 19:24:05 +0000 (11:24 -0800)]
streams: Pre-emptively buffer readables up to the highWaterMark

Also, this adds a test that guarantees that the ordering of several
push() calls in a row is always preserved in synchronous readable streams

11 years agohttp: Handle hangup writes more gently
isaacs [Fri, 22 Feb 2013 18:35:07 +0000 (10:35 -0800)]
http: Handle hangup writes more gently

11 years agodoc: add note about child process line buffering
Ben Noordhuis [Fri, 22 Feb 2013 00:19:39 +0000 (01:19 +0100)]
doc: add note about child process line buffering

Fixes #4808.

11 years agostream: Return false from push() more properly
isaacs [Thu, 21 Feb 2013 22:30:36 +0000 (14:30 -0800)]
stream: Return false from push() more properly

There are cases where a push() call would return true, even though
the thing being pushed was in fact way way larger than the high
water mark, simply because the 'needReadable' was already set, and
would not get unset until nextTick.

In some cases, this could lead to an infinite loop of pushing data
into the buffer, never getting to the 'readable' event which would
unset the needReadable flag.

Fix by splitting up the emitReadable function, so that it always
sets the flag on this tick, even if it defers until nextTick to
actually emit the event.

Also, if we're not ending or already in the process of reading, it
now calls read(0) if we're below the high water mark.  Thus, the
highWaterMark value is the intended amount to buffer up to, and it
is smarter about hitting the target.

11 years agostream: remove lowWaterMark feature
isaacs [Thu, 21 Feb 2013 18:51:15 +0000 (10:51 -0800)]
stream: remove lowWaterMark feature

It seems like a good idea on the face of it, but lowWaterMarks are
actually not useful, and in practice should always be set to zero.

It would be worthwhile for writers if we actually did some kind of
writev() type of thing, but actually this just delays calling write()
and the overhead of doing a bunch of Buffer copies is not worth the
slight benefit of calling write() fewer times.

11 years agopath: Throw TypeError on non-string args to path.resolve
isaacs [Thu, 21 Feb 2013 20:22:12 +0000 (12:22 -0800)]
path: Throw TypeError on non-string args to path.resolve

11 years agozlib: fix assert on bad input
Ben Noordhuis [Thu, 21 Feb 2013 22:58:55 +0000 (23:58 +0100)]
zlib: fix assert on bad input

The following test case occasionally triggered an assert because
write_in_progress_ didn't get cleared on error:

  $ cat test.js
  require('zlib').gunzip('BAM', console.log);
  setTimeout(gc, 10);

  $ while true; do node --expose-gc test.js || break; done
  { [Error: incorrect header check] errno: -3, code: 'Z_DATA_ERROR' }
  Assertion failed: (!write_in_progress_ && "write in progress"),
  function Clear, file ../src/node_zlib.cc, line 71.
  Abort trap: 6

Steps to avoid that:

* Initialize all primitive member fields in the constructor.
* Clear the write_in_progress_ member field in ZCtx::Error().
* Ref the ZCtx object as soon as write_in_progress_ is set to true.
  Before this commit, it could get GC'ed in the time between setting
  the field and the call to ctx->Ref().

Fixes #4783.

11 years agotest: modify async native test.js to test for #4820
Nathan Rajlich [Thu, 21 Feb 2013 20:54:13 +0000 (12:54 -0800)]
test: modify async native test.js to test for #4820

11 years agotest: add an "async-hello-world" native addon test
Nathan Rajlich [Thu, 21 Feb 2013 19:02:33 +0000 (11:02 -0800)]
test: add an "async-hello-world" native addon test

11 years agopath: join throws TypeError on non-string args
Arianit Uka [Thu, 21 Feb 2013 16:44:22 +0000 (11:44 -0500)]
path: join throws TypeError on non-string args

lib/path.js:
  - throws a TypeError on the filter if the argument is not a string.

test/simple/test-path.js:
  - removed the test to check if non-string types are filtered.
  - added a test to check if path.join throws TypeError on arguments that
    are not strings.

11 years agotls: _handle.readStart/readStop for CryptoStream
Fedor Indutny [Thu, 21 Feb 2013 09:28:51 +0000 (13:28 +0400)]
tls: _handle.readStart/readStop for CryptoStream

lib/http.js is using stream._handle.readStart/readStop to control
data-flow coming out from underlying stream. If this methods are not
present - data might be buffered regardless of whether it'll be read.

see #4657

11 years agoprocess: fix bug where spinner wasn't called
Trevor Norris [Thu, 21 Feb 2013 09:40:09 +0000 (01:40 -0800)]
process: fix bug where spinner wasn't called

Apperently there is a case where calling the spinner was required after
passing a callback to nextTick(). This fixes that issue.

11 years agopath: Do not coerce paths to strings on Windows
isaacs [Mon, 18 Feb 2013 18:46:50 +0000 (10:46 -0800)]
path: Do not coerce paths to strings on Windows

Fix #4795

11 years agostream_wrap: remove superfluous buffer len check
Ben Noordhuis [Wed, 20 Feb 2013 21:06:41 +0000 (22:06 +0100)]
stream_wrap: remove superfluous buffer len check

It's a buffer so it's never bigger than Buffer::kMaxLength bytes,
which in turn is always < INT_MAX.

11 years agodeps: upgrade libuv to 26fa6f8
Ben Noordhuis [Wed, 20 Feb 2013 20:12:18 +0000 (21:12 +0100)]
deps: upgrade libuv to 26fa6f8

11 years agobuffer: check logic simplification
Trevor Norris [Tue, 19 Feb 2013 07:52:34 +0000 (23:52 -0800)]
buffer: check logic simplification

Checks have been simplified and optimized for most-used cases.

Calling Buffer with another Buffer as the subject will now use the
SlowBuffer Copy method instead of the for loop.

No need to call for value coercion, just place the ternary inline.

11 years agotest: add TAP output to the test runner
Timothy J Fontaine [Wed, 19 Dec 2012 04:10:17 +0000 (23:10 -0500)]
test: add TAP output to the test runner

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