platform/upstream/nodejs.git
10 years agoMerge remote-tracking branch 'origin/v0.10'
Fedor Indutny [Wed, 26 Mar 2014 07:42:57 +0000 (11:42 +0400)]
Merge remote-tracking branch 'origin/v0.10'

Conflicts:
src/node.cc
src/node_crypto.cc
src/node_crypto.h

10 years agosrc: ensure that openssl's PRNG is fully seeded
Ben Noordhuis [Tue, 25 Mar 2014 22:35:28 +0000 (23:35 +0100)]
src: ensure that openssl's PRNG is fully seeded

Ensure that OpenSSL has enough entropy (at least 256 bits) for its PRNG.

The entropy pool starts out empty and needs to fill up before the PRNG
can be used securely.

OpenSSL normally fills the pool automatically but not when someone
starts generating random numbers before the pool is full: in that case
OpenSSL keeps lowering the entropy estimate to thwart attackers trying
to guess the initial state of the PRNG.

When that happens, we wait until enough entropy is available, something
that normally should never take longer than a few milliseconds.

Fixes #7338.

10 years agosrc: seed V8's random number generator at startup
Ben Noordhuis [Fri, 20 Sep 2013 20:01:49 +0000 (22:01 +0200)]
src: seed V8's random number generator at startup

The default entropy source is /dev/urandom on UNIX platforms, which is
okay but we can do better by seeding it from OpenSSL's entropy pool.

On Windows we can certainly do better; on that platform, V8 seeds the
random number generator using only the current system time.

Fixes #6250.

NB: This is a back-port of commit 7ac2391 from the master branch that
for some reason never got back-ported to the v0.10 branch.

The default on UNIX platforms in v0.10 is different and arguably worse
than it is with master: if no entropy source is provided, V8 3.14 calls
srandom() with a xor of the PID and the current time in microseconds.

That means that on systems with a coarse system clock, the initial
state of the PRNG may be easily guessable.

The situation on Windows is even more dire because there the PRNG is
seeded with only the current time... in milliseconds.

10 years agonpm: upgrade to 1.4.6
isaacs [Wed, 19 Mar 2014 16:25:40 +0000 (09:25 -0700)]
npm: upgrade to 1.4.6

* Documentation upgrades
* Fix glob bug which prevents proper README publishing
* node-gyp upgrade to 0.13
* Documentation updates
* Add --save-exact to save an exact dep (instead of a range)
* alias 't' to 'test'

10 years agodoc: remove `agent.request()` call in example
Nathan Rajlich [Tue, 25 Mar 2014 20:02:42 +0000 (10:02 -1000)]
doc: remove `agent.request()` call in example

The `Agent#request()` function was removed in
f3189ace6b5e31a874df421ac2f74da0e77cb14d, so don't
use it in the documentation example. The function
wasn't documented in the first place.

10 years agohttp: use defaultAgent.protocol in protocol check
Nathan Rajlich [Mon, 24 Mar 2014 22:59:31 +0000 (12:59 -1000)]
http: use defaultAgent.protocol in protocol check

Default to the `defaultAgent.protocol` when comparing the
user-specified `options.protocol` string. This is so that
`http.Agent` instances do not need to specify their own
`protocol` field, since we have the relevant information
already from the `defaultAgent`.

Note that the test case could be separately cherry-picked
to the `v0.10` branch, since it already passes correctly.

Fixes #7349.
Fixes the regression described in: http://git.io/2ds-WQ

10 years agobuild: fix g++ 4.8 build, disable -Werror
Ben Noordhuis [Thu, 6 Mar 2014 04:11:07 +0000 (05:11 +0100)]
build: fix g++ 4.8 build, disable -Werror

Turn off -Werror when building V8, it hits -Werror=unused-local-typedefs
with g++ 4.8.  The warning itself is harmless so don't abort the build.

This was originally implemented in commit d2ab314e back in 2011 but the
build process has gone through a few iterations since then, that change
no longer works.

10 years agovm: share security token between contexts
Fedor Indutny [Tue, 18 Mar 2014 10:03:22 +0000 (14:03 +0400)]
vm: share security token between contexts

By default, each `v8::Context` has a different Security Token, which
prevents access to one context from another.

fix #7140

10 years agopipe_wrap: use Instantiate() method
Trevor Norris [Mon, 17 Mar 2014 21:39:37 +0000 (14:39 -0700)]
pipe_wrap: use Instantiate() method

Retrieve a new client object via PipeWrap::Instantiate(). This method
performs appropriate checks to make sure everything is as it should be.

10 years agoheaders: remove env.h from node_internals.h
Fedor Indutny [Mon, 17 Mar 2014 20:46:40 +0000 (00:46 +0400)]
headers: remove env.h from node_internals.h

`env.h` is an internal header file and should not be copied or exposed
to the users.

