platform/upstream/nodejs.git
11 years agonpm: Upgrade to 1.2.30
isaacs [Wed, 12 Jun 2013 17:59:44 +0000 (10:59 -0700)]
npm: Upgrade to 1.2.30

11 years agov8: fix pointer arithmetic undefined behavior
Trevor Norris [Tue, 11 Jun 2013 21:39:25 +0000 (14:39 -0700)]
v8: fix pointer arithmetic undefined behavior

Clang branch release_33 would optimize out a != NULL check because of
some undefined behavior. This is a floating patch as a backport of that
fix.

Committed: http://code.google.com/p/v8/source/detail?r=13570

11 years agocrypto: fix utf8/utf-8 encoding check
Ben Noordhuis [Mon, 10 Jun 2013 21:34:11 +0000 (23:34 +0200)]
crypto: fix utf8/utf-8 encoding check

Normalize the encoding in getEncoding() before using it. Fixes a
"AssertionError: Cannot change encoding" exception when the caller
mixes "utf8" and "utf-8".

Fixes #5655.

11 years agobuild: add pkgsrc rule
Timothy J Fontaine [Tue, 4 Jun 2013 00:05:56 +0000 (17:05 -0700)]
build: add pkgsrc rule

11 years agonpm: Upgrade to 1.2.27
isaacs [Thu, 6 Jun 2013 21:44:48 +0000 (14:44 -0700)]
npm: Upgrade to 1.2.27

11 years agonet: Destroy when not readable and not writable
isaacs [Wed, 5 Jun 2013 06:43:29 +0000 (23:43 -0700)]
net: Destroy when not readable and not writable

This is only relevant for CentOS 6.3 using kernel version 2.6.32.

On other linuxes and darwin, the `read` call gets an ECONNRESET in that
case.  On sunos, the `write` call fails with EPIPE.

However, old CentOS will occasionally send an EOF instead of a
ECONNRESET or EPIPE when the client has been destroyed abruptly.

Make sure we don't keep trying to write or read more in that case.

Fixes #5504

However, there is still the question of what libuv should do when it
gets an EOF.  Apparently in this case, it will continue trying to read,
which is almost certainly the wrong thing to do.

That should be fixed in libuv, even though this works around the issue.

11 years agoNow working on v0.10.11
isaacs [Tue, 4 Jun 2013 21:38:41 +0000 (14:38 -0700)]
Now working on v0.10.11

11 years agoblog: Release v0.10.10
isaacs [Tue, 4 Jun 2013 21:38:29 +0000 (14:38 -0700)]
blog: Release v0.10.10

11 years agoMerge branch 'v0.10.10-release' into v0.10
isaacs [Tue, 4 Jun 2013 21:38:10 +0000 (14:38 -0700)]
Merge branch 'v0.10.10-release' into v0.10

11 years ago2013.06.04, Version 0.10.10 (Stable) v0.10.10
isaacs [Tue, 4 Jun 2013 19:13:46 +0000 (12:13 -0700)]
2013.06.04, Version 0.10.10 (Stable)

* uv: Upgrade to 0.10.10

* npm: Upgrade to 1.2.25

* url: Properly parse certain oddly formed urls (isaacs)

* stream: unshift('') is a noop (isaacs)

11 years agouv: Upgrade to 0.10.10
isaacs [Tue, 4 Jun 2013 19:11:03 +0000 (12:11 -0700)]
uv: Upgrade to 0.10.10

11 years agourl: remove unused global variable
Ben Noordhuis [Tue, 21 May 2013 21:04:58 +0000 (23:04 +0200)]
url: remove unused global variable

11 years agonpm: Upgrade to 1.2.25
isaacs [Tue, 4 Jun 2013 18:42:32 +0000 (11:42 -0700)]
npm: Upgrade to 1.2.25

11 years agodoc: ChangeLog update for v0.8.24
isaacs [Tue, 4 Jun 2013 18:22:14 +0000 (11:22 -0700)]
doc: ChangeLog update for v0.8.24

