platform/upstream/nodejs.git
9 years agourl: Add support for RFC 3490 separators
Mathias Bynens [Mon, 4 Aug 2014 10:44:06 +0000 (12:44 +0200)]
url: Add support for RFC 3490 separators

There is no need to split the host by hand in `url.js` – Punycode.js
takes care of it anyway. This not only simplifies the code, but also
adds support for RFC 3490 separators (i.e. not just U+002E, but U+3002,
U+FF0E, and U+FF61 as well).

Closes #6055.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agoquerystring: fix unescape override
Tristan Berger [Tue, 26 Aug 2014 08:39:25 +0000 (04:39 -0400)]
querystring: fix unescape override

Documentation states that `querystring.unescape` may be overridden to
replace unescaper during parsing. However, the function was only
being used as a fallback for when the native decoder throws (on a
malformed URL). This patch moves the call to the native function and
the try/catch around it into querystring.unescape then has the parser
always invoke it, so that an override will always be used.

Fixes #4055

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agogyp: use --export-dynamic on FreeBSD
Fedor Indutny [Sun, 24 Aug 2014 22:19:15 +0000 (02:19 +0400)]
gyp: use --export-dynamic on FreeBSD

Should help addons use OpenSSL functions.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
9 years agodeps: enable ARM assembly for OpenSSL
Fedor Indutny [Fri, 22 Aug 2014 10:21:50 +0000 (14:21 +0400)]
deps: enable ARM assembly for OpenSSL

fix #8062

9 years agodeps: fix up v8 after fd80a3
Fedor Indutny [Thu, 21 Aug 2014 23:59:35 +0000 (03:59 +0400)]
deps: fix up v8 after fd80a3