Additionally, export convenience `Throw*` methods with `v8::Isolate*` as
a first argument.

10 years agodeps: update v8 to 3.24.35.17
Fedor Indutny [Mon, 17 Mar 2014 20:33:01 +0000 (00:33 +0400)]
deps: update v8 to 3.24.35.17

10 years agotest: update our branched weakref to v8 3.24
Timothy J Fontaine [Mon, 17 Mar 2014 17:19:47 +0000 (10:19 -0700)]
test: update our branched weakref to v8 3.24

10 years agosrc: fix tracing infrastructure after v8 upgrade
Ben Noordhuis [Sat, 15 Mar 2014 06:15:11 +0000 (07:15 +0100)]
src: fix tracing infrastructure after v8 upgrade

Fix up the dtrace/etw/systemtap infrastructure after the V8 upgrade in
commit 1c7bf24.  The win32 changes are untested but can hardly make
things worse because node doesn't build on windows right now.

Fixes #7313 with some luck.

10 years agosrc: don't call DecodeWrite() on Buffers
Ben Noordhuis [Sat, 15 Mar 2014 01:04:02 +0000 (02:04 +0100)]
src: don't call DecodeWrite() on Buffers

Don't call DecodeWrite() with a Buffer as its argument because it in
turn calls StringBytes::Write() and that method expects a Local<String>.

"Why then does that function take a Local<Value>?" I hear you ask.
Good question but I don't have the answer.  I added a CHECK for good
measure and what do you know, all of a sudden a large number of crypto
tests started failing.

Calling DecodeWrite(BINARY) on a buffer is nonsensical anyway: if you
want the contents of the buffer, just copy out the data, there is no
need to decode it - and that's exactly what this commit does.

Fixes a great many instances of the following run-time error in debug
builds:

    FATAL ERROR: v8::String::Cast() Could not convert to string

10 years agosrc: fix up smalloc weak persistent usage
Ben Noordhuis [Sat, 15 Mar 2014 00:12:53 +0000 (01:12 +0100)]
src: fix up smalloc weak persistent usage

Fix a regression that was introduced in commit ce04c726 after the
upgrade to V8 3.24.

The new weak persistent handle API no longer gives you the original
persistent but still requires that you clear it inside your weak
callback.

Rearrange the code in src/smalloc.cc to keep track of the persistent
handle with the least amount of pain and try hard to share as much
code as possible between the 'just free it' and 'invoke my callback'
versions of the smalloc API.

Fixes #7309.

10 years agosrc: add CHECK_{GE,GT,LE,LT} macros
Ben Noordhuis [Sat, 15 Mar 2014 00:25:53 +0000 (01:25 +0100)]
src: add CHECK_{GE,GT,LE,LT} macros

Conform to the Google styleguide more and make cpplint happy, add more
CHECK macros.

Preemptively addresses cpplint's readability/check warnings ("Consider
using CHECK_GT instead of CHECK(a > b)".)

10 years agosrc: deduplicate CHECK_EQ/CHECK_NE macros
Ben Noordhuis [Sat, 15 Mar 2014 00:23:47 +0000 (01:23 +0100)]
src: deduplicate CHECK_EQ/CHECK_NE macros

DRY the macros, there is no need to define them twice depending on
whether NDEBUG is defined or not.

10 years agosrc: fix segfaults, fix 32 bits integer negation
Ben Noordhuis [Fri, 14 Mar 2014 22:22:27 +0000 (23:22 +0100)]
src: fix segfaults, fix 32 bits integer negation

Make calls to v8::Isolate::AdjustAmountOfExternalAllocatedMemory() take
special care when negating 32 bits unsigned types like size_t.

Before this commit, values were negated before they got promoted to
64 bits, meaning that on 32 bits architectures, a value like 42 got
cast to 4294967254 instead of -42.

That in turn made the garbage collector start scavenging like crazy
because it thought the system was out of memory.

That's bad enough but calls to AdjustAmountOfExternalAllocatedMemory()
were made from weak callbacks, i.e. at a time when the garbage collector
was already busy.  It triggered asserts in debug builds and caused
random crashes and memory corruption in release builds.

The behavior in release builds is arguably a V8 bug and should perhaps
be reported upstream.

Partially fixes #7309 but requires further bug fixes to src/smalloc.cc
that I'll address in a follow-up commit.

10 years agosrc: squelch -Wmaybe-uninitialized warning
Ben Noordhuis [Fri, 14 Mar 2014 20:59:48 +0000 (21:59 +0100)]
src: squelch -Wmaybe-uninitialized warning

The variable isn't actually used uninitialized but g++ 4.8 doesn't know
that.  Set it to NULL to silence the following compiler warning:

    ../src/string_bytes.cc:247:29: warning: 'data' may be used
    uninitialized in this function [-Wmaybe-uninitialized]
         unsigned a = hex2bin(src[i * 2 + 0]);
                                  ^
    ../src/string_bytes.cc:299:15: note: 'data' was declared here
       const char* data;
                   ^