11 years agoblog: 0.8 is maintenace, not stable
isaacs [Tue, 4 Jun 2013 18:19:10 +0000 (11:19 -0700)]
blog: 0.8 is maintenace, not stable

11 years agoblog: Release v0.8.24
isaacs [Tue, 4 Jun 2013 18:12:54 +0000 (11:12 -0700)]
blog: Release v0.8.24

11 years agoblog: Release v0.10.9
isaacs [Tue, 4 Jun 2013 18:12:44 +0000 (11:12 -0700)]
blog: Release v0.10.9

11 years agourl: Set href to null by default
isaacs [Mon, 3 Jun 2013 23:02:51 +0000 (16:02 -0700)]
url: Set href to null by default

11 years agourl: Properly parse certain oddly formed urls
isaacs [Mon, 3 Jun 2013 20:39:57 +0000 (13:39 -0700)]
url: Properly parse certain oddly formed urls

In cases where there are multiple @-chars in a url, Node currently
parses the hostname and auth sections differently than web browsers.

This part of the bug is serious, and should be landed in v0.10, and
also ported to v0.8, and releases made as soon as possible.

The less serious issue is that there are many other sorts of malformed
urls which Node either accepts when it should reject, or interprets
differently than web browsers.  For example, `http://a.com*foo` is
interpreted by Node like `http://a.com/*foo` when web browsers treat
this as `http://a.com%3Bfoo/`.

In general, *only* the `hostEndingChars` should be the characters that
delimit the host portion of the URL.  Most of the current `nonHostChars`
that appear in the hostname should be escaped, but some of them (such as
`;` and `%` when it does not introduce a hex pair) should raise an
error.

We need to have a broader discussion about whether it's best to throw in
these cases, and potentially break extant programs, or return an object
that has every field set to `null` so that any attempt to read the
hostname/auth/etc. will appear to be empty.

11 years agostream: unshift('') is a noop
isaacs [Mon, 3 Jun 2013 17:50:02 +0000 (10:50 -0700)]
stream: unshift('') is a noop

In some cases, the http CONNECT/Upgrade API is unshifting an empty
bodyHead buffer onto the socket.

Normally, stream.unshift(chunk) does not set state.reading=false.
However, this check was not being done for the case when the chunk was
empty (either `''` or `Buffer(0)`), and as a result, it was causing the
socket to think that a read had completed, and to stop providing data.

This bug is not limited to http or web sockets, but rather would affect
any parser that unshifts data back onto the source stream without being
very careful to never unshift an empty chunk.  Since the intent of
unshift is to *not* change the state.reading property, this is a bug.

Fixes #5557
Fixes LearnBoost/socket.io#1242

11 years agoNow working on v0.10.10
isaacs [Thu, 30 May 2013 18:28:07 +0000 (11:28 -0700)]
Now working on v0.10.10

11 years agoMerge branch 'v0.10.9-release' into v0.10
isaacs [Thu, 30 May 2013 18:27:50 +0000 (11:27 -0700)]
Merge branch 'v0.10.9-release' into v0.10

11 years ago2013.05.30, Version 0.10.9 (Stable) v0.10.9
isaacs [Thu, 30 May 2013 17:31:07 +0000 (10:31 -0700)]
2013.05.30, Version 0.10.9 (Stable)

* npm: Upgrade to 1.2.24

* uv: Upgrade to v0.10.9

* repl: fix JSON.parse error check (Brian White)

* tls: proper .destroySoon (Fedor Indutny)

* tls: invoke write cb only after opposite read end (Fedor Indutny)

* tls: ignore .shutdown() syscall error (Fedor Indutny)

11 years agonpm: Upgrade to 1.2.24
isaacs [Thu, 30 May 2013 17:19:45 +0000 (10:19 -0700)]
npm: Upgrade to 1.2.24

11 years agodoc: remove `bufferSize` option
Kiyoshi Nomo [Wed, 22 May 2013 14:22:21 +0000 (23:22 +0900)]
doc: remove `bufferSize` option

