Commit Graph

8520 Commits (9456cf8fe2b42ccfb2a9561cd50430e623bdc6d2)

Author SHA1 Message Date
Duan Yao 9456cf8fe2 doc: Add callback parameter to dgram socket.bind()
Also, describe more details of bind().
2013-08-19 16:33:38 -07:00
ChrisWren 2385fbbc3a doc: fixed syntax error in stream.Transform 2013-08-19 16:10:05 -07:00
Edward Hutchins 31a27ca72d Added documentation for process.execArgv 2013-08-19 15:53:09 -07:00
Eivind Uggedal 732f8b9641 doc: add missing word in Transform stream intro 2013-08-19 15:45:35 -07:00
isaacs 545807918e stream: Throw on 'error' if listeners removed
In this situation:

    writable.on('error', handler);
    readable.pipe(writable);
    writable.removeListener('error', handler);
    writable.emit('error', new Error('boom'));

there is actually no error handler, but it doesn't throw, because of the
fix for stream.once('error', handler), in 23d92ec.

Note that simply reverting that change is not valid either, because
otherwise this will emit twice, being handled the first time, and then
throwing the second:

    writable.once('error', handler);
    readable.pipe(writable);
    writable.emit('error', new Error('boom'));

Fix this with a horrible hack to make the stream pipe onerror handler
added before any other userland handlers, so that our handler is not
affected by adding or removing any userland handlers.

Closes #6007.
2013-08-19 09:26:49 -07:00
Ben Noordhuis 0c2960ef4a dgram: fix assertion on bad send() arguments
Add range checks for the offset, length and port arguments to
dgram.Socket#send().  Fixes the following assertion:

    node: ../../src/udp_wrap.cc:264: static v8::Handle<v8::Value>
    node::UDPWrap::DoSend(const v8::Arguments&, int): Assertion
    `offset < Buffer::Length(buffer_obj)' failed.

And:

    node: ../../src/udp_wrap.cc:265: static v8::Handle<v8::Value>
    node::UDPWrap::DoSend(const v8::Arguments&, int): Assertion
    `length <= Buffer::Length(buffer_obj) - offset' failed.

Interestingly enough, a negative port number was accepted until now but
silently ignored.  (In other words, it would send the datagram to a
random port.)

This commit exposed a bug in the simple/test-dgram-close test which
has also been fixed.

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

Fixes #6025.
2013-08-17 17:11:02 +02:00
Daniel Chatfield 5453619eb2 readline: pause stdin before turning off terminal raw mode
On windows, libuv will immediately make a `ReadConsole` call (in the
thread pool) when a 'flowing' `uv_tty_t` handle is switched to
line-buffered mode. That causes an immediate issue for some users,
since libuv can't cancel the `ReadConsole` operation on Windows 8 /
Server 2012 and up if the program switches back to raw mode later.

But even if this will be fixed in libuv at some point, it's better to
avoid the overhead of starting work in the thread pool and immediately
cancelling it afther that.

See also f34f1e3, where the same change is made for the opposite
flow, e.g. move `resume()` after `_setRawMode(true)`.

Fixes #5927