10 years agosrc: remove unused ExternString constructor
Ben Noordhuis [Fri, 14 Mar 2014 20:58:14 +0000 (21:58 +0100)]
src: remove unused ExternString constructor

Remove an unused (and unsafe) constructor.  Unsafe because it doesn't
initialize the data_ field.

10 years agosrc, test: fix up ObjectWrap, `make test-addons`
Ben Noordhuis [Thu, 13 Mar 2014 17:53:48 +0000 (18:53 +0100)]
src, test: fix up ObjectWrap, `make test-addons`

V8 was upgraded from 3.22 to 3.24 in commit 1c7bf24.  Upgrade source
files in test/addons/ and automatically generated tests from
doc/api/addons.markdown to the new V8 API.

This coincidentally fixes a bug in src/node_object_wrap.h where it was
still using the old V8 weak persistent handle interface, which is gone
in 3.24.

10 years agonode: fix exported signatures of MakeCallback
Fedor Indutny [Thu, 13 Mar 2014 17:13:59 +0000 (21:13 +0400)]
node: fix exported signatures of MakeCallback

fix #7302

10 years agodeps: allow allocations in gc epilogue/prologue
Fedor Indutny [Thu, 13 Mar 2014 16:47:02 +0000 (20:47 +0400)]
deps: allow allocations in gc epilogue/prologue

See https://codereview.chromium.org/177243012/

10 years agodeps: backport a6fed7c5 from v8's trunk
Fedor Indutny [Thu, 13 Mar 2014 16:46:23 +0000 (20:46 +0400)]
deps: backport a6fed7c5 from v8's trunk

10 years agosrc: update to v8 3.24 APIs
Fedor Indutny [Thu, 13 Mar 2014 16:38:14 +0000 (20:38 +0400)]
src: update to v8 3.24 APIs

10 years agodeps: update v8 to 3.24.40
Fedor Indutny [Thu, 13 Mar 2014 16:45:44 +0000 (20:45 +0400)]
deps: update v8 to 3.24.40

10 years agoreadline: consider newlines for cursor position
Yazhong Liu [Sun, 9 Mar 2014 06:46:54 +0000 (14:46 +0800)]
readline: consider newlines for cursor position

Fixes #7266.
Closes #7279.

10 years agoNow working on 0.11.13
Timothy J Fontaine [Wed, 12 Mar 2014 14:56:42 +0000 (07:56 -0700)]
Now working on 0.11.13

10 years agoMerge branch 'v0.11.12-release'
Timothy J Fontaine [Wed, 12 Mar 2014 14:56:30 +0000 (07:56 -0700)]
Merge branch 'v0.11.12-release'

10 years agosrc: accommodate uv_cwd including null on win32 v0.11.12
Timothy J Fontaine [Tue, 11 Mar 2014 21:49:48 +0000 (14:49 -0700)]
src: accommodate uv_cwd including null on win32

10 years ago2014.03.11, Version 0.11.12 (Unstable)
Timothy J Fontaine [Tue, 11 Mar 2014 20:49:52 +0000 (13:49 -0700)]
2014.03.11, Version 0.11.12 (Unstable)

* uv: Upgrade to v0.11.22 (Timothy J Fontaine)

* buffer: allow toString to accept Infinity for end (Brian White)

* child_process: add spawnSync/execSync (Bert Belder, Timothy J Fontaine)

* cluster: handle bind errors on Windows (Alexis Campailla)

* contextify: handle infinite recursion errors (Fedor Indutny)

* crypto: allow custom generator for DiffieHellman (Brian White)

* crypto: allow setting add'l authenticated data (Brian White)

* crypto: fix CipherFinal return value check (Brian White)

* crypto: make NewSessionDoneCb public (Fedor Indutny)

* dgram: pass the bytes sent to the send callback (Timothy J Fontaine)

* dns: validate arguments in resolver (Kenan Sulayman)

* dns: verify argument is valid function in resolve (Kenan Sulayman)

* http: avoid duplicate keys in writeHead (David Björklund)

* net: add localPort to connect options (Timothy J Fontaine)

* node: do not print SyntaxError hints to stderr (Fedor Indutny)

* node: invoke `beforeExit` again if loop was active (Fedor Indutny)

* node: make AsyncListenerInst field more explicit (Trevor Norris)

* os: networkInterfaces include scopeid for ipv6 (Xidorn Quan)

* process: allow changing `exitCode` in `on('exit')` (Fedor Indutny)

* readline: fix `line` event, if input emit 'end' (Yazhong Liu)

* src: add tracing.v8.on('gc') statistics hooks (Ben Noordhuis)