fd80a31e0697d6317ce8c2d289575399f4e06d21 has introduced a segfault
during redundant boundary check elimination (#8208).

The problem consists of two parts:

  1. Abscense of instruction iterator in
     `EliminateRedundantBoundsChecks`. It was present in recent v8, but
     wasn't considered important at the time of backport. However, since
     the function is changing instructions order in block, it is
     important to not rely at `i->next()` at the end of the loop.
  2. Too strict ASSERT in `MoveIndexIfNecessary`. It is essentially a
     backport of a45c96ab from v8's upstream. See
     https://github.com/v8/v8/commit/a45c96ab for details.

fix #8208

10 years agoNow working on 0.10.32
Timothy J Fontaine [Tue, 19 Aug 2014 22:12:30 +0000 (18:12 -0400)]
Now working on 0.10.32

10 years agoMerge branch 'v0.10.31-release' into v0.10
Timothy J Fontaine [Tue, 19 Aug 2014 22:12:21 +0000 (18:12 -0400)]
Merge branch 'v0.10.31-release' into v0.10

10 years ago2014.08.19, Version 0.10.31 (Stable) v0.10.31
Timothy J Fontaine [Tue, 19 Aug 2014 15:19:52 +0000 (11:19 -0400)]
2014.08.19, Version 0.10.31 (Stable)

* v8: backport CVE-2013-6668

* openssl: Update to v1.0.1i

* npm: Update to v1.4.23

* cluster: disconnect should not be synchronous (Sam Roberts)

* fs: fix fs.readFileSync fd leak when get RangeError (Jackson Tian)

* stream: fix Readable.wrap objectMode falsy values (James Halliday)

* timers: fix timers with non-integer delay hanging. (Julien Gilli)

10 years agonpm: Update to v1.4.23
Timothy J Fontaine [Tue, 19 Aug 2014 15:17:36 +0000 (11:17 -0400)]
npm: Update to v1.4.23

10 years agogyp: preserve v8dbg syms on freebsd too
Fedor Indutny [Mon, 18 Aug 2014 13:58:36 +0000 (17:58 +0400)]
gyp: preserve v8dbg syms on freebsd too

10 years agoRevert "gyp: preserve v8dbg syms on freebsd too"
Fedor Indutny [Mon, 18 Aug 2014 13:57:26 +0000 (17:57 +0400)]
Revert "gyp: preserve v8dbg syms on freebsd too"

This reverts commit 181b8a5d3af2e14c50dd32e1f16bf553fd3c7050.

10 years agogyp: preserve v8dbg syms on freebsd too
Fedor Indutny [Sun, 17 Aug 2014 10:19:14 +0000 (14:19 +0400)]
gyp: preserve v8dbg syms on freebsd too

10 years agodeps: backport 5f836c from v8 upstream
Fedor Indutny [Thu, 14 Aug 2014 15:29:28 +0000 (19:29 +0400)]
deps: backport 5f836c from v8 upstream

Original commit message:

    Fix Hydrogen bounds check elimination

    When combining bounds checks, they must all be moved before the first load/store
    that they are guarding.

    BUG=chromium:344186
    LOG=y
    R=svenpanne@chromium.org

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

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

fix #8070

10 years agoopenssl: fix keypress requirement in apps on win32
Fedor Indutny [Wed, 11 Dec 2013 17:19:04 +0000 (21:19 +0400)]
openssl: fix keypress requirement in apps on win32

Original source:

http://openssl.6102.n7.nabble.com/PATCH-s-client-Fix-keypress-requirement-with-redirected-input-on-Windows-td46787.html

Reviewed-By: Fedor Indutny <fedor@indutny.com>
10 years agodeps: update openssl to v1.0.1i
Fedor Indutny [Thu, 7 Aug 2014 09:36:56 +0000 (13:36 +0400)]
deps: update openssl to v1.0.1i

10 years agotests: fix child-process-fork-dgram on SmartOS.
Julien Gilli [Thu, 31 Jul 2014 23:16:42 +0000 (16:16 -0700)]
tests: fix child-process-fork-dgram on SmartOS.

Send messages until both the parent and the child process have received
at least one message. If at least one of them doesn't receive any
message, the test runner will make the test timeout.

Fixes #8046.

10 years agodoc: document arguments for 'error' event on a stream
Maciej Małecki [Thu, 7 Aug 2014 18:56:34 +0000 (20:56 +0200)]
doc: document arguments for 'error' event on a stream

Fixes #6361.

10 years agofs: fix fs.readFileSync fd leak when get RangeError
Jackson Tian [Wed, 6 Aug 2014 03:21:59 +0000 (11:21 +0800)]
fs: fix fs.readFileSync fd leak when get RangeError

10 years agodoc: clarify factory methods for net.Socket
Kevin Simper [Sun, 3 Aug 2014 00:27:02 +0000 (02:27 +0200)]
doc: clarify factory methods for net.Socket

10 years agov8: Fix compliation with GCC 4.8
Timothy J Fontaine [Mon, 4 Aug 2014 20:43:50 +0000 (13:43 -0700)]
v8: Fix compliation with GCC 4.8

Supresses a very loud warning from GCC 4.8 about unused typedefs

Original url https://codereview.chromium.org/69413002

10 years agotimers: fix timers with non-integer delay hanging.
Julien Gilli [Mon, 4 Aug 2014 16:52:35 +0000 (09:52 -0700)]
timers: fix timers with non-integer delay hanging.

When backporting f8193ab into v0.10, a regression was introduced. Timers
with non-integer timeout could trigger a infinite recursion with 100%
cpu usage. This commit backports 93b0624 which fixes the regression.

After backporting f8193ab, instead of using Date.now(), timers would use
Timer.now() to determine if they had expired. However, Timer.now() is
based on loop->time, which is not updated when a timer's remaining time
is > 0 and < 1. Timers would thus never timeout if their remaining time
was at some point > 0 and < 1.

With this commit, Timer.now() updates loop->time itself, and timers
always timeout eventually.

Fixes #8065 and #8068.

10 years agocluster: disconnect should not be synchronous
Sam Roberts [Thu, 31 Jul 2014 23:44:15 +0000 (16:44 -0700)]
cluster: disconnect should not be synchronous

Callbacks in node are usually asynchronous, and should never be
sometimes synchronous, and sometimes asynchronous.

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
10 years agostream: fix Readable.wrap objectMode falsy values
James Halliday [Mon, 9 Jun 2014 01:58:53 +0000 (18:58 -0700)]
stream: fix Readable.wrap objectMode falsy values

A streams1 stream will have its falsy values such as 0, false, or ""
eaten by the upgrade to streams2, even when objectMode is enabled.

Include test for said cases.

Reviewed-by: isaacs <i@izs.me>
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
10 years agodocs: fix non-string ignore note in path.resolve
Jakob Gillich [Wed, 25 Jun 2014 17:08:46 +0000 (19:08 +0200)]
docs: fix non-string ignore note in path.resolve

Reviewed-By: Fedor Indutny <fedor@indutny.com>
10 years agoNow working on 0.10.31
Timothy J Fontaine [Thu, 31 Jul 2014 18:12:08 +0000 (11:12 -0700)]
Now working on 0.10.31

10 years agoMerge branch 'v0.10.30-release' into v0.10
Timothy J Fontaine [Thu, 31 Jul 2014 18:11:53 +0000 (11:11 -0700)]
Merge branch 'v0.10.30-release' into v0.10

10 years ago2014.07.31, Version 0.10.30 (Stable) v0.10.30
Timothy J Fontaine [Thu, 31 Jul 2014 17:24:06 +0000 (10:24 -0700)]
2014.07.31, Version 0.10.30 (Stable)

* uv: Upgrade to v0.10.28

* npm: Upgrade to v1.4.21

* v8: Interrupts must not mask stack overflow.

* Revert "stream: start old-mode read in a next tick" (Fedor Indutny)

* buffer: fix sign overflow in `readUIn32BE` (Fedor Indutny)

* buffer: improve {read,write}{U}Int* methods (Nick Apperson)

* child_process: handle writeUtf8String error (Fedor Indutny)

* deps: backport 4ed5fde4f from v8 upstream (Fedor Indutny)

* deps: cherry-pick eca441b2 from OpenSSL (Fedor Indutny)

* lib: remove and restructure calls to isNaN() (cjihrig)

* module: eliminate double `getenv()` (Maciej Małecki)

* stream2: flush extant data on read of ended stream (Chris Dickinson)

* streams: remove unused require('assert') (Rod Vagg)

* timers: backport f8193ab (Julien Gilli)

* util.h: interface compatibility (Oguz Bastemur)

* zlib: do not crash on write after close (Fedor Indutny)

10 years agouv: Upgrade to v0.10.28
Timothy J Fontaine [Thu, 31 Jul 2014 16:31:01 +0000 (09:31 -0700)]
uv: Upgrade to v0.10.28

10 years agov8: Interrupts must not mask stack overflow.
Fedor Indutny [Wed, 30 Jul 2014 22:33:52 +0000 (15:33 -0700)]
v8: Interrupts must not mask stack overflow.

Backport of https://codereview.chromium.org/339883002

10 years agonpm: Upgrade to v1.4.21
Timothy J Fontaine [Thu, 31 Jul 2014 16:05:30 +0000 (09:05 -0700)]
npm: Upgrade to v1.4.21

10 years agomodule: eliminate double `getenv()`
Maciej Małecki [Tue, 25 Mar 2014 21:47:05 +0000 (04:47 +0700)]
module: eliminate double `getenv()`

`process.env` access results in a synchronous `getenv` call. Cache the
first result instead and save one syscall.

10 years agostreams: remove unused require('assert')
Rod Vagg [Sun, 30 Mar 2014 08:51:01 +0000 (19:51 +1100)]
streams: remove unused require('assert')

10 years agotimers: backport f8193ab
Julien Gilli [Wed, 23 Jul 2014 01:03:10 +0000 (18:03 -0700)]
timers: backport f8193ab

Original commit message:

 timers: use uv_now instead of Date.now

 This saves a few calls to gettimeofday which can be expensive, and
 potentially subject to clock drift. Instead use the loop time which
 uses hrtime internally.

In addition to the backport, this commit:
 - keeps _idleStart timers' property which is still set to
   Date.now() to avoid breaking existing code that uses it, even if
   its use is discouraged.
 - adds automated tests. These tests use a specific branch of
   libfaketime that hasn't been submitted upstream yet. libfaketime
   is git cloned if needed when running automated tests.

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
10 years agogyp: do not rm unused openssl syms on osx/linux
Fedor Indutny [Wed, 30 Jul 2014 10:54:36 +0000 (14:54 +0400)]
gyp: do not rm unused openssl syms on osx/linux

fix #8026

Reviewed-By: Fedor Indutny <fedor@indutny.com>
10 years agobuffer: fix sign overflow in `readUIn32BE`
Fedor Indutny [Tue, 29 Jul 2014 08:34:49 +0000 (12:34 +0400)]
buffer: fix sign overflow in `readUIn32BE`

`|` operation takes precendence on `+`, which will result in
`new Buffer('ffffffff', 16).readUInt32BE(0)` returning `-1` instead of
`ffffffff`.

10 years agotest: fix test-https-foafssl
Fedor Indutny [Wed, 23 Jul 2014 19:55:24 +0000 (23:55 +0400)]
test: fix test-https-foafssl

10 years agotest: fix test-tls-server-verify
Fedor Indutny [Wed, 23 Jul 2014 19:51:14 +0000 (23:51 +0400)]
test: fix  test-tls-server-verify

fix #7963

10 years agodoc: console.trace takes a message format
Sam Roberts [Sat, 19 Jul 2014 21:34:41 +0000 (14:34 -0700)]
doc: console.trace takes a message format

Documentation claimed it accepted a single label argument, as time and
timeEnd do, which was incorrect.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agogyp: fix post-mortem in v0.11
Fedor Indutny [Mon, 21 Jul 2014 18:12:11 +0000 (22:12 +0400)]
gyp: fix post-mortem in v0.11

Expose missing constants and keep symbols on OSX.

10 years agodeps: backport 4ed5fde4f from v8 upstream
Fedor Indutny [Fri, 21 Dec 2012 17:52:00 +0000 (17:52 +0000)]
deps: backport 4ed5fde4f from v8 upstream

Original commit message:

    Fix x64 MathMinMax for negative untagged int32 arguments.

    An untagged int32 has zeros in the upper half even if it is negative.
    Using cmpq to compare such numbers will incorrectly ignore the sign.

    BUG=164442
    R=mvstanton@chromium.org

    Review URL: https://chromiumcodereview.appspot.com/11665007

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

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agogyp: do not let `v8dbg_` slip away on osx
Fedor Indutny [Thu, 17 Jul 2014 05:55:07 +0000 (09:55 +0400)]
gyp: do not let `v8dbg_` slip away on osx

Pass `-force_load` to linker when linking to `libv8_base` to preserve
`v8dbg_` symbols, which are useful for debugging.

10 years agolib: jslint string_decoder.js
Fedor Indutny [Tue, 15 Jul 2014 08:43:59 +0000 (12:43 +0400)]
lib: jslint string_decoder.js

10 years agostream2: flush extant data on read of ended stream
Chris Dickinson [Wed, 9 Jul 2014 09:16:45 +0000 (02:16 -0700)]
stream2: flush extant data on read of ended stream

A ReadableStream with a base64 StringDecoder backed by only
one or two bytes would fail to output its partial data before
ending. This fix adds a check to see if the `read` was triggered
by an internal `flow`, and if so, empties any remaining data.

fixes #7914.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agochild_process: handle writeUtf8String error
Fedor Indutny [Sat, 12 Jul 2014 09:35:26 +0000 (12:35 +0300)]
child_process: handle writeUtf8String error

When handling `writeUtf8String` error, return after emitting it.
Otherwise a runtime failure can occur.

fix #7923

10 years agolib: remove and restructure calls to isNaN()
cjihrig [Wed, 9 Jul 2014 01:06:05 +0000 (21:06 -0400)]
lib: remove and restructure calls to isNaN()

Switch condition order to check for null before calling isNaN().
Also remove two unnecessary calls to isNaN() that are already
covered by calls to isFinite(). This commit targets v0.10, as
opposed to #7891, which targets master (suggested by
@bnoordhuis). Closes #7840.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agodoc: added X.json to the LOAD_AS_FILE sudo code
Maurice Butler [Mon, 7 Jul 2014 06:29:59 +0000 (16:29 +1000)]
doc: added X.json to the LOAD_AS_FILE sudo code

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agodoc: fix console.assert docs, message is a format
Sam Roberts [Sat, 5 Jul 2014 21:22:45 +0000 (14:22 -0700)]
doc: fix console.assert docs, message is a format

