platform/upstream/nodejs.git
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 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 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 agobenchmark: Fix alignment issues on --html compare output
isaacs [Wed, 20 Feb 2013 17:17:29 +0000 (09:17 -0800)]
benchmark: Fix alignment issues on --html compare output

11 years agonode: code cleanup, make tick_infobox static
Ben Noordhuis [Wed, 20 Feb 2013 13:14:58 +0000 (14:14 +0100)]
node: code cleanup, make tick_infobox static

It's not used outside of src/node.cc so make it static.

11 years agocrypto: fix uninitialized memory access in openssl
Ben Noordhuis [Wed, 15 Aug 2012 00:10:02 +0000 (02:10 +0200)]
crypto: fix uninitialized memory access in openssl

ASN1_STRING_to_UTF8() passes an ASN1_STRING to ASN1_STRING_set() but forgot to
initialize the `length` field.

Fixes the following valgrind error:

  $ valgrind -q --track-origins=yes --num-callers=19 \
      out/Debug/node test/simple/test-tls-client-abort.js
  ==2690== Conditional jump or move depends on uninitialised value(s)
  ==2690==    at 0x784B69: ASN1_STRING_set (asn1_lib.c:382)
  ==2690==    by 0x809564: ASN1_mbstring_ncopy (a_mbstr.c:204)
  ==2690==    by 0x8090F0: ASN1_mbstring_copy (a_mbstr.c:86)
  ==2690==    by 0x782F1F: ASN1_STRING_to_UTF8 (a_strex.c:570)
  ==2690==    by 0x78F090: asn1_string_canon (x_name.c:409)
  ==2690==    by 0x78EF17: x509_name_canon (x_name.c:354)
  ==2690==    by 0x78EA7D: x509_name_ex_d2i (x_name.c:210)
  ==2690==    by 0x788058: ASN1_item_ex_d2i (tasn_dec.c:239)
  ==2690==    by 0x7890D4: asn1_template_noexp_d2i (tasn_dec.c:746)
  ==2690==    by 0x788CB6: asn1_template_ex_d2i (tasn_dec.c:607)
  ==2690==    by 0x78877A: ASN1_item_ex_d2i (tasn_dec.c:448)
  ==2690==    by 0x7890D4: asn1_template_noexp_d2i (tasn_dec.c:746)
  ==2690==    by 0x788CB6: asn1_template_ex_d2i (tasn_dec.c:607)
  ==2690==    by 0x78877A: ASN1_item_ex_d2i (tasn_dec.c:448)
  ==2690==    by 0x787C93: ASN1_item_d2i (tasn_dec.c:136)
  ==2690==    by 0x78F5E4: d2i_X509 (x_x509.c:141)
  ==2690==    by 0x7C9B91: PEM_ASN1_read_bio (pem_oth.c:81)
  ==2690==    by 0x7CA506: PEM_read_bio_X509 (pem_x509.c:67)
  ==2690==    by 0x703C9A: node::crypto::SecureContext::AddRootCerts(v8::Arguments const&) (node_crypto.cc:497)
  ==2690==  Uninitialised value was created by a stack allocation
  ==2690==    at 0x782E89: ASN1_STRING_to_UTF8 (a_strex.c:560)

11 years agoopenssl: make perlasm target pentium or newer for masm outputs
Bert Belder [Wed, 12 Sep 2012 23:03:50 +0000 (01:03 +0200)]
openssl: make perlasm target pentium or newer for masm outputs

When perlasm generates MASM code it sets the assembler target to 468.
In this mode MASM refuses to assemble a couple of instructions. Bumping
the target to 686 solves this problem.

11 years agoopenssl: disable HT sidechannel attack mitigation
Bert Belder [Fri, 21 Sep 2012 16:07:08 +0000 (18:07 +0200)]
openssl: disable HT sidechannel attack mitigation

It used to be off before. It's extremely unlikely that such an attack
would be a viable attack against node. And it makes AES much slower.

11 years agoopenssl: update to 1.0.1e
Fedor Indutny [Wed, 20 Feb 2013 11:54:22 +0000 (15:54 +0400)]
openssl: update to 1.0.1e

11 years agoMerge branch 'benchmark-refactor-2'
isaacs [Wed, 20 Feb 2013 01:17:29 +0000 (17:17 -0800)]
Merge branch 'benchmark-refactor-2'