* src: add v8.getHeapStatistics() function (Ben Noordhuis)

* src: emit 'beforeExit' event on process object (Ben Noordhuis)

* src: move AsyncListener from process to tracing (Trevor Norris)

* tls: fix crash in SNICallback (Fedor Indutny)

* tls: introduce asynchronous `newSession` (Fedor Indutny)

* util: show meaningful values for boxed primitives (Nathan Rajlich)

* vm: don't copy Proxy object from parent context (Ben Noordhuis)

* windows: make stdout/sterr pipes blocking (Alexis Campailla)

* zlib: add sync versions for convenience methods (Nikolai Vavilov)

10 years agomdb_v8: update to latest version
Bryan Cantrill [Tue, 11 Mar 2014 01:07:52 +0000 (18:07 -0700)]
mdb_v8: update to latest version

 * ::jsstack -v prints function defintion
 * ::jsprint works with objects with only numeric properties
 * update tests to use builtin mdb_v8
 * add more symbols to postmortem script - pending upstream
   inclusion

10 years agosrc: update from uv_read2_start removal
Timothy J Fontaine [Tue, 11 Mar 2014 00:51:47 +0000 (17:51 -0700)]
src: update from uv_read2_start removal

Previously if you wanted to be notified of pending handles for pipes
you needed to use uv_read2_start, however in v0.11.22 you can query for
pending handles independently.

10 years agosrc: adapt to API change in uv_cwd
Saúl Ibarra Corretgé [Sun, 2 Mar 2014 22:18:26 +0000 (23:18 +0100)]
src: adapt to API change in uv_cwd

10 years agouv: Upgrade to v0.11.22
Timothy J Fontaine [Tue, 11 Mar 2014 00:01:21 +0000 (17:01 -0700)]
uv: Upgrade to v0.11.22

10 years agoMerge remote-tracking branch 'upstream/v0.10'
Timothy J Fontaine [Mon, 10 Mar 2014 23:50:00 +0000 (16:50 -0700)]
Merge remote-tracking branch 'upstream/v0.10'

Conflicts:
src/node.cc
src/node.js
test/message/max_tick_depth_trace.out

10 years agodoc: remove an unused arg in process.stdin.
Shuhei Kagawa [Sun, 9 Mar 2014 11:16:39 +0000 (20:16 +0900)]
doc: remove an unused arg in process.stdin.

The argument of process.stdin's readable event handler is not used.

10 years agocrypto: do not lowercase cipher/hash names
Fedor Indutny [Mon, 10 Mar 2014 10:59:18 +0000 (14:59 +0400)]
crypto: do not lowercase cipher/hash names

`crypto.getCiphers()` and `crypto.getHashes()` should prefer lower-case
variants of names, but should not introduce them.

fix #7282

10 years agotest: timers-ordering should be more precise
Timothy J Fontaine [Mon, 10 Mar 2014 21:01:24 +0000 (14:01 -0700)]
test: timers-ordering should be more precise

Internally we use hrtime to schedule when a timer will fire, to avoid
the perils of clock drift or other external operation making time go
backward. The timers ordering test should use the same timing mechanism

10 years agobuffer: fix typo in `SlowBuffer`
Vladimir Kurchatkin [Sat, 8 Mar 2014 14:52:51 +0000 (18:52 +0400)]
buffer: fix typo in `SlowBuffer`

10 years agobuffer: allow toString to accept Infinity for end
Brian White [Sun, 9 Mar 2014 20:46:54 +0000 (16:46 -0400)]
buffer: allow toString to accept Infinity for end

10 years agodeps: fix v8 valgrind warning
Ben Noordhuis [Thu, 6 Mar 2014 21:59:56 +0000 (22:59 +0100)]
deps: fix v8 valgrind warning

Fix the following valgrind warning:

    Conditional jump or move depends on uninitialised value(s)
        at 0x7D64E7: v8::internal::GlobalHandles::IterateAllRootsWithClassIds(v8::internal::ObjectVisitor*) (global-handles.cc:613)
        by 0x94DCDC: v8::internal::NativeObjectsExplorer::FillRetainedObjects() (profile-generator.cc:2849)
        # etc.

This was fixed upstream in r12903 and released in 3.15.2 but that commit
was never back-ported to the 3.14 branch that node.js v0.10 uses.

The code itself works okay; this commit simply shuffles the clauses in
an `if` statement to check that the node is in use before checking its
class id (which is uninitialized if the node is not in use.)

10 years agochild_process: fix sending handle twice
Fedor Indutny [Wed, 26 Feb 2014 10:37:13 +0000 (14:37 +0400)]
child_process: fix sending handle twice

When sending a socket to a child process via IPC pipe,
`child_process.js` picks a raw UV handle from `_handle` property, sends
it, and assigns `null` to the property. Sending the same socket twice
was resulting in a runtime error, since we weren't handling the empty
`_handle` case.

