0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
Commit Graph

10926 Commits

Author SHA1 Message Date
Calvin Metcalf
6561274d23 crypto: support passwords in publicEncrypt
Private keys may be used along with publicEncrypt since the private key
includes the public one.  This adds the ability to use encrypted private
keys which previously threw an error.  This commit also makes sure the
user exposed functions have names.

PR-URL: https://github.com/iojs/io.js/pull/626
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-02-02 23:21:49 +01:00
Sam Roberts
e9eb2ec1c4 process: fix regression in unlistening signals
When the last signal listener is removed, the signal wrap should be
closed, restoring the default signal handling behaviour. This is done in
a (patched) process.removeListener(). However, events.removeAllListeners
has an optimization to avoid calling removeListener() if there are no
listeners for the 'removeListener' event, introduced in 56668f54d1. That
caused the following code to fail to terminate:

    process.stdin.resume();
    function listener() {};
    process.on('SIGINT', listener);
    process.removeAllListeners('SIGINT');
    process.kill(process.pid, 'SIGINT')

while the following will terminate:

    process.stdin.resume();
    function listener() {};
    process.on('SIGINT', listener);
    process.removeListener('SIGINT', listener);
    process.kill(process.pid, 'SIGINT')

Replace the method patching with use of the 'newListener' and
'removeListener' events, which will fire no matter which methods are
used to add or remove listeners.

PR-URL: https://github.com/iojs/io.js/pull/687
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-02-02 21:59:57 +01:00
Sam Roberts
233e333b18 events: remove indeterminancy from event ordering
The order of the `newListener` and `removeListener` events with respect
to the actual adding and removing from the underlying listeners array
should be deterministic. There is no compelling reason for leaving it
indeterminate. Changing the ordering is likely to result in breaking
code that was unwittingly relying on the current behaviour, and the
indeterminancy makes it impossible to use these events to determine when
the first or last listener is added for an event.

PR-URL: https://github.com/iojs/io.js/pull/687
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-02-02 21:59:56 +01:00
Glen Keane
d75fecf6fd src: remove unused dtrace probes
Removed DTRACE_NET_SOCKET_READ and DTRACE_NET_SOCKET_WRITE
as they were never called from within the source code.

PR-URL: https://github.com/iojs/io.js/pull/694
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-02-02 21:55:56 +01:00
Yosuke Furukawa
8c0742f437 net: check close callback is function
PR-URL: https://github.com/iojs/io.js/pull/609
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2015-02-02 18:45:34 +01:00
Yosuke Furukawa
207e48c934 dgram: check close callback is function
PR-URL: https://github.com/iojs/io.js/pull/609
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2015-02-02 18:44:05 +01:00
cjihrig
6ac8bdc0ab lib: reduce util.is*() usage
Many of the util.is*() methods used to check data types
simply compare against a single value or the result of
typeof. This commit replaces calls to these methods with
equivalent checks. This commit does not touch calls to the
more complex methods (isRegExp(), isDate(), etc.).

Fixes: https://github.com/iojs/io.js/issues/607
PR-URL: https://github.com/iojs/io.js/pull/647
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-31 23:47:29 -05:00
Bert Belder
bce7a2608e deps: make node-gyp work again on windows
* Fetch from the correct url.
* Link compiled addons with iojs.lib instead of node.lib.
* Disable checksum checks for iojs.lib until our website supports
  them.

PR: https://github.com/iojs/io.js/pull/422
Reviewed-by: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-by: Rod Vagg <rod@vagg.org>
2015-01-31 18:57:35 +01:00
Ben Noordhuis
1bdd74d20a deps: make node-gyp fetch tarballs from iojs.org
Apply a small patch that makes node-gyp fetch the tarballs from
https://iojs.org/ instead of http://nodejs.org/

A patch better suited for inclusion upstream will be put together
shortly.

PR-URL: https://github.com/iojs/io.js/pull/343
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-01-31 18:57:35 +01:00
Forrest L Norvell
faf34ffbd3 deps: upgrade npm to 2.4.1
PR-URL: https://github.com/iojs/io.js/pull/663
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-31 18:57:30 +01:00
cjihrig
40e29dcbbf assert: use util.inspect() to create error messages
Currently, JSON.stringify() is used to create error messages
on failed assertions. This causes an error when stringifying
objects with circular references. This commit switches out
JSON.stringify() for util.inspect(), which can handle
circular references.

PR-URL: https://github.com/iojs/io.js/pull/668
Reviewed-By: Julien Gilli <julien.gilli@joyent.com>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2015-01-31 09:34:50 -05:00
Bert Belder
bc2c85ceef fs: improve error messages
* Include a description for the error message
* For rename, link, and symlink, include both the source and destination
  path in the error message.
