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

203 Commits

Author SHA1 Message Date
cjihrig
cb0b4a6bc0 test: add test for debugging one line files
This commit adds a regression test for debugging of
single line files.

Refs: https://github.com/nodejs/node/issues/4297
PR-URL: https://github.com/nodejs/node/pull/4298
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
2015-12-16 10:08:43 -05:00
Ben Noordhuis
213ede6cee repl: fix require('3rdparty') regression
Fix module loading of third-party modules in the REPL by inheriting
module.paths from the REPL's parent module.

Commit ee72ee7 ("module,repl: remove repl require() hack") introduced
a regression where require() of modules in node_modules directories
no longer worked in the REPL (and fortunately only in the REPL.)
It turns out we didn't have test coverage for that but we do now.

Fixes: https://github.com/nodejs/node/issues/4208
PR-URL: https://github.com/nodejs/node/pull/4215
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-12-09 23:30:02 +01:00
cjihrig
1ec09b0449 src: don't print garbage errors
If JS throws an object whose toString() method throws, then Node
attempts to print an empty message, but actually prints garbage.
This commit checks for this case, and prints a message instead.

Fixes: https://github.com/nodejs/node/issues/4079
PR-URL: https://github.com/nodejs/node/pull/4112
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
2015-12-05 11:15:49 -05:00
Tristian Flanagan
dfee4e3712 module: fix column offsets in errors
Because Node modules are wrapped, errors on the first line
of a file leak the wrapper to the user and report the wrong
column number. This commit adds a line break to the module
wrapper so that the first line is treated the same as all
other lines. To compensate for the additional line, a line
offset of -1 is also applied to errors.

Fixes: https://github.com/nodejs/node/issues/2860
PR-URL: https://github.com/nodejs/node/pull/2867
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-11-20 16:26:24 -05:00
Stefan Budeanu
20cd932ce0 test: add test for invalid DSA key size
Check that invalid DSA key sizes are rejected in FIPS mode.

PR-URL: https://github.com/nodejs/node/pull/3756
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-11-14 07:53:39 -08:00
Stefan Budeanu
76f40f77f8 test: stronger crypto in test fixtures
Several test fixtures use use weak crypto (e.g. RC4 or MD5).
Rgenerated the test fixtures to be compatible with FIPS mode.

PR-URL: https://github.com/nodejs/node/pull/3759
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
2015-11-13 10:22:42 -08:00
Evan Lucas
08166cb99a src: wrap source before doing syntax check
This is to ensure that it is evaluated the same way it would be if it
were to be run by node or required.

Before, the following would pass if run by node, but fail if run via
the syntax check flag:

    if (true) {
      return;
    }

Now, this will pass the syntax check

PR-URL: https://github.com/nodejs/node/pull/3587
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2015-10-29 13:08:32 -05:00
Wyatt Preul
8b4adb267b util: Remove p, has been deprecated for years
Update deprecation test to use another method.

Ref: https://github.com/nodejs/node/pull/2529
PR-URL: https://github.com/nodejs/node/pull/3432
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-10-19 20:52:56 +02:00
Коренберг Марк
d8db75730f tls: add options argument to createSecurePair
Helps in implementation of #6204, where some options passed to
`createSecurePair()` are ignored before this patch.

These options are very helpful if someone wants to pass
`options.servername` or `options.SNICallback` to securepair.

PR-URL: https://github.com/nodejs/node/pull/2441
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-10-17 11:53:45 -04:00
Dave Eddy
2e6ece44e1 node: add -c|--check CLI arg to syntax check script
PR-URL: https://github.com/nodejs/node/pull/2411
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2015-10-03 21:58:38 +10:00
Rich Trott
306936e98f test: change calls to deprecated util.print()
common.print() is just util.print() and as such prints a deprecation
warning. Per docs, update to console.log().

PR-URL: https://github.com/nodejs/node/pull/3083
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
2015-09-28 13:21:15 -07:00
Sakthipriyan Vairamani
61d48b45b5 test: use tmpDir instead of fixtures in readdir
This patch

 - makes the test use tmp directory instead of the fixtures directory,
 - simplifies the code
 - moves the test to `parallel`.

PR-URL: https://github.com/nodejs/node/pull/2587

Reviewed-By: Rich Trott <rtrott@gmail.com>
2015-09-20 16:18:07 +05:30
Karl Skomski
98608774a7 src: use standard conform snprintf on windows
The version used before returned -1 on truncation which does not conform
to the standard.