Documentation for console.assert incorrectly described message as a
single message, but it is a format.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agodeps: cherry-pick eca441b2 from OpenSSL
Fedor Indutny [Wed, 2 Jul 2014 17:35:50 +0000 (19:35 +0200)]
deps: cherry-pick eca441b2 from OpenSSL

Original commit message:

    bn_exp.c: fix x86_64-specific crash with one-word modulus.

    PR: #3397

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agoconfigure: fix v8 overriding commands on build
Trevor Norris [Wed, 2 Jul 2014 20:32:11 +0000 (13:32 -0700)]
configure: fix v8 overriding commands on build

V8 seems to ignore the default value for want_separate_host_toolset and
would override it at build time. Instead always explicitly set the value.

Fixes #7833

10 years agodoc: fix createCipher description
Brian White [Mon, 30 Jun 2014 15:06:47 +0000 (11:06 -0400)]
doc: fix createCipher description

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
10 years agoconstants: add O_NONBLOCK constant
Fedor Indutny [Mon, 30 Jun 2014 08:43:47 +0000 (12:43 +0400)]
constants: add O_NONBLOCK constant

It appears that it is defined unconditionally on all supported unixes.

fix #7867 #7855

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
10 years agoRevert "constants: export O_NONBLOCK"
Fedor Indutny [Mon, 30 Jun 2014 08:43:30 +0000 (12:43 +0400)]
Revert "constants: export O_NONBLOCK"