* Expose the destination path as the `dest` property on the error object.
* Fix a bug where `ThrowUVException()` would incorrectly delegate to
  `Environment::TrowErrnoException()`.

API impact:
* Adds an extra overload for node::UVException() which takes 6
  arguments.

PR: https://github.com/iojs/io.js/pull/675
Fixes: https://github.com/iojs/io.js/issues/207
Closes: https://github.com/iojs/io.js/pull/293
Reviewed-by: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-31 11:54:56 +01:00
Ben Noordhuis
0767c2feb1 lib: fix max size check in Buffer constructor
A number -> uint32 type coercion bug made buffer sizes
larger than kMaxLength (0x3fffffff) wrap around.

Instead of rejecting the requested size with an exception,
the constructor created a buffer with the wrong size.

PR-URL: https://github.com/iojs/io.js/pull/657
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-01-31 10:13:50 +01:00
Sam Roberts
65b1e4f56f dgram: implicit binds should be exclusive
Server sockets should be shared by default, and client sockets should be
exclusive by default. For net/TCP, this is how it is, for dgram/UDP, its
a little less clear what a client socket is, but a socket that is
auto-bound during a dgram.send() is not usefully shared among cluster
workers, any more than an outgoing TCP connection would be usefully
shared.

Since implicit binds become exclusive, implicit/client dgram sockets can
now be used with cluster on Windows. Before, neither explicit nor
implicitly bound sockets could be used, causing dgram to be completely
unsupported with cluster on Windows. After this change, they become half
supported.

PR: https://github.com/iojs/io.js/pull/325
PR: https://github.com/joyent/node/pull/8643
Reviewed-by: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-by: Bert Belder <bertbelder@gmail.com>
2015-01-31 00:10:39 +01:00
Brendan Ashworth
083c421b5c benchmark: remove extra spacing in http options
This commit removes the benchmark spacing modification in
`client-request-body.js` and `end-vs-write-end.js` which adds two spaces
to the end of some variables to make sure the lines line up.

The reason behind this is that its totally pointless (the lines don't
actually line up with it) and it disallows you to parse the output with
a tool like awk, or at least makes it a lot harder.

PR-URL: https://github.com/iojs/io.js/pull/650
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-01-30 16:09:10 -05:00
Fedor Indutny
e17e6fb2fa util: use on-stack buffer for Utf8Value
Improves `crypto.createHash().update().digest()` performance by 10%.

PR-URL: https://github.com/iojs/io.js/pull/670
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-30 22:08:17 +03:00
Fedor Indutny
3d4e96f3ce crypto: use on-stack storage in HashUpdate
Boosts speed up to 10% on primitive `createHash().update().digest()`
benchmark.

PR-URL: https://github.com/iojs/io.js/pull/664
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-30 17:41:59 +03:00
Fedor Indutny
aca2011251 string_bytes: introduce InlineDecoder
PR-URL: https://github.com/iojs/io.js/pull/664
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-30 17:41:54 +03:00
Fedor Indutny
c6367e7f2a node: speed up ParseEncoding
Handle most popular cases in a trie-style, branching on a first
character.

Remove useless HandleScope which was only eating time without producing
any value.

PR-URL: https://github.com/iojs/io.js/pull/664
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-30 17:41:34 +03:00
Calvin Metcalf
7604e6decc docs: add note about default padding in crypto
Adds a note that the default padding for publicDecrypt/privateEncrypt
is RSA_PKCS1_PADDING instead of RSA_PKCS1_OAEP_PADDING as it is for
privateDecrypt/publicEncrypt.

PR-URL: https://github.com/iojs/io.js/pull/659
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
2015-01-29 18:42:36 -08:00
Qasim Zaidi
cf3e908b70 http: more descriptive setHeader errors
PR-URL: https://github.com/iojs/io.js/pull/480
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2015-01-29 16:58:36 -08:00
Ben Noordhuis
cbc1262bd9 deps: upgrade v8 to 4.1.0.14
PR-URL: https://github.com/iojs/io.js/pull/656
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2015-01-29 18:12:27 +01:00
Micleusanu Nicu
00f822f276 doc: add micnic as collaborator
PR-URL: https://github.com/iojs/io.js/pull/651
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
2015-01-29 08:35:54 +02:00
Fishrock123
514b1d964b doc: add more info to benchmark/README.md
Adds info on the `wrk` prerequisite for http benchmarks and how to
run benchmarks with options.