`bufferSize` option has been removed in b0f6789.

11 years agorepl: fix JSON.parse error check
Brian White [Sun, 26 May 2013 16:26:39 +0000 (12:26 -0400)]
repl: fix JSON.parse error check

Before this, entering something like:

> JSON.parse('066');

resulted in the "..." prompt instead of displaying the expected
"SyntaxError: Unexpected number"

11 years agotls: proper .destroySoon
Fedor Indutny [Thu, 30 May 2013 09:35:24 +0000 (13:35 +0400)]
tls: proper .destroySoon

1. Emit `sslOutEnd` only when `_internallyPendingBytes() === 0`.
2. Read before checking `._halfRead`, otherwise we'll see only previous
   value, and will invoke `._write` callback improperly.
3. Wait for both `end` and `finish` events in `.destroySoon`.
4. Unpipe encrypted stream from socket to prevent write after destroy.

11 years agodoc: sending dgram handles only works on unix
Ben Noordhuis [Wed, 29 May 2013 14:35:00 +0000 (16:35 +0200)]
doc: sending dgram handles only works on unix

11 years agohttps: Add `secureProtocol` docs
Daniel G. Taylor [Wed, 15 May 2013 19:16:09 +0000 (13:16 -0600)]
https: Add `secureProtocol` docs

Add `secureProtocol` parameter docs to the https.request method.

11 years agotls: Add `secureProtocol` docs
Daniel G. Taylor [Wed, 15 May 2013 19:14:20 +0000 (13:14 -0600)]
tls: Add `secureProtocol` docs

Add `secureProtocol` parameter docs to the tls.connect method.

11 years agouv: Upgrade to v0.10.9
isaacs [Tue, 28 May 2013 19:10:14 +0000 (12:10 -0700)]
uv: Upgrade to v0.10.9

11 years agotls: invoke write cb only after opposite read end
Fedor Indutny [Mon, 27 May 2013 10:44:33 +0000 (14:44 +0400)]
tls: invoke write cb only after opposite read end

Stream's `._write()` callback should be invoked only after it's opposite
stream has finished processing incoming data, otherwise `finish` event
fires too early and connection might be closed while there's some data
to send to the client.

see #5544

11 years agotls: ignore .shutdown() syscall error
Fedor Indutny [Tue, 28 May 2013 13:50:38 +0000 (17:50 +0400)]
tls: ignore .shutdown() syscall error

Quote from SSL_shutdown man page:

  The output of SSL_get_error(3) may be misleading,
  as an erroneous SSL_ERROR_SYSCALL may be flagged even though
  no error occurred.

Also, handle all other errors to prevent assertion in `ClearError()`.

11 years agodoc: add link to Brazilian Node community
Rafael Henrique Moreira [Sat, 25 May 2013 03:49:49 +0000 (03:49 +0000)]
doc: add link to Brazilian Node community

Add a link to the Brazilian community portal.

11 years agodoc: remove broken links on community page
Rafael Henrique Moreira [Sat, 25 May 2013 04:01:25 +0000 (04:01 +0000)]
doc: remove broken links on community page

Links to Node Manual and Node Bits both are broken, so this commit
removes them from the community page.

11 years agoblog: Post for v0.10.8
isaacs [Fri, 24 May 2013 22:45:59 +0000 (15:45 -0700)]
blog: Post for v0.10.8

11 years agoNow working on 0.10.9
isaacs [Fri, 24 May 2013 22:45:46 +0000 (15:45 -0700)]
Now working on 0.10.9

11 years agoMerge branch 'v0.10.8-release' into v0.10
isaacs [Fri, 24 May 2013 22:44:04 +0000 (15:44 -0700)]
Merge branch 'v0.10.8-release' into v0.10

11 years ago2013.05.24, Version 0.10.8 (Stable) v0.10.8
isaacs [Fri, 24 May 2013 21:45:24 +0000 (14:45 -0700)]
2013.05.24, Version 0.10.8 (Stable)