This reverts commit 00890e43fb935c8bc5dc150f0f2c96bc465d8a4d.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
10 years agoRevert "src: fix _XOPEN_SOURCE redefinition warning"
Fedor Indutny [Mon, 30 Jun 2014 08:43:28 +0000 (12:43 +0400)]
Revert "src: fix _XOPEN_SOURCE redefinition warning"

This reverts commit 885142a5edc2c803fa8b9d92b5d0771379237764.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
10 years agoRevert "stream: start old-mode read in a next tick"
Fedor Indutny [Mon, 30 Jun 2014 09:06:35 +0000 (13:06 +0400)]
Revert "stream: start old-mode read in a next tick"

This reverts commit 2efe4ab7616669448f873b0417e9aa81221324e2.

10 years agozlib: do not crash on write after close
Fedor Indutny [Thu, 12 Jun 2014 04:11:28 +0000 (21:11 -0700)]
zlib: do not crash on write after close

fix #7767

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agoutil.h: interface compatibility
Oguz Bastemur [Fri, 13 Jun 2014 09:36:52 +0000 (11:36 +0200)]
util.h: interface compatibility

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agobuffer: improve {read,write}{U}Int* methods
Nick Apperson [Tue, 25 Mar 2014 14:51:13 +0000 (09:51 -0500)]
buffer: improve {read,write}{U}Int* methods

