0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

11540 Commits

Author SHA1 Message Date
Evan Lucas
a77c330c32 child_process: expose ChildProcess constructor
Creates two new internal modules (child_process and socket_list) for
better readability.

Exposes the ChildProcess constructor from the child_process module so
one can now `require(‘child_process’).ChildProcess`

Fixes: https://github.com/nodejs/io.js/issues/1751
PR-URL: https://github.com/nodejs/io.js/pull/1760
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2015-05-28 09:38:29 -05:00
Evan Lucas
fbd2b59716 tools: add objectLiteralShorthandProperties to .eslintrc
Required to make linting pass for using object literal
shorthand properties.

PR-URL: https://github.com/nodejs/io.js/pull/1760
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2015-05-28 09:35:43 -05:00
Rich Trott
ff794498e7 doc: fs.*File() also accept encoding strings
Fixes: https://github.com/nodejs/io.js/issues/1797
PR-URL: https://github.com/nodejs/io.js/pull/1806
Reviewed-By: fishrock123@rocketmail.com
2015-05-27 15:53:14 -04:00
Ben Noordhuis
1bbf8d0720 lib: speed up require(), phase 2
Replace calls to fs.readFileSync() with an internal variant that does
not create Error objects on failure and is a bit speedier in general.

A secondary benefit is that it improves start-up times in the debugger
because it no longer emits thousands of exception debug events.

On a medium-sized application[0], this commit and its predecessor reduce
start-up times from about 1.5s to 0.5s and reduce the number of start-up
exceptions from ~6100 to 32, half of them internal to the application.

[0] https://github.com/strongloop/loopback-sample-app

PR-URL: https://github.com/nodejs/io.js/pull/1801
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-05-27 21:21:24 +02:00
Ben Noordhuis
b14fd1a720 lib: speed up require(), phase 1
Replace calls to fs.statSync() with an internal variant that does not
create Error or Stat objects that put strain on the garbage collector.

A secondary benefit is that it improves start-up times in the debugger
because it no longer emits thousands of exception debug events.

PR-URL: https://github.com/nodejs/io.js/pull/1801
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-05-27 21:21:01 +02:00
Steve Sharp
98649fd31a doc: add documentation for AtExit hook
Fixes: https://github.com/nodejs/io.js/issues/999
PR-URL: https://github.com/nodejs/io.js/pull/1014
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-26 18:15:06 +02:00
Ben Noordhuis
6dfca71af0 test: don't lint autogenerated test/addons/doc-*/
The JS source files in test/addons/doc-*/ are scraped from the reference
documentation in doc/api and need not conform to the style guide.

PR-URL: https://github.com/nodejs/io.js/pull/1793
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-05-26 17:17:43 +02:00
Ben Noordhuis
c2b8b30836 test: remove stray copyright notices
Commit 3e1b1dd ("Remove excessive copyright/license boilerplate") left
in a few lines of boilerplate here and there.  This commit removes them.

PR-URL: https://github.com/nodejs/io.js/pull/1793
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-05-26 17:17:40 +02:00
Ben Noordhuis
280fb01daf test: fix deprecation warning in addons test
The non-isolate version of node::FatalException() is deprecated, switch
to the version that takes an isolate as its first argument.

PR-URL: https://github.com/nodejs/io.js/pull/1793
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-05-26 17:17:38 +02:00
Ben Noordhuis
93a44d5228 src: fix deferred events not working with -e
Defer evaluation of the script for a tick.  This is a workaround for
events not firing when evaluating scripts on the command line with -e.

Fixes: https://github.com/nodejs/io.js/issues/1600
PR-URL: https://github.com/nodejs/io.js/pull/1793
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-05-26 17:16:48 +02:00
Rich Trott
eb1856dfd1 doc: clarify stability of fs.watch and relatives
Fixes: https://github.com/nodejs/io.js/issues/1754
PR-URL: https://github.com/nodejs/io.js/pull/1775
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-05-26 11:26:02 -04:00
Brian White
5abd4ac079 lib: simplify nextTick() usage
This commit removes unnecessary nextTick() closures and adds some
shared nextTick() callbacks for better re-use.

PR-URL: https://github.com/nodejs/io.js/pull/1612
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
2015-05-25 10:14:18 -04:00
Josh Gummersall
a74c2c9458 doc: state url decoding behavior
Explicitly states the fact that no decoding is performed on the url
path or pathname or the query string by default in the URL module.