PR-URL: https://github.com/iojs/io.js/pull/629
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2015-01-28 16:56:26 -05:00
Saúl Ibarra Corretgé
097fde7129 deps: update libuv to 1.3.0
PR-URL: https://github.com/iojs/io.js/pull/644
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-28 22:47:38 +01:00
Roman Reiss
6ad236c9b6 build: configure formatting, add final message
This restores the pretty-printed options output for improved
readability and adds a final warning message to inform on possibly
scrolled-off warnings.

PR-URL: https://github.com/iojs/io.js/pull/638
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-28 18:03:54 +01:00
Ben Noordhuis
dd47a8c785 src: set default signal dispositions at start-up
Signal dispositions are inherited by child processes.  Restore ours to
sane defaults in case our parent process changed it, to prevent quirky
behavior when the parent does something silly like ignoring SIGSEGV.

PR-URL: https://github.com/iojs/io.js/pull/615
Reviewed-By: Sam Roberts <sam@strongloop.com>
2015-01-28 17:44:07 +01:00
Ben Noordhuis
63ae1d203a src: rework early debug signal handling
Instead of installing an early debug signal handler, simply block the
SIGUSR1 signal at start-up and unblock it when the debugger is ready.

Both approaches are functionally equivalent but blocking the signal
accomplishes it in fewer lines of code.

PR-URL: https://github.com/iojs/io.js/pull/615
Reviewed-By: Sam Roberts <sam@strongloop.com>
2015-01-28 17:44:04 +01:00
Ben Noordhuis
5756f92f46 src: do platform-specific initialization earlier
Execute the per-platform initialization logic as early as possible,
for two reasons:

1. It opens the way for an upcoming commit to simplify early SIGUSR1
   handling.

2. It should make life easier for embedders because io.js no longer
   mucks around with the file descriptor limit or signal disposition
   of the process.

PR-URL: https://github.com/iojs/io.js/pull/615
Reviewed-By: Sam Roberts <sam@strongloop.com>
2015-01-28 17:43:36 +01:00
Ben Noordhuis
24bd4e0555 test: add http upgrade header regression test
Add a regression test for https://github.com/iojs/io.js/issues/627.

Before the http_parser rollback to 2.3.0, the request callback was
called but an 'upgrade' event was not emitted, even though there is
an Upgrade header present in the request.

PR-URL: https://github.com/iojs/io.js/pull/628
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2015-01-28 16:57:12 +01:00
Ben Noordhuis
660509694c deps: roll back http_parser to 2.3.0
Commit 598efcbe ("deps: update http_parser to 2.4.1") introduced a
regression in HTTP Upgrade header handling.

Fixes: https://github.com/iojs/io.js/issues/627
PR-URL: https://github.com/iojs/io.js/pull/628
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2015-01-28 16:56:44 +01:00
Calvin Metcalf
90ddb46d52 crypto: remove use of this._readableState
Per #445 this removes a reference to this._readableState in hash._flush. It was
used to get the encoding on the readable side to pass to the writable side but
omitting it just causes the stream to handle the encoding issues.

PR-URL: https://github.com/iojs/io.js/pull/610
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Vladimir Kurchatkin <vladimir.kurchatkin@gmail.com>
2015-01-28 17:20:54 +03:00
Vladimir Kurchatkin
45d8d9f826 buffer: implement iterable interface
This makes possible to use `for..of` loop with
buffers. Also related `keys`, `values` and `entries`
methods are added for feature parity with `Uint8Array`.

PR-URL: https://github.com/iojs/io.js/pull/525
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-28 16:40:15 +03:00
cjihrig
3cbb5cdfdb console: allow Object.prototype fields as labels
Console.prototype.timeEnd() returns NaN if the timer label
corresponds to a property on Object.prototype. This commit
uses a Map to construct the _times object.

Fixes: https://github.com/joyent/node/issues/9069
PR-URL: https://github.com/iojs/io.js/pull/563
Reviewed-By: Vladimir Kurchatkin <vladimir.kurchatkin@gmail.com>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-01-27 18:28:09 -05:00
Fedor Indutny
87e62bd4c8 crypto: implement privateEncrypt/publicDecrypt
PR-URL: https://github.com/iojs/io.js/pull/625
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Fix iojs/io.js#477
2015-01-28 02:02:52 +03:00
Saúl Ibarra Corretgé
b50fea4d49 watchdog: fix timeout for early polling return
Switch from running the loop with UV_RUN_ONCE to UV_RUN_DEFAULT, because
it's possible that the poll returns earlier than expected and thus the
timer is not run on a single interation.

The loop is not stopped either from the timer callback or from the async
handle's.