Increase the performance and simplify the logic of Buffer#write{U}Int*
and Buffer#read{U}Int* methods by placing the byte manipulation code
directly inline.

Also improve the speed of buffer-write benchmarks by creating a new
call directly to each method by using Function() instead of calling by
buff[fn].

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Conflicts:
lib/buffer.js

10 years agodoc: buffer: clarify typed array construction
Ben Noordhuis [Fri, 20 Jun 2014 10:02:13 +0000 (12:02 +0200)]
doc: buffer: clarify typed array construction

It's possible to construct a typed array from a buffer but the buffer
is treated as an array, not a byte array as one might expect.

Fixes #7786.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
10 years agonode: update changelog to have proper npm version
Timothy J Fontaine [Tue, 17 Jun 2014 00:16:13 +0000 (19:16 -0500)]
node: update changelog to have proper npm version

fixes #7793

10 years agobuild: run wix tool chain out of process
Timothy J Fontaine [Fri, 13 Jun 2014 21:39:53 +0000 (14:39 -0700)]
build: run wix tool chain out of process

Building MSIs for different arch's can sometimes confuse MSBuild and
Wix, isntead run the toolchain externally so we don't have to worry
about which arch cmd.exe is running as.

10 years agonode: signing the CLA is no longer a requirement
Timothy J Fontaine [Wed, 11 Jun 2014 15:51:53 +0000 (11:51 -0400)]
node: signing the CLA is no longer a requirement

10 years agoNow working on 0.10.30
Timothy J Fontaine [Mon, 9 Jun 2014 17:52:27 +0000 (10:52 -0700)]
Now working on 0.10.30

10 years agoMerge branch 'v0.10.29-release' into v0.10
Timothy J Fontaine [Mon, 9 Jun 2014 17:51:53 +0000 (10:51 -0700)]
Merge branch 'v0.10.29-release' into v0.10

10 years ago2014.06.05, Version 0.10.29 (Stable) v0.10.29
Timothy J Fontaine [Mon, 9 Jun 2014 17:04:36 +0000 (10:04 -0700)]
2014.06.05, Version 0.10.29 (Stable)

* openssl: to 1.0.1h (CVE-2014-0224)

* npm: upgrade to 1.4.10

* utf8: Prevent Node from sending invalid UTF-8 (Felix Geisendörfer)
  - *NOTE* this introduces a breaking change, previously you could construct
invalid UTF-8 and invoke an error in a client that was expecting valid
UTF-8, now unmatched surrogate pairs are replaced with the unknown UTF-8
character. To restore the old functionality simply have NODE_INVALID_UTF8
environment variable set.

* child_process: do not set args before throwing (Greg Sabia Tucker)

* child_process: spawn() does not throw TypeError (Greg Sabia Tucker)

* constants: export O_NONBLOCK (Fedor Indutny)

* crypto: improve memory usage (Alexis Campailla)

* fs: close file if fstat() fails in readFile() (cjihrig)