11 years agobench: Add bench-crypto
isaacs [Wed, 20 Feb 2013 00:57:59 +0000 (16:57 -0800)]
bench: Add bench-crypto

11 years agobench: Simplify duration arguments to benchmarks
isaacs [Tue, 19 Feb 2013 23:03:41 +0000 (15:03 -0800)]
bench: Simplify duration arguments to benchmarks

For throughput benchmarks, run with just 5s durations rather than 1s and 3s.

For startup benchmark, run with just a single 1s duration, since it's very
consistent anyway.

11 years agobench: Consistency in benchmark filenames
isaacs [Tue, 19 Feb 2013 22:59:43 +0000 (14:59 -0800)]
bench: Consistency in benchmark filenames

11 years agobench: Only run http,net,fs,tls by default
isaacs [Wed, 13 Feb 2013 22:18:27 +0000 (14:18 -0800)]
bench: Only run http,net,fs,tls by default

11 years agobench: Remove _bench_timer (no loner used)
isaacs [Wed, 13 Feb 2013 22:16:11 +0000 (14:16 -0800)]
bench: Remove _bench_timer (no loner used)

11 years agobench: Use wrk for http benchmarking
isaacs [Wed, 13 Feb 2013 20:20:36 +0000 (12:20 -0800)]
bench: Use wrk for http benchmarking

Remove ab, since it's no longer used.

11 years agotools: Add wrk for benchmarking http servers
isaacs [Wed, 13 Feb 2013 20:19:08 +0000 (12:19 -0800)]
tools: Add wrk for benchmarking http servers

11 years agobench: Show % change rather than % difference
isaacs [Wed, 13 Feb 2013 18:48:55 +0000 (10:48 -0800)]
bench: Show % change rather than % difference

11 years agobench: Add --html to compare script
isaacs [Wed, 13 Feb 2013 18:47:29 +0000 (10:47 -0800)]
bench: Add --html to compare script

11 years agobench: Fail gracefully if function_call binding fails
isaacs [Tue, 12 Feb 2013 08:13:18 +0000 (00:13 -0800)]
bench: Fail gracefully if function_call binding fails

11 years agomake: Add benchmark make targets
isaacs [Tue, 12 Feb 2013 07:22:12 +0000 (23:22 -0800)]
make: Add benchmark make targets

11 years agobench: Remove old run script
isaacs [Tue, 12 Feb 2013 07:04:29 +0000 (23:04 -0800)]
bench: Remove old run script

11 years agobench: Replace tls-fragmentation with tls/throughput
isaacs [Tue, 12 Feb 2013 02:27:02 +0000 (18:27 -0800)]
bench: Replace tls-fragmentation with tls/throughput

11 years agobench: Move tls-connect into benchmark/tls
isaacs [Mon, 11 Feb 2013 22:38:00 +0000 (14:38 -0800)]
bench: Move tls-connect into benchmark/tls

Also, make it work properly with current node.

11 years agobench: Make io.c output easier to read
isaacs [Tue, 12 Feb 2013 05:33:37 +0000 (21:33 -0800)]
bench: Make io.c output easier to read

11 years agobench: Remove io.js
isaacs [Tue, 12 Feb 2013 05:33:22 +0000 (21:33 -0800)]
bench: Remove io.js

Better covered by the other benchmark/fs scripts.

11 years agobench: Add fs write stream throughput
isaacs [Wed, 13 Feb 2013 18:42:23 +0000 (10:42 -0800)]
bench: Add fs write stream throughput

11 years agobench: Add read-stream throughput
isaacs [Tue, 12 Feb 2013 05:05:43 +0000 (21:05 -0800)]
bench: Add read-stream throughput

11 years agobench: Move fs-readfile.js to fs/readfile.js
isaacs [Tue, 12 Feb 2013 07:55:36 +0000 (23:55 -0800)]
bench: Move fs-readfile.js to fs/readfile.js

11 years agobench: Move v8_bench into misc
isaacs [Tue, 12 Feb 2013 07:10:12 +0000 (23:10 -0800)]
bench: Move v8_bench into misc

11 years agobench: Move string_creation into misc
isaacs [Tue, 12 Feb 2013 07:07:37 +0000 (23:07 -0800)]
bench: Move string_creation into misc