PR-URL: https://github.com/iojs/io.js/pull/622
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-01-28 09:52:45 +11:00
Yosuke Furukawa
b5166cb7d2 benchmark: add bench-(url & events) make targets
PR-URL: https://github.com/iojs/io.js/pull/584
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-01-28 09:33:44 +11:00
Bert Belder
5843ae8dfb Revert "doc: clarify fs.symlink and fs.symlinkSync parameters"
The offending doc change clarified nothing, but put the arguments to
fs.symlink() and fs.symlinkSync() in the wrong order.

This reverts commit 8146f2e607.

BUG: https://github.com/joyent/node/issues/8920
PR: https://github.com/joyent/node/pull/8936
2015-01-27 19:18:23 +01:00
Mathias Küsel
668bde8ac0 win,msi: broadcast WM_SETTINGCHANGE after install
In theory the msi should broadcast a 'WM_SETTINGCHANGE' message to all
windows after modifying the PATH environment variable. This ensures that
the new PATH is visible to other processes without restarting windows
(although it's still necessary to close and reopen active console
windows).

Unfortunately, the broadcast doesn't always happen, for unknown reasons.
That's why this patch adds a custom action that unconditionally
broadcasts a WM_SETTINGCHANGE message.

Bug: https://github.com/iojs/io.js/issues/603
PR: https://github.com/iojs/io.js/pull/613
Reviewed-by: Bert Belder <bertbelder@gmail.com>
2015-01-27 16:18:26 +01:00
Johan Bergström
69ce0641dc build: remove artefacts on distclean
since .pkg-files already lives in out/ they're already gone. instead of
moving artefacts into out/ (which might mess with upload scripts),
delete their current location.

PR-URL: https://github.com/iojs/io.js/pull/323
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-01-27 17:08:35 +11:00
Rod Vagg
1953886126 test: fs.createReadStream().destroy() fd leak
PR-URL: https://github.com/iojs/io.js/pull/56
Reviewed-By: Rod Vagg <rod@vagg.org>

See PR for long discussion
2015-01-27 17:06:29 +11:00
Alex Kocharin
497fd72e21 fs: fix fd leak in ReadStream.destroy()
PR-URL: https://github.com/iojs/io.js/pull/56
Reviewed-By: Rod Vagg <rod@vagg.org>

See PR for long discussion
2015-01-27 17:06:13 +11:00
Michael Hart
8b09ae76f1 doc: add links for http_parser/libuv upgrades
PR-URL: https://github.com/iojs/io.js/pull/471
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-01-27 16:43:38 +11:00
Aleksey Smolenchuk
683e09603e src: remove excessive license boilerplate
PR-URL: https://github.com/iojs/io.js/pull/611
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-01-27 16:35:05 +11:00
Andres Suarez
5c7ab96b90 doc: fix net.Server.listen bind behavior
PR-URL: https://github.com/iojs/io.js/pull/503
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-01-27 16:31:15 +11:00
Johnny Ray Austin
84b05d48d9 doc: update writable streams default encoding
Setting the default encoding for a writable stream does
not return a boolean (true if successful or false if not)
as the docs indicate. Instead, if the operation is successful
nothing is returned and the method throws an error when
something goes wrong.

This stems from a contribution that was tweaked but the
docs were never updated accordingly.

PR-URL: https://github.com/iojs/io.js/pull/502
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-01-27 16:28:13 +11:00
ttrfwork
18552677d7 doc: fix minor grammar mistake in streams docs
PR-URL: https://github.com/iojs/io.js/pull/606
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-01-27 16:25:21 +11:00
Ben Noordhuis
4f68369643 build: disable v8 snapshots
Snapshots speed up start-up by a few milliseconds but are potentially
dangerous because of the fixed hash seed that is used for strings and
dictionaries, making collision denial-of-service attacks possible.

Release builds on iojs.org have snapshots disabled but source builds
did not, until now.

The risk for individual source builds is low; the binary gets a random
32 bits hash seed that should be hard to guess by an external attacker.

It's when binaries are distributed by, for example, a distro vendor
that the fixed hash seed becomes a vulnerability, because then it's
possible to target a large group of people at once.

People that really need the faster start-up time can use the new
--with-snapshot configure flag.

PR-URL: https://github.com/iojs/io.js/pull/585
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-01-27 00:54:02 +01:00
Johan Bergström
c0a9d1bc74 versions: add http-parser patchlevel
PR-URL: https://github.com/iojs/io.js/pull/614
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-01-27 00:30:57 +01:00
cjihrig
785481149d child_process: clone spawn options argument
spawnSync() modifies the options argument. This commit makes
a copy of options before any modifications occur.

Fixes: https://github.com/iojs/io.js/issues/576
PR-URL: https://github.com/iojs/io.js/pull/579
Reviewed-By: Bert Belder <bertbelder@gmail.com>
2015-01-26 11:59:30 -05:00