* v8: update to 3.14.5.9

* uv: upgrade to 0.10.8

* npm: Upgrade to 1.2.23

* http: remove bodyHead from 'upgrade' events (Nathan Zadoks)

* http: Return true on empty writes, not false (isaacs)

* http: save roundtrips, convert buffers to strings (Ben Noordhuis)

* configure: respect the --dest-os flag consistently (Nathan Rajlich)

* buffer: throw when writing beyond buffer (Trevor Norris)

* crypto: Clear error after DiffieHellman key errors (isaacs)

* string_bytes: strip padding from base64 strings (Trevor Norris)

11 years agodoc: Minor fixup in http doc re bodyHead
isaacs [Fri, 24 May 2013 22:06:03 +0000 (15:06 -0700)]
doc: Minor fixup in http doc re bodyHead

11 years agotls: retry writing after hello parse error
Fedor Indutny [Fri, 24 May 2013 21:02:34 +0000 (01:02 +0400)]
tls: retry writing after hello parse error

When writing bad data to EncryptedStream it'll first get to the
ClientHello parser, and, only after it will refuse it, to the OpenSSL.
But ClientHello parser has limited buffer and therefore write could
return `bytes_written` < `incoming_bytes`, which is not the case when
working with OpenSSL.

After such errors ClientHello parser disables itself and will
pass-through all data to the OpenSSL. So just trying to write data one
more time will throw the rest into OpenSSL and let it handle it.

11 years agonpm: Upgrade to 1.2.23
isaacs [Fri, 24 May 2013 21:41:43 +0000 (14:41 -0700)]
npm: Upgrade to 1.2.23

11 years agouv: upgrade to 0.10.8
isaacs [Fri, 24 May 2013 21:41:00 +0000 (14:41 -0700)]
uv: upgrade to 0.10.8

11 years agohttp: remove bodyHead from 'upgrade' events
Nathan Zadoks [Fri, 24 May 2013 17:34:38 +0000 (19:34 +0200)]
http: remove bodyHead from 'upgrade' events

Streams2 makes this unnecessary.
An empty buffer is provided for compatibility.

11 years agobuffer: special case empty string writes
Timothy J Fontaine [Thu, 23 May 2013 23:23:07 +0000 (16:23 -0700)]
buffer: special case empty string writes

Prior to 119354f we specifically handled passing a zero length string
to write on a buffer, restore that functionality.

11 years agohttp: Return true on empty writes, not false
isaacs [Thu, 23 May 2013 22:12:13 +0000 (15:12 -0700)]
http: Return true on empty writes, not false

Otherwise, writing an empty string causes the whole program to grind to
a halt when piping data into http messages.

This wasn't as much of a problem (though it WAS a bug) in 0.8 and
before, because our hyperactive 'drain' behavior would mean that some
*previous* write() would probably have a pending drain event, and cause
things to start moving again.

11 years agov8: re-apply floating patches
Timothy J Fontaine [Thu, 23 May 2013 20:40:40 +0000 (13:40 -0700)]
v8: re-apply floating patches

11 years agov8: fix GetLocalizedMessage usage
Timothy J Fontaine [Thu, 23 May 2013 20:57:59 +0000 (13:57 -0700)]
v8: fix GetLocalizedMessage usage

As is the backport of the abort on uncaught exception wouldn't compile
because we it was passing in `this` when it was unnecessary.

11 years agov8: update to 3.14.5.9
Timothy J Fontaine [Thu, 23 May 2013 20:39:12 +0000 (13:39 -0700)]
v8: update to 3.14.5.9

11 years agohttp: save roundtrips, convert buffers to strings
Ben Noordhuis [Wed, 22 May 2013 19:43:35 +0000 (21:43 +0200)]
http: save roundtrips, convert buffers to strings

This commit adds an optimization to the HTTP client that makes it
possible to:

* Pack the headers and the first chunk of the request body into a
  single write().

* Pack the chunk header and the chunk itself into a single write().