11 years agobench: Remove settimeout (Covered by misc/timeout.js)
isaacs [Tue, 12 Feb 2013 07:03:42 +0000 (23:03 -0800)]
bench: Remove settimeout (Covered by misc/timeout.js)

11 years agobench: Move timers to misc/timers
isaacs [Tue, 12 Feb 2013 07:00:18 +0000 (23:00 -0800)]
bench: Move timers to misc/timers

11 years agobench: move next-tick to misc/next-tick-breadth
isaacs [Tue, 12 Feb 2013 06:54:27 +0000 (22:54 -0800)]
bench: move next-tick to misc/next-tick-breadth

11 years agobench: Move nexttick-2 to misc/next-tick-depth
isaacs [Tue, 12 Feb 2013 06:50:30 +0000 (22:50 -0800)]
bench: Move nexttick-2 to misc/next-tick-depth

x

11 years agobench: Move process_loop to misc/spawn-echo
isaacs [Tue, 12 Feb 2013 06:42:19 +0000 (22:42 -0800)]
bench: Move process_loop to misc/spawn-echo

11 years agobench: Add function_call to bench-misc
isaacs [Tue, 12 Feb 2013 02:22:43 +0000 (18:22 -0800)]
bench: Add function_call to bench-misc

11 years agobench: Arrays
isaacs [Mon, 11 Feb 2013 21:32:39 +0000 (13:32 -0800)]
bench: Arrays

11 years agobench: Add buffers/dataview_set
isaacs [Tue, 12 Feb 2013 06:01:50 +0000 (22:01 -0800)]
bench: Add buffers/dataview_set

11 years agobench: Remove unused 'fast_buffer2' benchmarks
isaacs [Mon, 11 Feb 2013 22:12:35 +0000 (14:12 -0800)]
bench: Remove unused 'fast_buffer2' benchmarks

11 years agobench: Merge fast_buffer_creation and buffer_creation
isaacs [Mon, 11 Feb 2013 22:09:41 +0000 (14:09 -0800)]
bench: Merge fast_buffer_creation and buffer_creation

11 years agobench: Buffer read/write benchmarks
isaacs [Tue, 12 Feb 2013 07:53:27 +0000 (23:53 -0800)]
bench: Buffer read/write benchmarks

11 years agobench: Buffer creation
isaacs [Mon, 11 Feb 2013 21:41:16 +0000 (13:41 -0800)]
bench: Buffer creation

11 years agobench: buffer-base64-encode
isaacs [Mon, 11 Feb 2013 21:37:24 +0000 (13:37 -0800)]
bench: buffer-base64-encode

11 years agobench: misc/startup.js
isaacs [Mon, 11 Feb 2013 21:24:27 +0000 (13:24 -0800)]
bench: misc/startup.js

11 years agobench: misc/url
isaacs [Tue, 12 Feb 2013 07:51:53 +0000 (23:51 -0800)]
bench: misc/url

11 years agobench: http benchmarks
isaacs [Tue, 12 Feb 2013 07:43:22 +0000 (23:43 -0800)]
bench: http benchmarks

Also: make http_simple less chatty

11 years agobench: Remove client_latency
isaacs [Tue, 12 Feb 2013 01:57:49 +0000 (17:57 -0800)]
bench: Remove client_latency

No one actually knows what this is supposed to be doing,
anyway.  It's not a good benchmark.

11 years agobench: Remove throughput (covered by benchmark/net)
isaacs [Tue, 12 Feb 2013 06:08:25 +0000 (22:08 -0800)]
bench: Remove throughput (covered by benchmark/net)

11 years agobench: net benchmarks using common script
isaacs [Fri, 8 Feb 2013 03:13:26 +0000 (19:13 -0800)]
bench: net benchmarks using common script

11 years agobench: Move net-pipe into benchmark/net
isaacs [Fri, 8 Feb 2013 03:10:48 +0000 (19:10 -0800)]
bench: Move net-pipe into benchmark/net

11 years agobench: A compare script for analyzing benchmarks
isaacs [Tue, 12 Feb 2013 07:28:48 +0000 (23:28 -0800)]
bench: A compare script for analyzing benchmarks