Fixes: https://github.com/nodejs/io.js/issues/1538
PR-URL: https://github.com/nodejs/io.js/pull/1731
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-05-25 13:50:53 +02:00
Brian White
1eec5f091a http: simplify code and remove unused properties
PR-URL: https://github.com/nodejs/io.js/pull/1572
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-05-25 01:07:22 -04:00
Rod Vagg
ba76a9d872 doc: remove bad semver-major entry from CHANGELOG
PR-URL: https://github.com/nodejs/io.js/pull/1782
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-05-24 16:52:33 +10:00
Rod Vagg
a6a3f8c78d doc: fix changelog s/2.0.3/2.1.0 2015-05-24 13:56:20 +10:00
Rod Vagg
3e8c228666 Working on v2.1.1 2015-05-24 12:10:22 +10:00
Rod Vagg
4d8f4d5cb3 2015-05-24 io.js v2.1.0 Release
PR-URL: https://github.com/nodejs/io.js/pull/1777

Notable Changes:

* crypto: Diffie-Hellman key exchange (DHE) parameters ('dhparams') must now be
  1024 bits or longer or an error will be thrown. A warning will also be printed
  to the console if you supply less than 2048 bits. See https://weakdh.org/ for
  further context on this security concern. (Shigeki Ohtsu) #1739.
* node: A new --trace-sync-io command line flag will print a warning and a stack
  trace whenever a synchronous API is used. This can be used to track down
  synchronous calls that may be slowing down an application.
  (Trevor Norris) #1707.
* node: To allow for chaining of methods, the setTimeout(), setKeepAlive(),
  setNoDelay(), ref() and unref() methods used in 'net', 'dgram', 'http',
  'https' and 'tls' now return the current instance instead of undefined
  (Roman Reiss & Evan Lucas) #1699 #1768 #1779.
* npm: Upgraded to v2.10.1, release notes can be found in
  https://github.com/npm/npm/releases/tag/v2.10.1 and
  https://github.com/npm/npm/releases/tag/v2.10.0.
* util: A significant speed-up (in the order of 35%) for the common-case of a
  single string argument to util.format(), used by console.log()
  (Сковорода Никита Андреевич) #1749.
2015-05-24 12:08:57 +10:00
Bert Belder
d144e96fbf win,node-gyp: enable delay-load hook by default
The delay-load hook allows node.exe/iojs.exe to be renamed. See efadffe
for more background.

This commit is a combined squash of the following previous patches:
ba93c583bc,
3bda6cbfa4,
0d6d3dda95.

PR-URL: https://github.com/nodejs/io.js/pull/1763
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-05-23 19:49:18 -04:00
cjihrig
9e7099fa4e deps: make node-gyp work with io.js
Every npm version bump requires a few patches to be floated on
node-gyp for io.js compatibility. These patches are found in
03d199276e,
5de334c230, and
da730c76e9. This commit squashes
them into a single commit.

PR-URL: https://github.com/iojs/io.js/pull/990
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-23 19:49:07 -04:00
Rebecca Turner
c54d057598 deps: upgrade to npm 2.10.1
PR-URL: https://github.com/nodejs/io.js/pull/1763
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-05-23 19:48:00 -04:00
Rod Vagg
367ffd167d doc: update AUTHORS list
Update AUTHORS list using tools/update-authors.sh

PR-URL: https://github.com/nodejs/io.js/pull/1776
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-24 08:14:40 +10:00
Roman Reiss
cb381fe3e0 net: return this from setNoDelay and setKeepAlive
Modifies the Socket.setNoDelay and Socket.setKeepAlive methods to return
the socket instance instead of undefined, to allow for chaining.

PR-URL: https://github.com/nodejs/io.js/pull/1779
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-05-23 18:10:32 +02:00
Roman Reiss
39dde3222e net,dgram: return this from ref and unref methods
Modifies the following methods to return the instance instead
of undefined, to allow for chaining these methods:

- net.Server.ref
- net.Server.unref
- net.Socket.ref
- net.Socket.unref
- dgram.Socket.ref
- dgram.Socket.unref

PR-URL: https://github.com/nodejs/io.js/pull/1768
Reviewed-By: Evan Lucas <evanlucas@me.com>
2015-05-23 06:57:00 +02:00
Brendan Ashworth
9da168b71f buffer: optimize Buffer.byteLength
Buffer.byteLength is important for speed because it is called whenever a
new Buffer is created from a string.

This commit optimizes Buffer.byteLength execution by:
- moving base64 length calculation into JS-land, which is now much
  faster