Because only one write() system call is issued instead of several,
the chances of data ending up in a single TCP packet are phenomenally
higher: the benchmark with `type=buf size=32` jumps from 50 req/s to
7,500 req/s, a 150-fold increase.

This commit removes the check from e4b716ef that pushes binary encoded
strings into the slow path. The commit log mentions that:

    We were assuming that any string can be concatenated safely to
    CRLF.  However, for hex, base64, or binary encoded writes, this
    is not the case, and results in sending the incorrect response.

For hex and base64 strings that's certainly true but binary strings
are 'das Ding an sich': string.length is the same before and after
decoding.

Fixes #5528.

11 years agodoc: the build requires gcc 4.2 or newer
Ben Noordhuis [Wed, 22 May 2013 11:47:29 +0000 (13:47 +0200)]
doc: the build requires gcc 4.2 or newer

11 years agoconfigure: respect the --dest-os flag consistently
Nathan Rajlich [Tue, 21 May 2013 16:26:42 +0000 (09:26 -0700)]
configure: respect the --dest-os flag consistently

Consider a user on his Mac, who wants to cross-compile for his Linux ARM device:

    ./configure --dest-cpu=arm --dest-os=linux

Before this patch, for example, DTrace probes would incorrectly attempt to be
enabled because the configure script is running on a MacOS machine, even though
we're trying to compile a binary for `linux`.

With this patch, the `--dest-os` flag is respected throughout the configure
script, thus leaving DTrace probes disabled in this cross-compiling scenario.

11 years agonet: use timers._unrefActive for internal timeouts
Timothy J Fontaine [Fri, 17 May 2013 22:07:28 +0000 (15:07 -0700)]
net: use timers._unrefActive for internal timeouts

11 years agotimers: internal unref'd timer for api timeouts
Timothy J Fontaine [Fri, 17 May 2013 22:04:24 +0000 (15:04 -0700)]
timers: internal unref'd timer for api timeouts

When an internal api needs a timeout, they should use
timers._unrefActive since that won't hold the loop open. This solves
the problem where you might have unref'd the socket handle but the
timeout for the socket was still active.

11 years agobuffer: throw when writing beyond buffer
Trevor Norris [Mon, 20 May 2013 21:37:55 +0000 (14:37 -0700)]
buffer: throw when writing beyond buffer

Previously one could write anywhere in a buffer pool if they accidently
got their offset wrong. Mainly because the cc level checks only test
against the parent slow buffer and not against the js object properties.
So now we check to make sure values won't go beyond bounds without
letting the dev know.

11 years agocrypto: Clear error after DiffieHellman key errors
isaacs [Sat, 18 May 2013 00:19:12 +0000 (17:19 -0700)]
crypto: Clear error after DiffieHellman key errors

Fixes #5499

11 years agostring_bytes: strip padding from base64 strings
Trevor Norris [Mon, 20 May 2013 19:35:31 +0000 (12:35 -0700)]
string_bytes: strip padding from base64 strings

Because of variations in different base64 implementation, it's been
decided to strip all padding from the end of a base64 string and
calculate its size from that.

11 years agosrc: Remove superfluous static_cast
isaacs [Fri, 17 May 2013 23:58:05 +0000 (16:58 -0700)]
src: Remove superfluous static_cast

11 years agoblog: Release 0.10.7
isaacs [Fri, 17 May 2013 21:38:02 +0000 (14:38 -0700)]
blog: Release 0.10.7

11 years agoNow working on 0.10.8
isaacs [Fri, 17 May 2013 21:37:44 +0000 (14:37 -0700)]
Now working on 0.10.8

11 years agoMerge branch 'v0.10.7-release' into v0.10
isaacs [Fri, 17 May 2013 21:37:28 +0000 (14:37 -0700)]
Merge branch 'v0.10.7-release' into v0.10

11 years ago2013.05.17, Version 0.10.7 (Stable) v0.10.7
isaacs [Fri, 17 May 2013 20:59:10 +0000 (13:59 -0700)]
2013.05.17, Version 0.10.7 (Stable)