11 years agobench: add runner
isaacs [Tue, 12 Feb 2013 07:21:48 +0000 (23:21 -0800)]
bench: add runner

11 years agobench: Add ab() method to common for http testing
isaacs [Tue, 12 Feb 2013 07:26:43 +0000 (23:26 -0800)]
bench: Add ab() method to common for http testing

11 years agobench: Add common script
isaacs [Fri, 8 Feb 2013 03:10:58 +0000 (19:10 -0800)]
bench: Add common script

11 years agoNow working on v0.9.11
isaacs [Tue, 19 Feb 2013 21:58:38 +0000 (13:58 -0800)]
Now working on v0.9.11

11 years agoMerge branch 'v0.9.10-release'
isaacs [Tue, 19 Feb 2013 21:58:19 +0000 (13:58 -0800)]
Merge branch 'v0.9.10-release'

11 years ago2013.02.19, Version 0.9.10 (Unstable) v0.9.10
isaacs [Tue, 19 Feb 2013 21:23:47 +0000 (13:23 -0800)]
2013.02.19, Version 0.9.10 (Unstable)

* V8: Upgrade to 3.15.11.15

* npm: Upgrade to 1.2.12

* fs: Change default WriteStream config, increase perf (isaacs)

* process: streamlining tick callback logic (Trevor Norris)

* stream_wrap, udp_wrap: add read-only fd property (Ben Noordhuis)

* buffer: accept negative indices in Buffer#slice() (Ben Noordhuis)

* tls: Cycle data when underlying socket drains (isaacs)

* stream: read(0) should not always trigger _read(n,cb) (isaacs)

* stream: Empty strings/buffers do not signal EOF any longer (isaacs)

* crypto: improve cipher/decipher error messages (Ben Noordhuis)

* net: Respect the 'readable' flag on sockets (isaacs)

* net: don't suppress ECONNRESET (Ben Noordhuis)

* typed arrays: copy Buffer in typed array constructor (Ben Noordhuis)

* typed arrays: make DataView throw on non-ArrayBuffer (Ben Noordhuis)

* windows: MSI installer enhancements (Scott Blomquist, Jim Schubert)

11 years agonpm: Upgrade to 1.2.12
isaacs [Tue, 19 Feb 2013 21:18:36 +0000 (13:18 -0800)]
npm: Upgrade to 1.2.12

11 years agotls: Write pending data on socket drain
isaacs [Tue, 19 Feb 2013 19:37:48 +0000 (11:37 -0800)]
tls: Write pending data on socket drain

Fixes #4800

11 years agotest: Fix regression in tls test
isaacs [Tue, 19 Feb 2013 02:26:29 +0000 (18:26 -0800)]
test: Fix regression in tls test

Undefined reference, introduced by a77c29a.

11 years agotest: Fix tls tests which fail sporadically
isaacs [Tue, 19 Feb 2013 02:26:29 +0000 (18:26 -0800)]
test: Fix tls tests which fail sporadically

The count of ECONNRESETs is dependent on timing, and thus unreliable,
especially on Linux machines.

11 years agodoc: Use 'close' rather than 'exit' in spawn examples
isaacs [Mon, 18 Feb 2013 19:24:14 +0000 (11:24 -0800)]
doc: Use 'close' rather than 'exit' in spawn examples

Close #4515

11 years agohttp: Add fixme comment about ECONNRESET handling
isaacs [Mon, 18 Feb 2013 18:38:37 +0000 (10:38 -0800)]
http: Add fixme comment about ECONNRESET handling

11 years agoMerge remote-tracking branch 'ry/v0.8' into master
isaacs [Mon, 18 Feb 2013 18:21:08 +0000 (10:21 -0800)]
Merge remote-tracking branch 'ry/v0.8' into master

Conflicts:
AUTHORS
ChangeLog
lib/http.js
src/node_version.h
test/simple/test-http-header-response-splitting.js

11 years agostream: Pipe data in chunks matching read data
Gil Pedersen [Thu, 14 Feb 2013 19:26:54 +0000 (20:26 +0100)]
stream: Pipe data in chunks matching read data

This creates better flow for large values of lowWaterMark.

11 years agofs: Change default WriteStream config, increase perf
isaacs [Sun, 3 Feb 2013 20:53:33 +0000 (12:53 -0800)]
fs: Change default WriteStream config, increase perf