- remove redundant code and streamline the UTF8 length calculation

It also adds a benchmark and better tests.

PR-URL: https://github.com/nodejs/io.js/pull/1713
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-22 15:31:03 -07:00
Malte-Thorben Bruns
2a71f02988 tls: emit errors happening before handshake finish
This fixes a race condition introduced in 80342f6.
`socket.destroy(err)` only emits the passed error when
`socket._writableState.errorEmitted === false`, `ssl.onerror`
sets `errorEmitted = true` just before calling
`socket.destroy()`.

See: https://github.com/nodejs/io.js/issues/1119
See: https://github.com/nodejs/io.js/issues/1711
PR-URL: https://github.com/nodejs/io.js/pull/1769
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-05-22 21:30:22 +02:00
Rich Trott
2bb2f06b3e doc: fix typo in CONTRIBUTING.md
PR-URL: https://github.com/nodejs/io.js/pull/1755
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-05-22 11:05:51 -04:00
Maurice Butler
515afc6367 doc: path is ignored in url.format
Made it obvious that path is ignored in url.format

PR-URL: https://github.com/nodejs/io.js/pull/1753
2015-05-22 14:58:32 +02:00
Fedor Indutny
80342f649d tls: use .destroy(err) instead of destroy+emit
Emit errors using `.destroy(err)` instead of `.destroy()` and
`.emit('error', err)`. Otherwise `close` event is emitted with the
`error` argument set to `false`, even if the connection was torn down
because of the error.

See: https://github.com/nodejs/io.js/issues/1119
PR-URL: https://github.com/nodejs/io.js/pull/1711
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2015-05-22 13:27:04 +02:00
Johan Bergström
2b1c01c2cc build: refactor pkg-config for shared libraries
Improve detection and usage of pkg-config. This simplifies the setup
of all our shared libraries.

If pkg-config is installed on the host and `--shared` flags are passed
by the user, we try to get defaults from pkg-config instead of using the
default provided by configure.

PR-URL: https://github.com/nodejs/io.js/pull/1603
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-21 07:55:57 +10:00
Сковорода Никита Андреевич
214d02040e util: speed up common case of formatting string
PR-URL: https://github.com/nodejs/io.js/pull/1749
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-05-20 23:28:52 +02:00
Shigeki Ohtsu
9b35be5810 tls: make server not use DHE in less than 1024bits
DHE key lengths less than 1024bits is already weaken as pointed out in
https://weakdh.org/ . 1024bits will not be safe in near future. We
will extend this up to 2048bits somedays later.

PR-URL: https://github.com/nodejs/io.js/pull/1739
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-05-21 00:02:44 +09:00
Felipe Batista
f0a8bc3f84 doc: fix spelling in CHANGELOG
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-05-20 14:25:37 +02:00
Rich Trott
86dd244d9b doc: add notes to child_process.fork() and .exec()
Adds notes about the difference to their POSIX counterparts.

PR-URL: https://github.com/nodejs/io.js/pull/1718
Fixes: https://github.com/nodejs/io.js/issues/224
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-05-20 14:21:06 +02:00
Michaël Zasso
5773438913 test: fix jslint error
PR-URL: https://github.com/nodejs/io.js/pull/1743
Fixes: https://github.com/nodejs/io.js/issues/1742
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-05-20 14:13:37 +02:00
Santiago Gimeno
867631986f test: fix test-sync-io-option
Wait for all the data to be available in stderr before checking its
contents. In FreeBSD this was failing because stderr data was being
emitted in multiple chunks. 4 WARNINGS are printed instead of 2 for
each sync call inside readFileSync. require('fs') does not print any
trace.

PR-URL: https://github.com/nodejs/io.js/pull/1734
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-05-19 22:51:10 -07:00
Roman Reiss
f29762f4dd test: enable linting for tests
Enable linting for the test directory. A number of changes was made so
all tests conform the current rules used by lib and src directories. The
only exception for tests is that unreachable (dead) code is allowed.

test-fs-non-number-arguments-throw had to be excluded from the changes
because of a weird issue on Windows CI.

PR-URL: https://github.com/nodejs/io.js/pull/1721
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-19 21:21:27 +02:00
Evan Lucas
85d9983009 net: persist net.Socket options before connect
Remembers net.Socket options called before connect and retroactively
applies them after the handle has been created.

This change makes the following function calls more user-friendly:

- setKeepAlive()
- setNoDelay()
- ref()
- unref()