* lib: name EventEmitter prototype methods (Ben Noordhuis)

* tls: fix performance issue (Alexis Campailla)

10 years agofs: remove duplicate check
Brian White [Sat, 7 Jun 2014 15:53:23 +0000 (11:53 -0400)]
fs: remove duplicate check

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agov8: shift heap space for aslr on 64bit
Timothy J Fontaine [Thu, 5 Jun 2014 22:55:48 +0000 (15:55 -0700)]
v8: shift heap space for aslr on 64bit

Previously we were only shifting the address space for ASLR on 32bit
processes, apply the same shift for 64bit so processes don't
get artificially limited native heap.

10 years agonpm: upgrade to v1.4.14
Timothy J Fontaine [Thu, 5 Jun 2014 22:18:15 +0000 (15:18 -0700)]
npm: upgrade to v1.4.14

10 years agosrc: replace usage of String::Utf8Value
Timothy J Fontaine [Thu, 10 Apr 2014 00:33:33 +0000 (17:33 -0700)]
src: replace usage of String::Utf8Value

v8::String::Utf8Value previously could allow invalid surrogates when
interpreting values.

10 years agostring_bytes: Guarantee valid utf-8 output
Felix Geisendörfer [Mon, 20 Jan 2014 08:47:19 +0000 (09:47 +0100)]
string_bytes: Guarantee valid utf-8 output

Previously v8's WriteUtf8 function would produce invalid utf-8 output
when encountering unmatched surrogate code units [1]. The new
REPLACE_INVALID_UTF8 option fixes that by replacing invalid code points
with the unicode replacement character.

[1]: JS Strings are defined as arrays of 16 bit unsigned integers. There
is no unicode enforcement, so one can easily end up with invalid unicode
code unit sequences inside a string.

10 years agodeps/v8: Apply REPLACE_INVALID_UTF8 patch
Felix Geisendörfer [Mon, 20 Jan 2014 08:43:43 +0000 (09:43 +0100)]
deps/v8: Apply REPLACE_INVALID_UTF8 patch

- https://codereview.chromium.org/121173009/
- https://code.google.com/p/v8/source/detail?r=18683

Note: The v8 test case did not cleanly apply, so it's missing from this
patch. I'm assuming this is not a problem if the v8 test suite is not
part of the node build / test system. If that's the case I'll fix it.
Otherwise the test case will be integrated once v8 is upgraded.

10 years agostring_decoder: Add more comments
Felix Geisendörfer [Tue, 13 May 2014 15:42:48 +0000 (17:42 +0200)]
string_decoder: Add more comments

10 years agostring_decoder: Fix failures from new test cases
Felix Geisendörfer [Tue, 13 May 2014 15:36:40 +0000 (17:36 +0200)]
string_decoder: Fix failures from new test cases

This patch simplifies the implementation of StringDecoder, fixes the
failures from the new test cases, and also no longer relies on v8's
WriteUtf8 function to encode individual surrogates.

10 years agostring_decoder: Improve test coverage
Felix Geisendörfer [Tue, 13 May 2014 15:30:25 +0000 (17:30 +0200)]
string_decoder: Improve test coverage

The test cases are still essentially the same, but now all possible ways
of writing a buffer into the decoder are tested, which has exposed a few
failing scenarios that had not been discovered so far!

10 years agostream: start old-mode read in a next tick
Fedor Indutny [Fri, 16 May 2014 09:10:34 +0000 (13:10 +0400)]
stream: start old-mode read in a next tick

Calling `.read()` in the same tick with `.on('data', ...)` may cause
users missing `error` events, because no `error` listeners were set yet.

fix #7618

10 years agodeps: update openssl to 1.0.1h
Fedor Indutny [Thu, 5 Jun 2014 14:09:35 +0000 (07:09 -0700)]
deps: update openssl to 1.0.1h

10 years agodoc: fixed wording in child_process
Chris Barber [Fri, 30 May 2014 21:25:52 +0000 (14:25 -0700)]
doc: fixed wording in child_process

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agofs: close file if fstat() fails in readFile()
cjihrig [Wed, 28 May 2014 22:34:04 +0000 (18:34 -0400)]
fs: close file if fstat() fails in readFile()

Currently, if fstat() fails in readFile(), the callback
is invoked without closing the file. This commit closes
the file before calling back.

Closes #7697

10 years agotls: fix performance issue
Alexis Campailla [Fri, 23 May 2014 18:55:34 +0000 (14:55 -0400)]
tls: fix performance issue

See https://github.com/orangemocha/node-connection-drop