This is a backport of dfb0461 (see #5930) to the v0.10 branch.
2013-08-17 15:35:09 +02:00
isaacs a66d2400a0 blog: v0.10.16 2013-08-16 12:47:54 -07:00
isaacs 0e043528a1 Now working on v0.10.17 2013-08-16 12:47:29 -07:00
isaacs e679739b63 Merge branch 'v0.10.16-release' into v0.10 2013-08-16 12:46:56 -07:00
isaacs 50b4c905a4 2013.08.16, Version 0.10.16 (Stable)
* v8: back-port fix for CVE-2013-2882

* npm: Upgrade to 1.3.8

* crypto: fix assert() on malformed hex input (Ben Noordhuis)

* crypto: fix memory leak in randomBytes() error path (Ben Noordhuis)

* events: fix memory leak, don't leak event names (Ben Noordhuis)

* http: Handle hex/base64 encodings properly (isaacs)

* http: improve chunked res.write(buf) performance (Ben Noordhuis)

* stream: Fix double pipe error emit (Eran Hammer)
2013-08-16 08:32:38 -07:00
isaacs 5abdef790c npm: Upgrade to 1.3.8 2013-08-16 08:19:31 -07:00
Ben Noordhuis f55aca6515 crypto: fix memory leak in randomBytes() error path
This is the conceptual back-port of commit ec54873 from the master
branch.
2013-08-16 16:50:01 +02:00
isaacs 255650f4d9 http: Handle hex/base64 encodings properly
This is a backport of 6d3d60aced39d59eaa5e705b7d822c227d0d3dae for
v0.10.
2013-08-15 15:01:28 -07:00
Timothy J Fontaine b1acb2ebd6 blog: Post for v0.11.5 2013-08-06 17:14:53 -07:00
Eran Hammer 23d92ec88e stream: Fix double pipe error emit
If an error listener is added to a stream using once() before it is
piped, it is invoked and removed during pipe() but before pipe() sees it
which causes it to be emitted again.

Fixes #4155 #4978
2013-08-06 08:15:13 -07:00
isaacs 366baedfd8 doc: Update LICENSE for npm's Artistic 2.0 2013-08-05 13:56:05 -07:00
mstarzinger@chromium.org 6b92a71321 v8: back-port fix for CVE-2013-2882
Quoting the CVE:

    Google V8, as used in Google Chrome before 28.0.1500.95, allows
    remote attackers to cause a denial of service or possibly have
    unspecified other impact via vectors that leverage "type confusion."

Likely has zero impact on node.js because it only runs local, trusted
code but let's apply it anyway.

This is a back-port of upstream commit r15665. Original commit log:

    Use internal array as API function cache.

    R=yangguo@chromium.org
    BUG=chromium:260106
    TEST=cctest/test-api/Regress260106

    Review URL: https://codereview.chromium.org/19159003

Fixes #5973.
2013-08-05 18:17:24 +02:00
Forrest L Norvell 231092d236 doc: document domain.enter() and domain.exit()
Adds the documentation requested in #5017.
2013-08-05 13:11:38 +02:00
Sam Roberts 6a7be99703 doc: fs.open, fix flag/mode confusion, etc.
Flags and modes aren't the same, symlinks are followed in all of the
path but the last component, docs should say something about what the
mode argument is for and when its used, fs.openSync should point to the
function that contains the docs for its args, as fs.writeSync does.
2013-08-05 12:26:09 +02:00
isaacs bea9dfa14c npm: Upgrade to 1.3.7 2013-08-02 14:55:22 -07:00
Ben Noordhuis 9e1eb361e8 test: future-proof simple/test-event-emitter-memory-leak
Run the garbage collector before running the actual test. It doesn't
matter now but if in the future something in node.js core creates a lot
of reclaimable garbage, that will break the test's expectation.
2013-08-01 16:14:14 +02:00
Ben Noordhuis 98db7babcc test: fix pummel/test-net-connect-memleak
* Run the garbage collector before creating the big array. It doesn't
  matter now but if in the future something in node.js core creates
  a lot of reclaimable garbage, that will break the test's expectation.

* The first RSS check was being done too late. The garbage collector
  might have run before the check, throwing off the 'reclaimed memory'
  calculation.

* Due to changes in how V8 represents the big array internally, the
  actual memory usage is just below 256 MB on x64. Update the test's
  expectation.
2013-08-01 16:07:46 +02:00
Ben Noordhuis fc6f8a6943 events: fix memory leak, don't leak event names
Before this commit, events were set to undefined rather than deleted
from the EventEmitter's backing dictionary for performance reasons:
`delete obj.key` causes a transition of the dictionary's hidden class
and that can be costly.

Unfortunately, that introduces a memory leak when many events are added
and then removed again. The strings containing the event names are never
reclaimed by the garbage collector because they remain part of the
dictionary.

That's why this commit makes EventEmitter delete events again. This
effectively reverts commit 0397223.

Fixes #5970.
2013-08-01 14:52:06 +02:00
Ben Noordhuis 3398cce193 http: improve chunked res.write(buf) performance
Avoid a costly buffer-to-string operation. Instead, allocate a new
buffer, copy the chunk header and data into it and send that.

The speed difference is negligible on small payloads but it really
shines with larger (10+ kB) chunks. benchmark/http/end-vs-write-end
with 64 kB chunks gives 45-50% higher throughput. With 1 MB chunks,
the difference is a staggering 590%.

Of course, YMMV will vary with real workloads and networks but this
commit should have a positive impact on CPU and memory consumption.

Big kudos to Wyatt Preul (@wpreul) for reporting the issue and providing
the initial patch.

Fixes #5941 and #5944.
2013-07-31 13:23:06 +02:00
Wyatt Preul 6359e017ac docs: Warning about consuming response 2013-07-30 15:06:20 -07:00
Ben Noordhuis 6327d67be3 crypto: fix assert() on malformed hex input
Use the StringBytes::IsValidString() function introduced in commit
dce26cc to ensure that the input string meets the expectations of the
other StringBytes functions before processing it further.

Fixes the following assertion:

    Assertion failed: (str->Length() % 2 == 0 && "invalid hex string
    length"), function StorageSize, file ../../src/string_bytes.cc,
    line 301.

Fixes #5725.
2013-07-30 14:34:19 +02:00
Ben Noordhuis dce26ccea1 string_bytes: add StringBytes::IsValidString()
Performs a quick, non-exhaustive check on the input string to see if
it's compatible with the specified string encoding.

Curently it only checks that hex strings have a length that is a
multiple of two.
2013-07-30 14:32:47 +02:00
Ben Noordhuis 4881a6a9a3 doc: clarify fs.read() offset argument 2013-07-28 00:05:10 +02:00
Andrew Chilton 767c5bf01d doc: add nodejs.geek.nz to the community page 2013-07-27 16:02:05 +02:00
Rod Vagg df1673202c doc: add nodejs.org.au to community listing 2013-07-27 12:25:59 +02:00
Ben Noordhuis e4363145ba test: fix simple/test-setproctitle
The title shouldn't be too long; libuv's uv_set_process_title() out of
security considerations no longer overwrites envp, only argv, so the
maximum title length is possibly quite short.

Fixes #5908.
2013-07-25 12:29:20 +02:00
Timothy J Fontaine 180f987147 blog: Post for v0.10.15 2013-07-25 17:03:21 -07:00
Timothy J Fontaine 33267337fa Now working on 0.10.16 2013-07-25 17:03:03 -07:00
Timothy J Fontaine 272525714d Merge branch 'v0.10.15-release' into v0.10 2013-07-25 17:02:38 -07:00
Timothy J Fontaine 2426d65af8 2013.07.25, Version 0.10.15 (Stable)
* src: fix process.getuid() return value (Ben Noordhuis)
2013-07-25 16:26:15 -07:00
Ben Noordhuis 015ec05272 src: fix process.getuid() return value
And process.getgid() too.

Commit ed80638 changed fs.chown() and fs.fchown() to only accept
unsigned integers. Make process.getuid() and process.getgid() follow
suit.

This commit should unbreak npm on OS X - it's hitting the new 'uid must
be an unsigned int' check when installing as e.g. user 'nobody' (which
has an UID of -2 in /etc/passwd or 4294967294 when cast to an uid_t.)

Fixes #5904.
2013-07-26 00:29:03 +02:00
Ben Noordhuis 0de5b831e2 doc: document tls.Server 'secureProtocol' option 2013-07-25 23:21:54 +02:00
Timothy J Fontaine 0256edc43e blog: Post for v0.10.14 2013-07-25 13:54:55 -07:00
Timothy J Fontaine 90c448de23 Now working on 0.10.15 2013-07-25 13:54:16 -07:00
Timothy J Fontaine e2a598b5f2 Merge branch 'v0.10.14-release' into v0.10 2013-07-25 13:53:45 -07:00
Timothy J Fontaine fdf57f811f 2013.07.25, Version 0.10.14 (Stable)
* uv: Upgrade to v0.10.13

* npm: Upgrade to v1.3.5

* os: Don't report negative times in cpu info (Ben Noordhuis)

* fs: Handle large UID and GID (Ben Noordhuis)

* url: Fix edge-case when protocol is non-lowercase (Shuan Wang)

* doc: Streams API Doc Rewrite (isaacs)

* node: call MakeDomainCallback in all domain cases (Trevor Norris)

* crypto: fix memory leak in LoadPKCS12 (Fedor Indutny)
2013-07-25 11:49:01 -07:00
Timothy J Fontaine 5c81f41e70 uv: Upgrade to v0.10.13 2013-07-25 10:48:29 -07:00
isaacs 4bf5211820 doc: explicitly set industry logo height 2013-07-24 13:37:20 -07:00
isaacs ff0de45929 npm: Upgrade to v1.3.5 2013-07-24 13:23:44 -07:00
Ben Noordhuis e20811a628 src: os: use Number::New() for CPU info
The return values from uv_cpu_info() don't necessarily fit in a 32 bits
signed integer.

Fixes #5732.
2013-07-23 17:12:17 +02:00
Ben Noordhuis ed806385bf fs: uids and gids must be unsigned ints
Before this commit, fs.chown() and fs.fchown() coerced the uid and gid
arguments to signed integers which is wrong because uid_t and gid_t are
unsigned on most all platforms and IDs that don't fit in a signed
integer do exist.

This commit changes the aforementioned functions to take unsigned ints
instead.  No test because we can't assume the system has [GU]IDs that
large.

This change depends on joyent/libuv@d779eb5.

Fixes #5890.
2013-07-23 13:36:46 +02:00
Ben Noordhuis 14f45ba739 test: move two tests from simple/ to internet/
Fixes #5876.
2013-07-20 12:36:33 +02:00
Ben Noordhuis e0c4fba0ac doc: events: clarify 'newListener' emitter state
Ditto for the 'removeListener' event.
2013-07-18 20:49:24 +02:00
Shuan Wang 48a4600c56 url: Fix edge-case when protocol is non-lowercase
When using url.parse(), path and pathname usually return '/' when there
is no path available. However when you have a protocol that contains
non-lowercase letters and the input string does not have a trailing
slash, both path and pathname will be undefined.
2013-07-17 15:59:28 -07:00