PR-URL: https://github.com/nodejs/node/pull/2404
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-09-06 21:38:08 +10:00
Karl Skomski
3bb923740d src: fix buffer overflow for long exception lines
Long exception lines resulted in a stack buffer overflow or assertion
because it was assumed snprintf not counts discarded chars
or the assertion itself was incorrect: `(off) >= sizeof(arrow)`

PR-URL: https://github.com/nodejs/node/pull/2404
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-09-06 21:38:07 +10:00
cjihrig
a69ab27ab4 node: rename from io.js to node
This commit replaces instances of io.js with Node.js, based on the
recent convergence. There are some remaining instances of io.js,
related to build and the installer.

Fixes: https://github.com/nodejs/node/issues/2361
PR-URL: https://github.com/nodejs/node/pull/2367
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
2015-08-23 17:59:43 -04:00
P.S.V.R
00bffa6c75 crypto: check for OpenSSL errors when signing
Errors might be injected into OpenSSL's error stack
without the return value of `PEM_read_bio_PrivateKey` being set to
`nullptr`. See the test of `test_bad_rsa_privkey.pem` for an
example.

PR-URL: https://github.com/nodejs/node/pull/2342
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-08-17 21:38:12 -07:00
Jeremiah Senkpiel
ceee8d2807 test: add tests for persistent repl history
PR-URL: https://github.com/nodejs/io.js/pull/2224
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-08-04 11:56:18 -07:00
Sakthipriyan Vairamani
9cd44bb2b6 util: prepend '(node) ' to deprecation messages
Changes included in this commit are

   1. Making the deprecation messages consistent. The messages will be in
      the following format

           x is deprecated. Use y instead.

      If there is no alternative for `x`, then the ` Use y instead.` part
      will not be there in the message.

   2. All the internal deprecation messages are printed with the prefix
      `(node) `, except when the `--trace-deprecation` flag is set.

Fixes: https://github.com/nodejs/io.js/issues/1883
PR-URL: https://github.com/nodejs/io.js/pull/1892
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-07-03 16:32:29 +02:00
Shigeki Ohtsu
3beb880716 crypto: add cert check to CNNIC Whitelist
When client connect to the server with certification issued by either
CNNIC Root CA or CNNIC EV Root CA, check hash of server
certification in the list of CNNICHashWhitelist.inc. If it's not,
CERT_REVOKED error returns.

See for details in
https://blog.mozilla.org/security/2015/04/02/distrusting-new-cnnic-certificates/

PR-URL: https://github.com/nodejs/io.js/pull/1895
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-06-16 23:26:29 +09:00
Rich Trott
7c79490bfb test: only refresh tmpDir for tests that need it
Expose `common.refreshTmpDir()` and only call it
for tests that use common.tmpDir or common.PIPE.

A positive side effect is the removal of a code
smell where child processes were detected by the
presence of `.send()`. Now each process can decide
for itself if it needs to refresh tmpDir.

PR-URL: https://github.com/nodejs/io.js/pull/1954
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2015-06-13 22:27:17 -07:00
Rich Trott
a6b8ee19b8 test: create temp dir in common.js
Move creation of temporary directories for tests
out of the Python harness and into common.js. This
allows all tests to be run reliably outside of the
Python wrapper.

PR-URL: https://github.com/nodejs/io.js/pull/1877
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-06-12 10:27:29 +10:00
Ali Ijaz Sheikh
5759722cfa src: fix module search path for preload modules
When the preload module is not a abs/relative path, we should use
the standard search mechanism of looking into the node_modules folders
outwards. The current working directory is deemed to be the 'requiring
module', i.e. parent. The search path starts from cwd outwards.