I have pinpointed the performance degradation to
https://github.com/joyent/node/commit/ac2263b77f3f346458d06fc019de27e24c63cee0

This change brings performance back to the orginal levels.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agodoc: document url `slashes` property
Yazhong Liu [Wed, 7 May 2014 10:59:23 +0000 (18:59 +0800)]
doc: document url `slashes` property

Slashes should be documented, because 3rd-party protocols -- those
postfixed with `://` -- would incorrectly `format` and `parse` if they
didn't set/get the `slashes` option.

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
10 years agodoc: clarify `end` vs `finish` in streams
Calvin Metcalf [Tue, 13 May 2014 15:52:38 +0000 (11:52 -0400)]
doc: clarify `end` vs `finish` in streams

Adds a section to the transform stream docs to clarify the
difference between the `end` event and the `finish` events.
Also clarifies the wording on the `end` event.

10 years agoconfigure: allow V8 snapshot for cross-compilation
Andrei Sedoi [Thu, 15 May 2014 23:11:51 +0000 (02:11 +0300)]
configure: allow V8 snapshot for cross-compilation

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agocrypto: improve memory usage
Alexis Campailla [Wed, 14 May 2014 17:07:29 +0000 (13:07 -0400)]
crypto: improve memory usage

ClientHelloParser used to contain an 18k buffer that was kept around
for the life of the connection, even though it was not needed in many
situations. I changed it to be deallocated when it's determined to
be no longer needed.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agochild_process: do not set args before throwing
Greg Sabia Tucker [Wed, 14 May 2014 05:32:57 +0000 (22:32 -0700)]
child_process: do not set args before throwing

No point in setting args and options if TypeError
is being thrown.

fix #7456

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agosrc: fix _XOPEN_SOURCE redefinition warning
Ben Noordhuis [Tue, 13 May 2014 11:45:21 +0000 (13:45 +0200)]
src: fix _XOPEN_SOURCE redefinition warning

Fix the following compiler warning on systems where _XOPEN_SOURCE is
defined by default:

    ../src/node_constants.cc:35:0: warning: "_XOPEN_SOURCE" redefined
     #define _XOPEN_SOURCE 500

Move the (re)definition of _XOPEN_SOURCE to the top of the file while
we're here.  Commit 00890e4 adds a `#define _XOPEN_SOURCE 500` in order
to make <fcntl.h> expose O_NONBLOCK but it does so after other system
headers have been included.  If those headers include <fcntl.h>, then
the #include in node_constants.cc will be a no-op and O_NONBLOCK won't
be visible.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agochild_process: spawn() does not throw TypeError
Greg Sabia Tucker [Wed, 30 Apr 2014 01:24:44 +0000 (18:24 -0700)]
child_process: spawn() does not throw TypeError

Ensure TypeError is thrown, fix a bug where `env` option was
assuming the option was actually an object.

This case is especially bad because it then sets `env == null`
instead of using `process.env`.

Fix #7456

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agolib: name EventEmitter prototype methods
Ben Noordhuis [Mon, 5 May 2014 14:48:51 +0000 (16:48 +0200)]
lib: name EventEmitter prototype methods

Before this commit the EventEmitter methods were anonymous functions.
V8 tries to infer names for anonymous functions based on the execution
context but it frequently gets it wrong and when that happens, the
stack trace is usually confusing and unhelpful.  This commit names all
methods so V8 can fall back to the method.name property.

The above gotcha applies to all anonymous functions but is exacerbated
for EventEmitter methods because those are invoked with a plenitude of
different receivers.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
10 years agonpm: upgrade to 1.4.10
isaacs [Tue, 6 May 2014 01:20:40 +0000 (18:20 -0700)]
npm: upgrade to 1.4.10

* Don't set referer if already set
* fetch: Send referer and npm-session headers
* run-script: Support --parseable and --json
* list runnable scripts (Evan Lucas)
* Use marked instead of ronn for html docs

10 years agoconstants: export O_NONBLOCK
Fedor Indutny [Thu, 6 Mar 2014 16:29:21 +0000 (20:29 +0400)]
constants: export O_NONBLOCK

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agodeps: backport 23f2736a from v8 upstream
Fedor Indutny [Fri, 2 May 2014 18:44:45 +0000 (22:44 +0400)]
deps: backport 23f2736a from v8 upstream

Original text:

    Fix corner case in x64 compare stubs.

    BUG=v8:2416

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

fix #7528