This increases fs.WriteStream throughput dramatically by removing the
"higher default water marks" for fs.WriteStream.

Also includes a benchmark.  Current performance is significantly higher
than v0.8 for strings at all tested levels except size=1.  Buffer
performance is still lackluster.

Further improvement in the stream.Writable base class is required, but
this is a start.

11 years agotest: Bump up debugger timeouts
isaacs [Sat, 16 Feb 2013 02:31:43 +0000 (18:31 -0800)]
test: Bump up debugger timeouts

200ms is still short enough for occasional spurious failures.

11 years agoprocess: allow ticker to cross communicate better
Trevor Norris [Wed, 13 Feb 2013 14:30:06 +0000 (06:30 -0800)]
process: allow ticker to cross communicate better

Using external memory values allows for quick communication between js
and cc land, so we can check if the js land callback needs to be run.
(this is where I meant that manually tracking nextTickQueue.length would
be helpful)

Also did some minor cleanup of removing the old Tick and
StartTickSpinner functions, and a few unneeded comments.

Conflicts:

src/node.cc

11 years agoprocess: streamlining tick callback logic
Trevor Norris [Thu, 7 Feb 2013 01:26:18 +0000 (17:26 -0800)]
process: streamlining tick callback logic

* Callbacks from spinner now calls its own function, separate from the
  tickCallback logic
* MakeCallback will call a domain specific function if a domain is
  detected
* _tickCallback assumes no domains, until nextTick receives a callback
  with a domain. After that _tickCallback is overridden with the domain
  specific implementation.
* _needTickCallback runs in startup() instead of nextTick (isaacs)
* Fix bug in _fatalException where exit would be called twice (isaacs)
* Process.domain has a default value of null
* Manually track nextTickQueue.length (will be useful later)
* Update tests to reflect internal api changes

11 years agoRevert "Move MakeCallback to JS"
isaacs [Fri, 1 Feb 2013 22:23:28 +0000 (14:23 -0800)]
Revert "Move MakeCallback to JS"

This reverts commit 0109a9f90acdfdb287436676f2384f7b072fbb6a.

Also included:  Port all the changes to process._makeCallback into the
C++ version.  Immediate nextTick, etc.

This yields a slight boost in several benchmarks.  V8 is optimizing and
deoptimizing process._makeCallback repeatedly.

11 years agodoc: add setImmediate execute timing description
Shigeki Ohtsu [Wed, 6 Feb 2013 02:14:24 +0000 (11:14 +0900)]
doc: add setImmediate execute timing description

11 years agotimer: move setImmediate from timer to uv_check
Shigeki Ohtsu [Wed, 6 Feb 2013 02:13:02 +0000 (11:13 +0900)]
timer: move setImmediate from timer to uv_check

uv_check is the robust place to invoke setImmediate callbacks after
process.nextTick and before timers(setTimeout/setInterval)

11 years agoblog: Release v0.8.20
isaacs [Fri, 15 Feb 2013 19:24:20 +0000 (11:24 -0800)]
blog: Release v0.8.20

11 years agoNow working on v0.8.21
isaacs [Fri, 15 Feb 2013 19:24:08 +0000 (11:24 -0800)]
Now working on v0.8.21

11 years agoMerge branch 'v0.8.20-release' into v0.8
isaacs [Fri, 15 Feb 2013 19:23:55 +0000 (11:23 -0800)]
Merge branch 'v0.8.20-release' into v0.8

11 years ago2013.02.15, Version 0.8.20 (Stable) v0.8.20
isaacs [Fri, 15 Feb 2013 17:57:32 +0000 (09:57 -0800)]
2013.02.15, Version 0.8.20 (Stable)

* npm: Upgrade to v1.2.11

* http: Do not let Agent hand out destroyed sockets (isaacs)

* http: Raise hangup error on destroyed socket write (isaacs)

* http: protect against response splitting attacks (Bert Belder)

11 years agonpm: Upgrade to v1.2.11
isaacs [Fri, 15 Feb 2013 18:49:16 +0000 (10:49 -0800)]
npm: Upgrade to v1.2.11

11 years agohttp: Do not let Agent hand out destroyed sockets
isaacs [Thu, 14 Feb 2013 23:37:12 +0000 (15:37 -0800)]
http: Do not let Agent hand out destroyed sockets