In case of `null` `_handle` we should send just a plain text message
as passed it was passed to `.send()` and ignore the handle, letting
users handle such cases themselves instead of throwing the error at
runtime.

fix #5469

10 years agotest: test sending a handle twice
Benoit Vallée [Tue, 14 May 2013 03:10:07 +0000 (11:10 +0800)]
test: test sending a handle twice

Added test-cluster-send-handle-twice.js testing to send a handle
twice to the parent process.

10 years agosrc: add default visibility to NODE_MODULE
Ben Noordhuis [Tue, 4 Mar 2014 13:10:05 +0000 (14:10 +0100)]
src: add default visibility to NODE_MODULE

It's currently not really possible to compile native add-ons with
-fvisibility=hidden because that also hides the struct containing
the module definition.

The NODE_MODULE() and NODE_MODULE_DECL() macros are structured in
a way that makes it impossible to add a visibility attribute manually
so there is no escape hatch there.

That's why this commit adds an explicit visibility attribute to
the module definition.  It doesn't help with node.js releases that
are already out there but at least it improves the situation going
forward.

10 years agocrypto: allow setting add'l authenticated data
Brian White [Tue, 4 Mar 2014 05:05:23 +0000 (00:05 -0500)]
crypto: allow setting add'l authenticated data

10 years agocrypto: fix CipherFinal return value check
Brian White [Mon, 3 Mar 2014 05:25:11 +0000 (00:25 -0500)]
crypto: fix CipherFinal return value check

10 years agotimer: don't reschedule timer bucket in a domain
Greg Brail [Wed, 29 Jan 2014 01:36:22 +0000 (17:36 -0800)]
timer: don't reschedule timer bucket in a domain

If two timers run on the same tick, and the first timer uses a domain,
and then catches an exception and disposes of the domain, then the
second timer never runs. (And even if the first timer does not dispose
of the domain, the second timer could run under the wrong domain.)

This happens because timer.js uses "process.nextTick()" to schedule
continued processing of the timers for that tick. However, there was
an exception inside a domain, then "process.nextTick()" runs under
the domain of the first timer function, and will do nothing if
the domain has been disposed.

To avoid this, we temporarily save the value of "process.domain"
before calling nextTick so that it does not run inside any domain.

10 years agosrc: domain should not replace nextTick function
Timothy J Fontaine [Tue, 4 Mar 2014 00:27:58 +0000 (16:27 -0800)]
src: domain should not replace nextTick function

Previously if you cached process.nextTick and then require('domain')
subsequent nextTick() calls would not be caught because enqueued
functions were taking the wrong path. This keeps nextTick to a single
function reference and changes the implementation details after domain
has been required.

10 years agoMerge remote-tracking branch 'origin/v0.10'
Fedor Indutny [Sun, 2 Mar 2014 19:54:19 +0000 (23:54 +0400)]
Merge remote-tracking branch 'origin/v0.10'

Conflicts:
configure
lib/_stream_readable.js
lib/http.js
src/node_dtrace.cc

10 years agosmalloc: remove `env.h` include
Fedor Indutny [Fri, 28 Feb 2014 16:52:32 +0000 (20:52 +0400)]
smalloc: remove `env.h` include

Since `smalloc.h` is included in a `node_buffer.h`, including private
headers in it is strictly prohibited.

fix #7206

10 years agonode: invoke `beforeExit` again if loop was active
Fedor Indutny [Fri, 28 Feb 2014 13:25:28 +0000 (17:25 +0400)]
node: invoke `beforeExit` again if loop was active

When `setImmediate(cb)` is called in `beforeExit` event handler the
consequent `uv_run(..., UV_RUN_NOWAIT)` may return `0`, even if there
was some active handles at start.

Fixes simple/test-beforeexit-event.js.

10 years agostream_wrap: don't write twice on uv_try_write err
Fedor Indutny [Fri, 28 Feb 2014 08:14:05 +0000 (12:14 +0400)]
stream_wrap: don't write twice on uv_try_write err

fix #7155

10 years agodoc: document `beforeExit` and add more tests
Sam Roberts [Fri, 25 Oct 2013 21:05:39 +0000 (14:05 -0700)]
doc: document `beforeExit` and add more tests

10 years agosrc: emit 'beforeExit' event on process object
Ben Noordhuis [Mon, 7 Oct 2013 13:39:39 +0000 (15:39 +0200)]
src: emit 'beforeExit' event on process object

Unlike the 'exit' event, this event allows the user to schedule more
work and thereby postpone the exit.  That also means that the
'beforeExit' event may be emitted many times, see the attached test
case for an example.

Refs #6305.

10 years agosrc: use new loop API
Saúl Ibarra Corretgé [Fri, 28 Feb 2014 09:17:32 +0000 (10:17 +0100)]
src: use new loop API