Fixes: https://github.com/nodejs/io.js/issues/1803
PR-URL: https://github.com/nodejs/io.js/pull/1812
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-05-30 10:36:09 -04: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
Fedor Indutny
550c2638c0 tls: use SSL_set_cert_cb for async SNI/OCSP
Do not enable ClientHello parser for async SNI/OCSP. Use new
OpenSSL-1.0.2's API `SSL_set_cert_cb` to pause the handshake process and
load the cert/OCSP response asynchronously. Hopefuly this will make
whole async SNI/OCSP process much faster and will eventually let us
remove the ClientHello parser itself (which is currently used only for
async session, see #1462 for the discussion of removing it).

NOTE: Ported our code to `SSL_CTX_add1_chain_cert` to use
`SSL_CTX_get0_chain_certs` in `CertCbDone`. Test provided for this
feature.

Fix: https://github.com/iojs/io.js/issues/1423
PR-URL: https://github.com/iojs/io.js/pull/1464
Reviewed-By: Shigeki Ohtsu <ohtsu@iij.ad.jp>
2015-05-01 16:56:55 +02:00
Shigeki Ohtsu
3a69b7689b benchmark: add rsa/aes-gcm performance test
PR-URL: https://github.com/iojs/io.js/pull/1325
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-04-04 12:37:26 +09:00
Ali Ijaz Sheikh
b6e22c4bd5 src: setup cluster workers before preloading
We need to process cluster workers before any preload modules is
executed. Otherwise, the child processes are not correctly disovered
as clustered workers inside the preloaded modules.

Fixes: https://github.com/iojs/io.js/issues/1269
PR-URL: https://github.com/iojs/io.js/pull/1314
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-04-04 00:53:45 +02:00
Vladimir Kurchatkin
2db758c562 iojs: introduce internal modules
Internal modules can be used to share private code between
public modules without risk to expose private APIs to the
user.

PR-URL: https://github.com/iojs/io.js/pull/848
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-03-25 22:12:18 +03:00
Ben Noordhuis
10a9c00563 test: fix timing issue in signal test
Change sequential/test-signal-unregister so it doesn't use fixed
timeouts for sending the signal and expecting the child to quit.

Fixes: https://github.com/iojs/io.js/issues/1223
PR-URL: https://github.com/iojs/io.js/pull/1227
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2015-03-23 00:55:34 +01:00
Ben Noordhuis
cf081a4712 vm: fix crash on fatal error in debug context
Ensure that the debug context has an Environment assigned in case
a fatal error is raised.

The fatal exception handler in node.cc is not equipped to deal with
contexts that don't have one and can't easily be taught that due to
a deficiency in the V8 API: there is no way for the embedder to tell
if the data index is in use.

Fixes: https://github.com/iojs/io.js/issues/1190
PR-URL: https://github.com/iojs/io.js/pull/1229
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-03-22 20:07:49 +01:00
Michaël Zasso
6fc5e95354 module: allow require('.')
Previously, the minimal argument to require the current directory was
require('./'). This commits allows to skip the trailing slash.

Fixes: https://github.com/iojs/io.js/issues/1178
PR-URL: https://github.com/iojs/io.js/pull/1185
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Christian Tellnes <christian@tellnes.no>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-03-20 18:17:25 +01:00
Ali Ijaz Sheikh
1514b82355 src: add -r/--require flags for preloading modules
This patch adds a command line option (-r/--require) that allows one
to provide modules on the command line that will be 'required' during
node startup. This can be useful for debugging, tracing, memory leak
analysis etc. to be preloaded without explicit changes to the user
script. The option can be repeated to preload multiple modules.

PR-URL: https://github.com/iojs/io.js/pull/881
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2015-03-19 21:42:16 +11:00
Chris Dickinson
056ed4b0c9 src: revert -r/--require flags
This reverts commit 7bde3f1a8f.

The added test (test/parallel/test-preload.js) fails on Windows.

PR-URL: https://github.com/iojs/io.js/pull/1150
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-03-13 15:16:00 -07:00
Ali Ijaz Sheikh
7bde3f1a8f src: add -r/--require flags for preloading modules
-r/--require can be used to preload modules on node startup. The option
takes a single module name. The option can be repeated as necessary to
preload multiple modules.

This patch allows 'vendors' (such a cloud host) to inject functionality
that gets executed at application startup without requiring an explicit
require from the user's application. This can be useful to load vendor
specific application monitoring APIs transparently.

PR-URL: https://github.com/iojs/io.js/pull/881
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
2015-03-13 13:54:34 -07:00
Bert Belder
abd3ecfbd1 win,test: fix test-stdin-from-file
The test-stdin-from-from-file test runs a subprocess that verifies stdin
can be piped from a file.

The subprocess additionally attempts to verify that the file descriptor
for stdin never gets closed. It used to do this by creating a TCP server
and asserting that the associated file descriptor is greater than two.
However this strategy doesn't work on windows, because servers don't
have an associated file descriptor. With this patch an ordinary file is
opened instead of creating a server.

PR: https://github.com/iojs/io.js/pull/1067
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Nikolai Vavilov <vvnicholas@gmail.com>
2015-03-05 15:30:52 +01:00
Brendan Ashworth
0df54303c1 test: common.js -> common
This commit changes many test styles to change all references
from require('./common.js'); to require('./common');.

The latter is much more common, with the former only being used in 50
tests. It is just a stylistic change, and it seems that `common.js` was
introduced by a rogue test and copied and pasted into the rest.

Semver: patch
PR-URL: https://github.com/iojs/io.js/pull/917
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-02-22 19:34:17 -08:00
isaacs
3e1b1dd4a9 Remove excessive copyright/license boilerplate
The copyright and license notice is already in the LICENSE file.  There
is no justifiable reason to also require that it be included in every
file, since the individual files are not individually distributed except
as part of the entire package.
2015-01-12 15:30:28 -08:00
Fedor Indutny
0e19476595 test: split test in parallel/sequential
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/iojs/io.js/pull/172
Fix: iojs/io.js#139
2014-12-17 20:45:02 +07:00
Evan Lucas
78a7dc2b8f module: fix regression in require ../
Fixes regression in require system that prevented loading relative
packages via main property in package.json where the file is not
index.{ext}. The regression was introduced in commit 36777d2.

PR-URL: https://github.com/iojs/io.js/pull/145
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-12-11 10:18:00 +01:00
Fedor Indutny
687dfc9875 crypto: separate altname extensions with ", "
In newly introduced `SafeX509ExtPrint` I forgot to insert separators
between extensions, which lead to the "DNS:...DNS:..." thing for npm.

Fix: iojs/io.js#105
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/iojs/io.js/pull/113.patch
2014-12-11 00:07:58 +07:00
Robert Kowalski
36777d2a5f module: test for directories, fix require with ..
Given my home-directory is `/Users/rocko` - and I have a file named
`npm.json` in it and also a repository with name `npm`, which is a
folder for the node-module.

When try to require the `/Users/rocko/npm/index.js` two direcotry
levels down in the npm folder (e.g. `/Users/rocko/npm/test/tap`)
with require("../../") node will load `/Users/rocko/npm/index.json`.

When I use require("../..") node will load `/Users/rocko/npm.json`
which is fixed by this commit.

PR-URL: https://github.com/iojs/io.js/pull/58
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2014-12-06 22:14:05 +01:00
Rod Vagg
28c4520bb7 test: fix test-cluster-eaccess to work on windows
properly create an EADDRINUSE condition rather than
simulating one with a plain file

PR-URL: https://github.com/node-forward/node/pull/59
Reviewed-By: Bert Belder <bertbelder@gmail.com>
2014-11-18 17:58:10 +01:00
Fedor Indutny
1bb0aeb8f2 crypto: escape DNS altname
Vulnerability credit goes to:

    Calvin Liang conradjliang@hotmail.com

Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: ...private
2014-11-08 02:24:07 +03:00
Fedor Indutny
25e8adefa3 test: fix debug-signal-cluster after da update
The cluster children are hitting breakpoint at `cluster.onread` and
hanging on a Semaphore wait now. This prevents them from disconnecting
gracefully. Considering that the test is checking different thing, the
cluster children needs to be force killed from the grand parent process.

Reviewed-By: Trevor Norris <trevnorris@gmail.com>
PR-URL: https://github.com/joyent/node/pull/8476
2014-10-08 15:36:16 +04:00
Adam Lippai
11d57a535c tls: fix encoding in certificate-related functions
Strings are treated as UTF8 instead of one-byte strings when
names are processed and when OpenSSL's ..._print functions are used.

This commit fixes simple/test-tls-peer-certificate-encoding test.

fix #8366
2014-09-15 17:42:20 +04:00
Shigeki Ohtsu
0dfedb7127 tls, crypto: add DHE support
In case of an invalid DH parameter file, it is sliently discarded. To
use auto DH parameter in a server and DHE key length check in a
client, we need to wait for the next release of OpenSSL-1.0.2.

Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-08-29 00:36:48 +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
Fedor Indutny
b3ef289ffb tls: support OCSP on client and server 2014-04-18 02:21:16 +04:00
Fedor Indutny
fc26fd6b38 node: do not ever close stdio
Even if stdio streams are opened as file streams, we should not ever try
to close them. This could be accomplished by passing `autoClose: false`
in options on their creation.
2014-01-29 03:27:23 +04:00
Fedor Indutny
cc4b6e6e58 crypto: clear error in GetPeerCertificate
fix #6945
2014-01-26 03:48:36 +04:00
Sam Roberts
cb1646f44e test: fix assumption of worker exit on disconnect
Master was disconnecting its workers as soon as they both started up.
Meanwhile, the workers were trying to listen. Its a race, sometimes the
disconnect would happen between when worker gets the response message,
and acks that message with a 'listening'. This worked OK after v0.11
introduced a behaviour where disconnect would always exit the worker,
but once that backwards-incompatible behaviour is removed, the worker
lives long enough to try and respond to the master, and child_process
errors at the attempt to send from a disconnected child.
2013-12-31 11:43:44 -08:00