Fix #4373

11 years agohttp: Raise hangup error on destroyed socket write
isaacs [Thu, 14 Feb 2013 16:57:32 +0000 (08:57 -0800)]
http: Raise hangup error on destroyed socket write

Prior to v0.10, Node ignored ECONNRESET errors in many situations.
There *are* valid cases in which ECONNRESET should be ignored as a
normal part of the TCP dance, but in many others, it's a very relevant
signal that must be heeded with care.

Exacerbating this problem, if the OutgoingMessage does not have a
req.connection._handle, it assumes that it is in the process of
connecting, and thus buffers writes up in an array.

The problem happens when you reuse a socket between two requests, and it
is destroyed abruptly in between them.  The writes will be buffered,
because the socket has no handle, but it's not ever going to GET a
handle, because it's not connecting, it's destroyed.

The proper fix is to treat ECONNRESET correctly.  However, this is a
behavior/semantics change, and cannot land in a stable branch.

Fix #4775

11 years agodoc: clarify child_process.exec() stdio option
Ben Noordhuis [Thu, 14 Feb 2013 18:41:33 +0000 (19:41 +0100)]
doc: clarify child_process.exec() stdio option

It only works for stdin, not stdout/stderr, for obvious reasons.

11 years agodoc: add tools/ dir to CONTRIBUTING.md verboten list
Ben Noordhuis [Thu, 14 Feb 2013 11:42:54 +0000 (12:42 +0100)]
doc: add tools/ dir to CONTRIBUTING.md verboten list

11 years agodoc: add prompt to fix repl_test.js example
Dan Kohn [Tue, 12 Feb 2013 20:04:23 +0000 (15:04 -0500)]
doc: add prompt to fix repl_test.js example

Running repl.start without the prompt set produces this error:

repl.js:95
    throw new Error('An options Object, or a prompt String are required');
          ^
Error: An options Object, or a prompt String are required
    at new REPLServer (repl.js:95:11)
    at Object.exports.start (repl.js:321:14)
    at Object.<anonymous> (/Users/dan/Dropbox/Documents/dev/nextgen/repl_test.js:5:6)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

11 years agostream_wrap, udp_wrap: add read-only fd property
Ben Noordhuis [Wed, 13 Feb 2013 15:09:03 +0000 (16:09 +0100)]
stream_wrap, udp_wrap: add read-only fd property

Expose the file descriptor as a read-only property on the internal
handle objects. Intended for debugging purposes, not part of the API
proper. The property is always null on Windows.

Fixes #4754.

11 years agoudp_wrap: use proper imports in source file
Ben Noordhuis [Wed, 13 Feb 2013 14:54:17 +0000 (15:54 +0100)]
udp_wrap: use proper imports in source file

11 years agoudp_wrap: don't use namespace imports in header
Ben Noordhuis [Wed, 13 Feb 2013 14:44:35 +0000 (15:44 +0100)]
udp_wrap: don't use namespace imports in header

It's not really harmful but it's inconsistent with the other header
files.

11 years agobuffer: accept negative indices in Buffer#slice()
Ben Noordhuis [Tue, 12 Feb 2013 13:58:35 +0000 (14:58 +0100)]
buffer: accept negative indices in Buffer#slice()

A negative start or end parameter now indexes from the end of the
buffer. More in line with String#slice() and ArrayBuffer#slice().

11 years agonet: Respect the 'readable' flag on sockets
isaacs [Tue, 12 Feb 2013 17:08:50 +0000 (09:08 -0800)]
net: Respect the 'readable' flag on sockets

Previously, we were only destroying sockets on end if their readable
side had already been ended.  This causes a problem for non-readable
streams, since we don't expect to ever see an 'end' event from those.

Treat the lack of a 'readable' flag the same as if it was an ended
readable stream.

Fix #4751

11 years agoblog: Forgot slug on peer-dependencies article
isaacs [Wed, 13 Feb 2013 00:30:25 +0000 (16:30 -0800)]
blog: Forgot slug on peer-dependencies article

11 years agoblog: Peer Dependencies article
isaacs [Tue, 12 Feb 2013 20:03:52 +0000 (12:03 -0800)]
blog: Peer Dependencies article

Thanks, @domenic