uv_loop_new and uv_loop_delete are considered deprecated now.

10 years agosrc: spawn_sync should close handles upon exit
Saúl Ibarra Corretgé [Thu, 27 Feb 2014 02:14:14 +0000 (18:14 -0800)]
src: spawn_sync should close handles upon exit

When the exit callback is fired for the child process we should close
the handle associated with it.

10 years agosrc: update to latest libuv api
Timothy J Fontaine [Wed, 26 Feb 2014 23:24:03 +0000 (15:24 -0800)]
src: update to latest libuv api

libuv gyp builds now require you to define the library disposition
(static or shared).

Also, libuv now supports vectored IO for file system reads and writes,
update to those function signatures

10 years agouv: Upgrade to v0.11.21
Timothy J Fontaine [Thu, 27 Feb 2014 02:08:30 +0000 (18:08 -0800)]
uv: Upgrade to v0.11.21

10 years agohttp: remove the circular dependency
Nathan Rajlich [Tue, 25 Feb 2014 22:19:25 +0000 (14:19 -0800)]
http: remove the circular dependency

Between `ClientRequest` and `Agent`. The circular require was doing
weird things at load time, like making the `globalAgent` property
be `undefined` from within the context of the "_http_client"
module.

Removing the circular dependency completely fixes this.

This commit effectively removes the undocumented `Agent#request()`
and `Agent#get()` functions.

10 years agotest: update "http-*" tests to only use public API
Nathan Rajlich [Tue, 25 Feb 2014 22:18:43 +0000 (14:18 -0800)]
test: update "http-*" tests to only use public API

Don't invoke the `agent.requst()` or `agent.get()` functions
directly. Instead, use the public API and pass the agent
instance in as the `agent` option.

10 years agohttp, https: don't depend on `globalAgent`
Nathan Rajlich [Tue, 25 Feb 2014 22:15:02 +0000 (14:15 -0800)]
http, https: don't depend on `globalAgent`

For the `request()` and `get()` functions. I could never
really understand why these two functions go through agent
first... Especially since the user could be passing `agent: false`
or a different Agent instance completely, in which `globalAgent`
will be completely bypassed.

Moved the relevant logic from `Agent#request()` into the
`ClientRequest` constructor.

Incidentally, this commit fixes #7012 (which was the original
intent of this commit).

10 years agotest: add failing http `agent: null` test
Nathan Rajlich [Wed, 26 Feb 2014 21:05:56 +0000 (13:05 -0800)]
test: add failing http `agent: null` test

See #7012.

10 years agotest: add `agent: null` http client request test
Nathan Rajlich [Wed, 26 Feb 2014 19:39:53 +0000 (11:39 -0800)]
test: add `agent: null` http client request test

This is just the test portion from #7012 / #7189,
but targetted for the v0.10 branch.

10 years agohttp: invoke createConnection when no agent
Nathan Rajlich [Wed, 26 Feb 2014 02:17:35 +0000 (18:17 -0800)]
http: invoke createConnection when no agent

This makes it so that the user may pass in a
`createConnection()` option, and they don't have
to pass `agent: false` at the same time.

Also adding a test for the `createConnection` option,
since none was in place before.

See #7014.

10 years agotest: fix async-listener-run-error-once
Trevor Norris [Wed, 26 Feb 2014 18:33:21 +0000 (10:33 -0800)]
test: fix async-listener-run-error-once

Rely on defined order of operations by closing the server and
destorying the client socket, instead of when setImmediate fires

10 years agosrc: make stdout/sterr pipes blocking
Alexis Campailla [Wed, 26 Feb 2014 14:03:59 +0000 (15:03 +0100)]
src: make stdout/sterr pipes blocking

Expose `setBlocking` on Pipe's and if a pipe is being created for stdio
on windows then make the pipes blocking.

This fixes test-stream2-stderr-sync.js on Windows.

Fixes #3584

10 years agotest: remove invalid part of stream2-stderr-sync
Alexis Campailla [Thu, 16 Jan 2014 12:17:01 +0000 (04:17 -0800)]
test: remove invalid part of stream2-stderr-sync

One test case in test-stream2-stderr-sync.js was creating a TTY
object using an undocumented constructor and passing in fd 2.
However, this is running in a child process and fd 2 is actually
a pipe, not a TTY.

The constructor fails on Windows and causes the handle type to be
left uninitialized, which later causes an assert to fail.

On Unix, the constructor fails to retrieve the windows size but unlike
on Windows, it just leaves the size fields undefined and continues
with initializing the stream type, yielding a semi-usable object.

I could make the Windows version match Unix behavior, but it
seems to me that the test is relying on an implementation detail of
an undocumented API, and the Unix behavior is not necessarily more
correct than the Windows one. Thus it makes more sense to remove this
test.

