Commit Graph

2791 Commits (bbb2dccd1b650db656918f12311f04efa2495ee6)

Author SHA1 Message Date
cjihrig d287b8e58a cluster: support options in Worker constructor
This commit moves some common Worker code into the constructor
via support for an options argument.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-08-01 00:34:40 +04:00
Fedor Indutny 1a52d6abcc Revert "repl: fix overwrite for this._prompt"
This reverts commit 7166b55015.
2014-07-31 12:12:18 +04:00
Sam Roberts bae019f182 cluster: test events emit on cluster.worker
v0.10 and node docs specific that in a worker, the 'message' and 'error'
event emits on process, and on cluster.worker.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-07-31 12:02:39 +04:00
Julien Gilli 0381cf5698 tests: fix internet/test-dns.js
internet/test-dns.js assumes that ::1 always resolves to "localhost" on
all platforms. This is not what happens in reality. Some platforms
resolve it to "ip6-localhost" too. There doesn't seem to be any consensus
on what's the right thing to do. However, most sane platforms will use
either one of these two values.

Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2014-07-30 15:10:05 -07:00
Yazhong Liu 7166b55015 repl: fix overwrite for this._prompt
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-29 12:53:05 +04:00
Fedor Indutny f310c0f16b Merge remote-tracking branch 'origin/v0.10' into master
Conflicts:
	doc/api/buffer.markdown
	lib/_stream_readable.js
	lib/assert.js
	lib/buffer.js
	lib/child_process.js
	lib/http.js
	lib/string_decoder.js
	lib/zlib.js
	node.gyp
	test/simple/test-buffer.js
	test/simple/test-https-foafssl.js
	test/simple/test-stream2-compatibility.js
	test/simple/test-tls-server-verify.js