* uv: upgrade to v0.10.7

* npm: Upgrade to 1.2.21

* crypto: Don't ignore verify encoding argument (isaacs)

* buffer, crypto: fix default encoding regression (Ben Noordhuis)

* timers: fix setInterval() assert (Ben Noordhuis)

11 years agodoc: Fix link to open issues on GitHub.
Brandon Frohs [Thu, 16 May 2013 14:03:25 +0000 (11:03 -0300)]
doc: Fix link to open issues on GitHub.

11 years agocrypto: Don't ignore verify encoding argument
isaacs [Fri, 17 May 2013 20:55:29 +0000 (13:55 -0700)]
crypto: Don't ignore verify encoding argument

11 years agobuffer, crypto: fix default encoding regression
Ben Noordhuis [Wed, 15 May 2013 15:52:00 +0000 (17:52 +0200)]
buffer, crypto: fix default encoding regression

The default encoding is 'buffer'. When the input is a string, treat it
as 'binary'. Fixes the following assertion:

  node: ../src/string_bytes.cc:309: static size_t
  node::StringBytes::StorageSize(v8::Handle<v8::Value>, node::encoding):
  Assertion `0 && "buffer encoding specified but string provided"'
  failed.

Introduced in 64fc34b2.

Fixes #5482.

11 years agodoc: fix missing Class in header
Ryuichi Okumura [Sun, 7 Apr 2013 08:40:55 +0000 (17:40 +0900)]
doc: fix missing Class in header

11 years agodoc: fix the link to Stream document
Ryuichi Okumura [Sun, 7 Apr 2013 08:19:50 +0000 (17:19 +0900)]
doc: fix the link to Stream document

11 years agotimers: fix setInterval() assert
Ben Noordhuis [Thu, 21 Mar 2013 11:19:03 +0000 (12:19 +0100)]
timers: fix setInterval() assert

Test case:

  var t = setInterval(function() {}, 1);
  process.nextTick(t.unref);

Output:

  Assertion failed: (args.Holder()->InternalFieldCount() > 0),
  function Unref, file ../src/handle_wrap.cc, line 78.

setInterval() returns a binding layer object. Make it stop doing that,
wrap the raw process.binding('timer_wrap').Timer object in a Timeout
object.

Fixes #4261.

11 years agodoc: improve exports/module.exports consistency
Ryan Graham [Mon, 8 Apr 2013 16:59:58 +0000 (09:59 -0700)]
doc: improve exports/module.exports consistency

While they reference the same object, they are only interchangeable
for updates, not assignment.

11 years agodoc: clarify exports and module.exports
Ryan Graham [Mon, 8 Apr 2013 16:59:15 +0000 (09:59 -0700)]
doc: clarify exports and module.exports

When exporting a single function you must use `module.exports` instead
of the `exports` convenience reference.

11 years agouv: upgrade to v0.10.7
Bert Belder [Tue, 14 May 2013 23:52:47 +0000 (16:52 -0700)]
uv: upgrade to v0.10.7

11 years agouv: Upgrade to 0.10.6
isaacs [Tue, 14 May 2013 21:41:41 +0000 (14:41 -0700)]
uv: Upgrade to 0.10.6

11 years agonpm: Upgrade to 1.2.21
isaacs [Tue, 14 May 2013 21:37:59 +0000 (14:37 -0700)]
npm: Upgrade to 1.2.21

11 years agoblog: Release 0.10.6
isaacs [Tue, 14 May 2013 21:35:14 +0000 (14:35 -0700)]
blog: Release 0.10.6

11 years agoNow working on v0.10.7
isaacs [Tue, 14 May 2013 21:33:56 +0000 (14:33 -0700)]
Now working on v0.10.7

11 years agoMerge branch 'v0.10.6-release' into v0.10
isaacs [Tue, 14 May 2013 21:33:33 +0000 (14:33 -0700)]
Merge branch 'v0.10.6-release' into v0.10

11 years agocrypto: Pass encodings for Hmac digest
isaacs [Fri, 3 May 2013 01:38:04 +0000 (18:38 -0700)]
crypto: Pass encodings for Hmac digest

11 years ago2013.05.14, Version 0.10.6 (Stable) v0.10.6
isaacs [Tue, 14 May 2013 18:42:16 +0000 (11:42 -0700)]
2013.05.14, Version 0.10.6 (Stable)

* module: Deprecate require.extensions (isaacs)

* stream: make Readable.wrap support objectMode, empty streams (Daniel Moore)

* child_process: fix handle delivery (Ben Noordhuis)

* crypto: Fix performance regression (isaacs)

* src: DRY string encoding/decoding (isaacs)

11 years agocrypto: Pass encodings to C++ for Sign/Verify
isaacs [Fri, 3 May 2013 01:34:25 +0000 (18:34 -0700)]
crypto: Pass encodings to C++ for Sign/Verify

11 years agocrypto: use StringBytes::Encode
isaacs [Thu, 2 May 2013 22:32:32 +0000 (15:32 -0700)]
crypto: use StringBytes::Encode

11 years agocrypto: Pass strings to binding layer directly
isaacs [Thu, 2 May 2013 19:28:48 +0000 (12:28 -0700)]
crypto: Pass strings to binding layer directly

11 years agobuffer: DRY string encoding using StringBytes
isaacs [Thu, 2 May 2013 17:44:45 +0000 (10:44 -0700)]
buffer: DRY string encoding using StringBytes

This also templatizes the Buffer::*Slice functions, and the template
function probably cannot be safely used outside of Node.  However, it
also SHOULD not be used outside of Node, so this is arguably a feature
as well as a caveat.

11 years agosrc: use StringBytes for DecodeWrite/DecodeBytes/Encode
isaacs [Thu, 2 May 2013 17:49:20 +0000 (10:49 -0700)]
src: use StringBytes for DecodeWrite/DecodeBytes/Encode

Bonus: this makes node::Encode actually work properly with base64,
ucs2, hex, etc.

11 years agosrc: Use StringBytes in StreamWrap
isaacs [Wed, 1 May 2013 22:40:13 +0000 (15:40 -0700)]
src: Use StringBytes in StreamWrap

11 years agosrc: Add StringBytes static util class
isaacs [Wed, 1 May 2013 22:40:43 +0000 (15:40 -0700)]
src: Add StringBytes static util class

Four functions:

- StringBytes::StorageSize()
- StringBytes::Size()
- StringBytes::Write()
- StringBytes::Encode()

11 years agotools: remove unnecessary cpplint rules
isaacs [Wed, 1 May 2013 22:36:09 +0000 (15:36 -0700)]
tools: remove unnecessary cpplint rules

We don't actually care about header order much, and since we never use
stl classes, 'string' isn't an issue for node ever.

11 years agostream: Make default encoding configurable
isaacs [Thu, 2 May 2013 19:25:50 +0000 (12:25 -0700)]
stream: Make default encoding configurable

Pretty much everything assumes strings to be utf-8, but crypto
traditionally used binary strings, so we need to keep the default
that way until most users get off of that pattern.

11 years agostream: don't create unnecessary buffers in Readable
isaacs [Tue, 30 Apr 2013 22:09:54 +0000 (15:09 -0700)]
stream: don't create unnecessary buffers in Readable

If there is an encoding, and we do 'stream.push(chunk, enc)', and the
encoding argument matches the stated encoding, then we're converting from
a string, to a buffer, and then back to a string.  Of course, this is a
completely pointless bit of work, so it's best to avoid it when we know
that we can do so safely.

11 years agolint
isaacs [Tue, 30 Apr 2013 22:02:19 +0000 (15:02 -0700)]
lint

11 years agobenchmark: hash stream
isaacs [Tue, 30 Apr 2013 21:50:21 +0000 (14:50 -0700)]
benchmark: hash stream

11 years agoblog: Release v0.11.2
isaacs [Tue, 14 May 2013 18:35:43 +0000 (11:35 -0700)]
blog: Release v0.11.2

11 years agotest: increase workers to 8 in cluster-disconnect
Benoit Vallée [Tue, 30 Apr 2013 04:25:23 +0000 (12:25 +0800)]
test: increase workers to 8 in cluster-disconnect

Increasing the number of workers from 2 to 8 makes this test
more likely to trigger race conditions. See #5330 for background.

11 years agodoc: clarify subsystems in CONTRIBUTING.md
Ben Noordhuis [Tue, 14 May 2013 10:31:38 +0000 (12:31 +0200)]
doc: clarify subsystems in CONTRIBUTING.md

11 years agochild_process: fix handle delivery
Ben Noordhuis [Fri, 10 May 2013 18:19:17 +0000 (11:19 -0700)]
child_process: fix handle delivery

Commit 9352c19 ("child_process: don't emit same handle twice") trades
one bug for another.

Before said commit, a handle was sometimes delivered with messages it
didn't belong to.

The bug fix introduced another bug that needs some explaining. On UNIX
systems, handles are basically file descriptors that are passed around
with the sendmsg() and recvmsg() system calls, using auxiliary data
(SCM_RIGHTS) as the transport.

node.js and libuv depend on the fact that none of the supported systems
ever emit more than one SCM_RIGHTS message from a recvmsg() syscall.
That assumption is something we should probably address someday for the
sake of portability but that's a separate discussion.

So, SCM_RIGHTS messages are never coalesced. SCM_RIGHTS and normal
messages however _are_ coalesced. That is, recvmsg() might return this:

  recvmsg();  // { "message-with-fd", "message", "message" }

The operating system implicitly breaks pending messages along
SCM_RIGHTS boundaries. Most Unices break before such messages but Linux
also breaks _after_ them.  When the sender looks like this:

  sendmsg("message");
  sendmsg("message-with-fd");
  sendmsg("message");

Then on most Unices the receiver sees messages arriving like this:

  recvmsg();  // { "message" }
  recvmsg();  // { "message-with-fd", "message" }

The bug fix in commit 9352c19 assumes this behavior. On Linux however,
those messages can also come in like this:

  recvmsg();  // { "message", "message-with-fd" }
  recvmsg();  // { "message" }

In other words, it's incorrect to assume that the file descriptor is
always attached to the first message. This commit makes node wise up.

Fixes #5330.

11 years agodoc: s/search.npmjs.org/npmjs.org/
isaacs [Thu, 9 May 2013 22:15:39 +0000 (15:15 -0700)]
doc: s/search.npmjs.org/npmjs.org/

11 years agotest: fix pummel/test-net-many-clients.js
Timothy J Fontaine [Mon, 6 May 2013 23:37:03 +0000 (16:37 -0700)]
test: fix pummel/test-net-many-clients.js

client sockets no longer emit 'connect' event inside the
requestListener, update test-net-many-clients to reflect that

11 years agodoc: document stream.Writable 'error' event
Robert Kowalski [Mon, 6 May 2013 19:53:35 +0000 (21:53 +0200)]
doc: document stream.Writable 'error' event

Fixes #5255.

11 years agostream: make Readable.wrap support empty streams
Daniel Moore [Wed, 1 May 2013 17:46:31 +0000 (13:46 -0400)]
stream: make Readable.wrap support empty streams

This makes Readable.wrap behave properly when the wrapped stream ends
before emitting any data events.

11 years agostream: make Readable.wrap support objectMode
Daniel Moore [Mon, 29 Apr 2013 13:25:08 +0000 (09:25 -0400)]
stream: make Readable.wrap support objectMode

Added a check to see if the stream is in objectMode before deciding
whether to include or exclude data from an old-style wrapped stream.

11 years agotest: don't use total_seconds() because of py2.6
Timothy J Fontaine [Tue, 7 May 2013 22:17:33 +0000 (15:17 -0700)]
test: don't use total_seconds() because of py2.6