10 years agotls: stop NodeBIO::Gets from reading off end of buffer
Maxwell Krohn [Tue, 25 Feb 2014 20:48:31 +0000 (15:48 -0500)]
tls: stop NodeBIO::Gets from reading off end of buffer

NodeBIO::Gets was reading off the end of a buffer if it
didn't find a "\n" before the EOF.  This behavior
was causing X509 certificates passed to `https.Agent`
via the "ca" option to be silently discarded. It also
was causing improper parsing of certs and keys
passed to https.Agent, but those problems were worked
around in cdde9a3.

Backed out workaround in `lib/crypto.js` from ccde9a3,
which now isn't needed.  But keep the test introduced
in that commit, which tests properly for this
bug.

This bug was first introduced in a58f93f

Gist containing test code, bisection log, and notes:
   https://gist.github.com/maxtaco/9211605

10 years agowindows: fix module registration
Alexis Campailla [Tue, 25 Feb 2014 17:57:43 +0000 (18:57 +0100)]
windows: fix module registration

The linker was optimizing the static variables that were supposed
to trigger module initialization.

I am making them non-static, and dllexport so that they don't get
optimized away.

Fixes #7116

10 years agonet: fix listening on FDs on Windows
Alexis Campailla [Mon, 24 Feb 2014 17:28:49 +0000 (09:28 -0800)]
net: fix listening on FDs on Windows

Fix a bug introduced by 3da36fe of a missed early return of a handle
that needed to be passed to listen.

Fixes test-net-listen-fd0.js on Windows

10 years agotest: internet/test-dns disable implicit ipv6
Timothy J Fontaine [Tue, 25 Feb 2014 21:24:16 +0000 (13:24 -0800)]
test: internet/test-dns disable implicit ipv6

This ends up being too difficult to test across different deployments

10 years agotest: pummel/net-connect-econnrefused backoff
Timothy J Fontaine [Tue, 25 Feb 2014 19:32:01 +0000 (11:32 -0800)]
test: pummel/net-connect-econnrefused backoff

We were trying too hard to connect, and getting timeouts instead of
the refusals, slow down how hard we try.

10 years agobenchmark: update to use new wrk
Timothy J Fontaine [Tue, 25 Feb 2014 19:05:54 +0000 (11:05 -0800)]
benchmark: update to use new wrk

10 years agowrk: compile on sunos
Timothy J Fontaine [Tue, 25 Feb 2014 04:59:39 +0000 (20:59 -0800)]
wrk: compile on sunos

10 years agowrk: build against our distributed ssl
Timothy J Fontaine [Tue, 25 Feb 2014 04:20:25 +0000 (20:20 -0800)]
wrk: build against our distributed ssl

10 years agotools: wrk update to 5b2fa06
Timothy J Fontaine [Tue, 25 Feb 2014 03:49:45 +0000 (19:49 -0800)]
tools: wrk update to 5b2fa06

10 years agotest: migrate pummel/keep-alive to wrk
Timothy J Fontaine [Tue, 25 Feb 2014 03:40:47 +0000 (19:40 -0800)]
test: migrate pummel/keep-alive to wrk

10 years agoassert: Ensure reflexivity of deepEqual
Mike Pennisi [Mon, 24 Feb 2014 19:16:40 +0000 (14:16 -0500)]
assert: Ensure reflexivity of deepEqual

Ensure that the behavior of `assert.deepEqual` does not depend on
argument ordering  when comparing an `arguments` object with a
non-`arguments` object.

