0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

8070 Commits

Author SHA1 Message Date
isaacs
e03bc472f0 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.
2013-02-25 07:38:10 -08:00
Ben Noordhuis
4231dab39f 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.
2013-02-25 15:21:52 +01:00
Ben Noordhuis
8df893c62e test: re-enable simple/test-setproctitle on darwin
The functionality is available again per joyent/libuv@14eb8b0
and joyent/libuv@e89aced.

Fixes #3687.
2013-02-24 04:07:42 +01:00
Ben Noordhuis
de9ee2a483 deps: upgrade libuv to e89aced 2013-02-24 04:03:49 +01:00
isaacs
74c08403d8 lint 2013-02-22 16:30:27 -08:00
isaacs
27d1babaae 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
2013-02-22 11:24:05 -08:00
isaacs
f9a0140ef1 http: Handle hangup writes more gently 2013-02-22 10:35:07 -08:00
Ben Noordhuis
22d3eff8f4 doc: add note about child process line buffering
Fixes #4808.
2013-02-22 01:19:40 +01:00
isaacs
a63c28e6eb 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.
2013-02-21 15:23:18 -08:00
isaacs
3b2e9d2648 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.
2013-02-21 15:23:18 -08:00
isaacs
089ec58613 path: Throw TypeError on non-string args to path.resolve 2013-02-21 15:18:44 -08:00
Ben Noordhuis
ef94521909 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.
2013-02-22 00:08:26 +01:00
Nathan Rajlich
50c88e0ff2 test: modify async native test.js to test for #4820 2013-02-21 13:14:07 -08:00
Nathan Rajlich
4b61522f16 test: add an "async-hello-world" native addon test 2013-02-21 13:14:07 -08:00
Arianit Uka
055110dab0 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.
2013-02-21 11:50:47 -08:00
Fedor Indutny
ebc95f0716 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
2013-02-21 23:29:18 +04:00
Trevor Norris
7301ba3969 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.
2013-02-21 10:31:01 -08:00
isaacs
bbcb8b3ae0 path: Do not coerce paths to strings on Windows
Fix #4795
2013-02-20 14:04:30 -08:00
Ben Noordhuis
9d10bf58a3 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.
2013-02-20 22:17:36 +01:00
Ben Noordhuis
6ad792610b deps: upgrade libuv to 26fa6f8 2013-02-20 21:29:52 +01:00
Trevor Norris
d69a26b965 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.
2013-02-20 20:34:34 +01:00
Timothy J Fontaine
9d45b945f7 test: add TAP output to the test runner
This is a back-port of commit 14ed173 from the master branch.
2013-02-20 18:50:55 +01:00
isaacs
053e02ef8e benchmark: Fix alignment issues on --html compare output 2013-02-20 09:17:29 -08:00
Ben Noordhuis
57ef65916b node: code cleanup, make tick_infobox static
It's not used outside of src/node.cc so make it static.
2013-02-20 14:15:11 +01:00
Ben Noordhuis
0dcbecd32b 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)
2013-02-20 17:01:47 +04:00
Bert Belder
da945a7376 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.
2013-02-20 17:00:29 +04:00
Bert Belder
eb29c4b2e6 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.
2013-02-20 16:49:03 +04:00
Fedor Indutny
f317f5aee9 openssl: update to 1.0.1e 2013-02-20 16:48:20 +04:00
isaacs
f1780a6be6 Merge branch 'benchmark-refactor-2' 2013-02-19 17:17:29 -08:00
isaacs
bd4d585b7a bench: Add bench-crypto 2013-02-19 17:16:55 -08:00
isaacs
4b80f217cd 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.
2013-02-19 17:16:55 -08:00
isaacs
2ed56e5235 bench: Consistency in benchmark filenames 2013-02-19 17:16:55 -08:00
isaacs
1eb6a92984 bench: Only run http,net,fs,tls by default 2013-02-19 17:16:55 -08:00
isaacs
06fbcca6bb bench: Remove _bench_timer (no loner used) 2013-02-19 17:16:55 -08:00
isaacs
ef08f0fbb1 bench: Use wrk for http benchmarking
Remove ab, since it's no longer used.
2013-02-19 17:16:29 -08:00
isaacs
e850cbab1c tools: Add wrk for benchmarking http servers 2013-02-19 17:16:18 -08:00
isaacs
035aa6b4ce bench: Show % change rather than % difference 2013-02-19 14:14:39 -08:00
isaacs
087c437961 bench: Add --html to compare script 2013-02-19 14:14:38 -08:00
isaacs
7658f4c29c bench: Fail gracefully if function_call binding fails 2013-02-19 14:14:38 -08:00
isaacs
0e59efd079 make: Add benchmark make targets 2013-02-19 14:14:38 -08:00
isaacs
7d51745827 bench: Remove old run script 2013-02-19 14:14:37 -08:00
isaacs
0a406869df bench: Replace tls-fragmentation with tls/throughput 2013-02-19 14:14:37 -08:00
isaacs
bafc51c0f9 bench: Move tls-connect into benchmark/tls
Also, make it work properly with current node.
2013-02-19 14:14:37 -08:00
isaacs
8c719f7c71 bench: Make io.c output easier to read 2013-02-19 14:14:37 -08:00
isaacs
8a3f52170e bench: Remove io.js
Better covered by the other benchmark/fs scripts.
2013-02-19 14:14:36 -08:00
isaacs
2a64edb025 bench: Add fs write stream throughput 2013-02-19 14:14:36 -08:00
isaacs
1fc6f99340 bench: Add read-stream throughput 2013-02-19 14:14:36 -08:00
isaacs
6d116be7cf bench: Move fs-readfile.js to fs/readfile.js 2013-02-19 14:14:35 -08:00
isaacs
844b33205c bench: Move v8_bench into misc 2013-02-19 14:14:35 -08:00
isaacs
2a2942bd7f bench: Move string_creation into misc 2013-02-19 14:14:35 -08:00