2014-07-29 12:51:27 +04:00
Fedor Indutny 38f6fcd822 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`.
2014-07-29 12:34:49 +04:00
Julien Gilli ef3c4ed3dd tests: fix process.kill pid test.
Prevent test-process-kill-pid.js tests suite from sending SIGHUP
to its process group, which was causing the test runner to terminate.

Fix jenkins' jobs for nodejs-master.

Signed-off-by: Timothy J Fontaine <tjfontaine@gmail.com>
2014-07-28 18:13:04 -07:00
cjihrig e1fb1b58f9 cluster: enable error/message events using .worker
Between 0.11.1 and 0.11.2, the message and error events stopped
being usable via the cluster.worker object. This commit makes
them usable again. Closes #7998.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-28 18:44:36 +04:00
Sam Roberts 832ec1cd50 process: throw TypeError if kill pid not a number
Currently, invalid usage such as:

    process.kill('SIGTERM')
    process.kill(null)
    process.kill(undefined);

all coerce the pid to 0, and signal the current process.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-28 18:30:26 +04:00
cjihrig 61ddad1314 querystring: do not add sep for empty array
Currently, stringification of an empty array outputs a single
separator character. This commit causes an empty array to output
the empty string.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-24 00:41:51 +04:00
Fedor Indutny 338ba2bc80 test: fix test-https-foafssl 2014-07-23 23:55:24 +04:00
Fedor Indutny 93390ffc20 test: fix test-tls-server-verify
fix #7963
2014-07-23 23:51:14 +04:00
Jackson Tian e1ce8ba639 net: add remoteFamily for socket
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-23 23:44:57 +04:00
Shigeki Ohtsu 2bb4867312 tls: fix to send TLS Alert before socket destroyed
When TLS Alert is occured in handshake, ClearOut only write it into
wbio and does not flush to socket. TLS Alert should be written to
socket with EncOut before socket is destroyed within its error
callback.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-23 23:43:58 +04:00
cjihrig ea89fdfec4 child_process: do not access stderr when stdio set to 'ignore'
Currently, checkExecSyncError() attempts to access the contents
of stderr. When stdio is set to 'ignore', this causes a crash.
This commit adds a check on the access of stderr. Closes #7966.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-23 23:39:28 +04:00
Fedor Indutny 2f0017aa53 deps: update http_parser to 2.3.0 2014-07-23 23:08:46 +04:00
Chris Dickinson a96d6603b3 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>
2014-07-15 12:38:23 +04:00
Ryan Graham 04d6fc2c3f cluster: include settings object in 'setup' event
Emits on every call to cluster.setupMaster(), even if no new settings
are given. This is because calling cluster.setupMaster() without
arguments (or with an empty options object) results in the settings
being restored to their defaults.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-15 00:12:43 +04:00
Ryan Graham b96e38ac3a cluster: allow multiple calls to setupMaster()
Only attributes of 'cluster.settings' will be modified after the first
call, leaving all other cluster initialization alone. Each call that
includes a 'settings' argument triggers a 'setup' event to be emitted.

Instead of each call resetting all values to their defaults, use the
current settings (if any) as the default. This retains setupMaster's
support how cluster.fork() uses setupMaster() to ensure
cluster.settings has been populated.

Update example in docs to use current node coding style and include
an example of progressive configuration.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-15 00:12:43 +04:00
Fedor Indutny b692493766 test: fix regress-GH-1726 2014-07-13 23:15:52 +04:00
cjihrig c4e5fde362 child_process: copy spawnSync() cwd option to proper buffer
The spawnSync() cwd option was being copied to the incorrect
location. This commit copies to the correct location.

Closes #7824

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-12 12:46:16 +03:00
Ryan Graham 9452ea2ef5 doc: re-org child_process into async/sync
Cleaner separation between the traditional non-blocking functions and
the new blocking variants.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-10 15:20:33 +03:00
Ryan Graham a7b14f7a89 test: Remove references to customFds
Option has been deprecated since v0.5.11

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-10 15:07:08 +03:00
Andrew Oppenlander e1fec22f97 streams: set default hwm properly for Duplex
Default highWaterMark is now set properly when using stream Duplex's
writableObjectMode and readableObjectMode options.

Added condition to the already existing split objectMode test to ensure
the highWaterMark is being set to the correct default value on both the
ReadableState and WritableState for readableObjectMode and
writableObjectMode.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-10 13:28:55 +03:00
Ed Umansky df205360f5 net: reset `errorEmitted` on reconnect
Fix for `error` events emitting only once when reconnecting
a single instance of net.Socket.

Fixes joyent/node#7888

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-03 15:06:33 +04:00
Andrius Bentkus a382c9a97c udp: make it possible to receive empty udp packets
A udp packet can have 0 content. In that case nread will be equal to 0,
but addr != NULL.

Add test case for empty data gram packets and fixed test that checked
for OOB when length == 0.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-07-02 20:59:27 -07:00
Fedor Indutny 11337db35f 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>
2014-07-03 00:46:17 +04:00
Fedor Indutny 20247064b6 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>
2014-07-03 00:45:00 +04:00
Fedor Indutny e345253562 tls: better error reporting at cert validation
fix #7417

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-03 00:41:39 +04:00
Eli Skeggs 1100f3de7a net: don't emit listening if handle is closed
Fixes #7834

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-07-02 12:35:06 -07:00
Yazhong Liu 613654e882 test: fix multiple_line problem in match
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-07-01 19:04:35 +04:00
Fedor Indutny 4128d4d2ba Revert "stream: start old-mode read in a next tick"
This reverts commit 2efe4ab761.
2014-06-30 13:06:35 +04:00
Jonathan Reem 7fa4a9697d stream: only end reading on null, not undefined
The [Stream documentation for .push](http://nodejs.org/api/stream.html#stream_readable_push_chunk_encoding)
explicitly states multiple times that null is a special cased value
that indicates the end of a stream. It is confusing and undocumented
that undefined *also* ends the stream, even though in object mode
there is a distinct and important difference.

The docs for Object-Mode also explicitly mention null as the *only*
special cased value, making no mention of undefined.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-30 12:45:54 +04:00
Fedor Indutny a97bdef06d zlib: do not crash on write after close
fix #7767

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-27 17:02:02 +04:00
Yazhong Liu 6b09f9cd41 node: fix #7841 by overlooking the spare sourceline
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-27 16:09:52 +04:00
cjihrig 2cae44f169 buffer: construct new buffer from buffer toJSON() output
Creating a new buffer from the toJSON() output of another
buffer does not currently work. This commit adds that
support. Closes #7849.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-27 13:36:44 +04:00
Saúl Ibarra Corretgé 35b9580cd8
dns: introduce lookupService function
Uses getnameinfo to resolve an address an port into a hostname and
service.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-27 04:02:19 +04:00
Fedor Indutny 56d767fd69
test: fix tls-client-default-ciphers
The test execution should not depend on the servers running locally.

fix #7832
2014-06-25 11:17:59 +04:00
Chris Dickinson 61baefce1e dns: send lookup c-ares errors to callback
Calling dns.lookup with arguments that generate an error from c-ares
previously sent those errors back to the callback. This commit restores
the ca9eb71 behavior.

Fixes #7731.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-24 17:08:57 -07:00
Fedor Indutny c047127410 contextify: throw timeout error properly
fix #7509
2014-06-12 18:30:41 -07:00
Xavi Magrinyà e00cafa311 Added support for options parameter in console.dir()
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-12 10:33:15 -07:00
Fedor Indutny eef0715db5 tls_wrap: fix interleaving in InvokeQueued
WriteItem callback may add new item to the `pending_write_items`. Ensure
that this item won't be called in the same `InvokeQueued` call, as it
may result in way-to-early `finish` event on js-side.

fix #7733

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-11 16:10:11 -07:00
Ryan Graham 90c9891084 test: regression test for cluser.setupMaster()
Tests for the behaviour in v0.10.x which allows process.argv changes
to be honoured by cluster.setupMaster().

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
2014-06-11 14:26:16 -07:00
Timothy J Fontaine 1a09da6ec2 Merge remote-tracking branch 'upstream/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	deps/v8/src/api.cc
	deps/v8/src/unicode-inl.h
	deps/v8/src/unicode.h
	lib/_stream_readable.js
	lib/http.js
	src/cares_wrap.cc
	src/node.cc
	src/node_crypto.cc
	src/node_dtrace.cc
	src/node_file.cc
	src/node_stat_watcher.cc
	src/node_version.h
	src/process_wrap.cc
	src/string_bytes.cc
	src/string_bytes.h
	src/udp_wrap.cc
	src/util.h
	test/simple/test-buffer.js
	test/simple/test-stream2-compatibility.js
2014-06-10 19:36:04 -04:00
Felix Geisendörfer 0da4c67165 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.
2014-06-06 15:07:29 -07:00
Felix Geisendörfer 22b839845c 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!
2014-06-06 15:07:29 -07:00
Fedor Indutny 2efe4ab761 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
2014-06-05 21:12:07 -07:00
Nick Muerdter 1df32af74a http: don't default OPTIONS to chunked encoding
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-05 14:36:46 -07:00
Fedor Indutny bd988a590a test: fix event-emitter-method-names 2014-06-05 07:46:55 -07:00