10 years agotest: pummel/*ci-reneg* handle EPIPE
Timothy J Fontaine [Tue, 25 Feb 2014 02:38:41 +0000 (18:38 -0800)]
test: pummel/*ci-reneg* handle EPIPE

When calling out to the openssl client handle the child closing and
returning EPIPE on writes

10 years agotest: internet/test-dns handle ESERVFAIL
Timothy J Fontaine [Tue, 25 Feb 2014 01:53:57 +0000 (17:53 -0800)]
test: internet/test-dns handle ESERVFAIL

ESERVFAIL is also an acceptable error code when failing to resolve a
domain.

10 years agotest: move pummel/test-fs-largefile to disabled
Timothy J Fontaine [Tue, 25 Feb 2014 01:03:28 +0000 (17:03 -0800)]
test: move pummel/test-fs-largefile to disabled

This test is particularly pathological, and requires a ton of time to
run, we need to find a better way to manage it but in general this path
is fairly safe these days.

10 years agotest: pummel/test-net-throttle adhere to streams
Timothy J Fontaine [Tue, 25 Feb 2014 00:55:35 +0000 (16:55 -0800)]
test: pummel/test-net-throttle adhere to streams

bufferSize is now a getter that shows all that has not been
acknowledged by the os, as well as in the buffer state. The test is
only looking to verify the js verified state.

10 years agotest: pummel fs-watch-file-slow handle spurious
Timothy J Fontaine [Tue, 25 Feb 2014 00:54:04 +0000 (16:54 -0800)]
test: pummel fs-watch-file-slow handle spurious

watch file will now generate an empty event when the file doesn't exist
initially

10 years agotest: remove next-tick-loops-quick
Timothy J Fontaine [Tue, 25 Feb 2014 00:34:01 +0000 (16:34 -0800)]
test: remove next-tick-loops-quick

Scheduling of next ticks from within the next tick handler will result
in a tight execution loop where a timer cannot break into.

This test was invalid

10 years agosrc: node.cc use isolate->ThrowException
Alexis Campailla [Mon, 24 Feb 2014 18:55:27 +0000 (10:55 -0800)]
src: node.cc use isolate->ThrowException

Environment doesn't have ThrowException, we meant isolate here.

Introduced in commit
75adde07f9a2de7f38a67bec72bd377d450bdb52.

10 years agotest: backoff client connection rates
Timothy J Fontaine [Mon, 24 Feb 2014 18:20:30 +0000 (10:20 -0800)]
test: backoff client connection rates

We were being very aggressive in our connection creations, resulting
in the pipeline flood detection to drop us. Relax how fast we're
creating these connections so the gc can run all its tests.

10 years agostream: remove useless check
Brian White [Sun, 23 Feb 2014 19:00:28 +0000 (14:00 -0500)]
stream: remove useless check

10 years agodoc: update assert.markdown
Nicolas Talle [Sat, 22 Feb 2014 15:02:10 +0000 (16:02 +0100)]
doc: update assert.markdown

Update assert.throws() and assert.doesNotThrow() docs

10 years agonode_internals: add missing env-inl.h include
Fedor Indutny [Fri, 21 Feb 2014 23:35:29 +0000 (03:35 +0400)]
node_internals: add missing env-inl.h include

10 years agosrc: remove `node_isolate` from source
Fedor Indutny [Fri, 21 Feb 2014 13:02:42 +0000 (17:02 +0400)]
src: remove `node_isolate` from source

fix #6899

10 years agodebugger: don't set the `repl.prompt` string
Nathan Rajlich [Fri, 21 Feb 2014 06:13:41 +0000 (22:13 -0800)]
debugger: don't set the `repl.prompt` string

It wasn't doing anything, and actually due to
3ae0b17c76f693dd2e68a46f78c7dc7f595b33c6, it was causing
the readline `prompt()` function to be overwritten
which throws an error in the REPL shortly after.

10 years agoinstaller: copy `node.d` only with node_use_dtrace
Fedor Indutny [Thu, 20 Feb 2014 21:03:03 +0000 (01:03 +0400)]
installer: copy `node.d` only with node_use_dtrace

10 years agodtrace: workaround linker bug on FreeBSD
Fedor Indutny [Thu, 20 Feb 2014 20:56:17 +0000 (00:56 +0400)]
dtrace: workaround linker bug on FreeBSD

10 years agoconfigure: allow --with-dtrace on freebsd
Fedor Indutny [Thu, 20 Feb 2014 17:00:29 +0000 (21:00 +0400)]
configure: allow --with-dtrace on freebsd

10 years agogyp: specialize node.d for freebsd
Fedor Indutny [Thu, 20 Feb 2014 16:52:26 +0000 (20:52 +0400)]
gyp: specialize node.d for freebsd

`node.d` should use `psinfo.d` instead of `procfs.d` and have statically
defined architecture on FreeBSD.

10 years agohttp: avoid duplicate keys in writeHead
David Björklund [Mon, 10 Feb 2014 18:56:09 +0000 (19:56 +0100)]
http: avoid duplicate keys in writeHead

Use setHeader in writeHead to avoid sending duplicate headers

Fixes #5036

10 years agoMerge remote-tracking branch 'upstream/v0.10'
Timothy J Fontaine [Wed, 19 Feb 2014 17:12:32 +0000 (09:12 -0800)]
Merge remote-tracking branch 'upstream/v0.10'

Conflicts:
AUTHORS
ChangeLog
deps/uv/AUTHORS
deps/uv/ChangeLog
deps/uv/build.mk
deps/uv/src/unix/linux-core.c
deps/uv/src/unix/stream.c
deps/uv/src/unix/sunos.c
deps/uv/src/version.c
src/node_version.h

10 years agotools: update to support separate website repo
Timothy J Fontaine [Wed, 19 Feb 2014 02:57:45 +0000 (18:57 -0800)]
tools: update to support separate website repo

10 years agoNow working on v0.10.27
Timothy J Fontaine [Wed, 19 Feb 2014 00:43:12 +0000 (16:43 -0800)]
Now working on v0.10.27