10 years agoNow working on 0.10.29
Timothy J Fontaine [Fri, 2 May 2014 14:46:15 +0000 (07:46 -0700)]
Now working on 0.10.29

10 years agoMerge branch 'v0.10.28-release' into v0.10
Timothy J Fontaine [Fri, 2 May 2014 14:46:05 +0000 (07:46 -0700)]
Merge branch 'v0.10.28-release' into v0.10

10 years ago2014.05.01, Version 0.10.28 (Stable) v0.10.28
Timothy J Fontaine [Fri, 2 May 2014 00:47:47 +0000 (17:47 -0700)]
2014.05.01, Version 0.10.28 (Stable)

* npm: upgrade to v1.4.9

10 years agonpm: upgrade to v1.4.9
isaacs [Thu, 1 May 2014 23:30:33 +0000 (16:30 -0700)]
npm: upgrade to v1.4.9

* Send referer header (with any potentially private stuff redacted)
* Fix critical typo bug in previous npm release

10 years agoNow working on 0.10.28
Timothy J Fontaine [Thu, 1 May 2014 22:30:07 +0000 (15:30 -0700)]
Now working on 0.10.28

10 years agoMerge branch 'v0.10.27-release' into v0.10
Timothy J Fontaine [Thu, 1 May 2014 22:29:52 +0000 (15:29 -0700)]
Merge branch 'v0.10.27-release' into v0.10

10 years ago2014.05.01, Version 0.10.27 (Stable) v0.10.27
Timothy J Fontaine [Thu, 1 May 2014 21:04:20 +0000 (14:04 -0700)]
2014.05.01, Version 0.10.27 (Stable)

* npm: upgrade to v1.4.8

* openssl: upgrade to 1.0.1g

* uv: update to v0.10.27

* dns: fix certain txt entries (Fedor Indutny)

* assert: Ensure reflexivity of deepEqual (Mike Pennisi)

* child_process: fix deadlock when sending handles (Fedor Indutny)

* child_process: fix sending handle twice (Fedor Indutny)

* crypto: do not lowercase cipher/hash names (Fedor Indutny)

* dtrace: workaround linker bug on FreeBSD (Fedor Indutny)

* http: do not emit EOF non-readable socket (Fedor Indutny)

* http: invoke createConnection when no agent (Nathan Rajlich)

* stream: remove useless check (Brian White)

* timer: don't reschedule timer bucket in a domain (Greg Brail)

* url: treat  the same as / (isaacs)

* util: format as Error if instanceof Error (Rod Vagg)

10 years agonpm: upgrade to v1.4.8
isaacs [Thu, 1 May 2014 18:09:00 +0000 (11:09 -0700)]
npm: upgrade to v1.4.8

* Check SHA before using files from cache
* adduser: allow change of the saved password
* Make `npm install` respect `config.unicode`
* Fix lifecycle to pass `Infinity` for config env value
* Don't return 0 exit code on invalid command
* cache: Handle 404s and other HTTP errors as errors
* bump tap dep, make tests stderr a bit quieter
* Resolve ~ in path configs to env.HOME
* Include npm version in default user-agent conf
* npm init: Use ISC as default license, use save-prefix for deps
* Many test and doc fixes

10 years agouv: update to v0.10.27
Timothy J Fontaine [Thu, 1 May 2014 16:27:39 +0000 (09:27 -0700)]
uv: update to v0.10.27

10 years agodocs: add cautionary note to emitter.removeAllListeners
Forrest L Norvell [Mon, 28 Apr 2014 19:38:06 +0000 (12:38 -0700)]
docs: add cautionary note to emitter.removeAllListeners

Signed-off-by: Fedor Indutny <fedor@indutny.com>
10 years agodeps: fix v8 link error with glibc < 2.17
Ben Noordhuis [Mon, 28 Apr 2014 11:05:00 +0000 (13:05 +0200)]
deps: fix v8 link error with glibc < 2.17

Commit f9ced08 switches V8 on Linux over from gettimeofday() to
clock_getres() and clock_gettime().  As of glibc 2.17, those functions
live in libc.  For older versions, we need to pull them in from librt.

Fixes the following link-time error;

    Release/obj.target/deps/v8/tools/gyp/libv8_base.a(platform-posix.o):
    In function `v8::internal::OS::Ticks()':
    platform-posix.cc:(.text+0x93c):
    undefined reference to `clock_gettime'
    platform-posix.cc:(.text+0x989):
    undefined reference to `clock_getres'

Fixes #7514.

Signed-off-by: Fedor Indutny <fedor@indutny.com>