Related: https://github.com/joyent/node/issues/7077 and
https://github.com/joyent/node/issues/8572

Fixes: https://github.com/joyent/node/issues/7077
Fixes: https://github.com/joyent/node/issues/8572
PR-URL: https://github.com/nodejs/io.js/pull/1518
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-05-19 13:21:44 -05:00
Trevor Norris
3c44100558 core: set PROVIDER type as Persistent class id
Pass along the PROVIDER type, that is already passed to AsyncWrap, along
to BaseObject to set the handle_'s class id. This will allow all
Persistents to be transversed and uniquely identified by what type they
are using APIs such as v8::PersistentHandleVisitor.

PR-URL: https://github.com/nodejs/io.js/pull/1730
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-19 09:36:36 -06:00
Sharat M R
0d6d3dda95 win,node-gyp: make delay-load hook C89 compliant
This fixes building compiled addons with Visual Studio 2010.

PR-URL: https://github.com/TooTallNate/node-gyp/pull/616
Reviewed-By: Bert Belder <bertbelder@gmail.com>
2015-05-18 19:50:39 -07:00
Trevor Norris
c1de6d249e core: implement runtime flag to trace sync io
Use the --trace-sync-io flag to print a stack trace whenever a sync
method is used after the first tick, excluding during the process exit
event. (e.g. fs.readFileSync()) It does not track if the warning has
occurred at a specific location in the past and so will print the
warning every time.

Reason for not printing during the first tick of the appication is so
all necessary resources can be required. Also by excluding synchronous
calls during exit is necessary in case any data needs to be logged out
by the application before it shuts down.

Fixes: https://github.com/nodejs/io.js/issues/1674
PR-URL: https://github.com/nodejs/io.js/pull/1707
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Petka Antonov <petka_antonov@hotmail.com>
2015-05-18 10:05:32 -06:00
Frederic Hemberger
066274794c doc: update links from iojs/io.js to nodejs/io.js
Replaced all links in doc and comments to point to the new org.

PR-URL: https://github.com/nodejs/io.js/pull/1715
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-05-18 08:13:09 +02:00
smikes
7d90c90aaf doc: recommend against use of NODE_PATH
PR-URL: https://github.com/nodejs/io.js/pull/1708
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-05-17 20:25:07 +02:00
Yazhong Liu
5f33521be5 repl: remove unnecessary check for globals
There is no need to check for globals and also check if it is
an array.

PR-URL: https://github.com/nodejs/io.js/pull/1722
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-05-17 14:03:37 -04:00
Josh Gummersall
fbaef40e63 doc: fix connectListener description in net docs
`connectListener` is registered as a listener to the 'connect' event
once. Update the documentation to reflect that behavior.

Fixes: https://github.com/nodejs/io.js/issues/901
PR-URL: https://github.com/nodejs/io.js/pull/1717
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-17 13:59:28 +02:00
Yazhong Liu
6edc900b95 repl: support non-array .scope, document it
REPL evaluate `.scope` when it needs to get a list of the variable names
available in the current scope. Do not throw if the output of such
evaluation is not array, just ignore it.

PR-URL: https://github.com/nodejs/io.js/pull/1682
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-05-17 12:22:26 +02:00
Shigeki Ohtsu
7c52e1c1f4 tls_wrap: fix error cb when fatal TLS Alert recvd
SSL_read() returns 0 when fatal TLS Alert is received.
Fix to invoke ssl error callback in this case.

PR-URL: https://github.com/nodejs/io.js/pull/1661
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-05-16 12:34:01 +02:00
Shigeki Ohtsu
e008e8faba tls: fix tls handshake check in ssl error
In ssl.onerror event, `this` refers `ssl` so that
`this._secureEstablished` is always undefined. Fix it to refer
TLSSocket.

PR-URL: https://github.com/nodejs/io.js/pull/1661
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-05-16 12:33:46 +02:00
Evan Lucas
d4726cde57 http,net,tls: return this from setTimeout methods
Modifies the setTimeout methods for the following prototypes:

- http.ClientRequest
- http.IncomingMessage
- http.OutgoingMessage
- http.Server
- https.Server
- net.Socket
- tls.TLSSocket

Previously, the above functions returned undefined. They now return
`this`. This is useful for chaining function calls.

PR-URL: https://github.com/nodejs/io.js/pull/1699
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-05-16 07:17:41 +02:00
Jeremiah Senkpiel
c7fb91dc13 doc: fix v2.0.2 entry in changelog.md 2015-05-15 19:28:16 -04:00