Skip to content

Commit be17aa4

Browse files
committed
Merge remote-tracking branch 'origin/v0.12' into v0.12
Conflicts: src/cares_wrap.cc src/env-inl.h src/env.h src/node.cc src/node.h src/node_crypto.cc
2 parents 8a00961 + f6e5740 commit be17aa4

12 files changed

+57
-29
lines changed

doc/api/crypto.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Example:
5858

5959
## crypto.createCredentials(details)
6060

61-
Stability: 0 - Deprecated. Use [tls.createSecureContext][] instead.
61+
Stability: 0 - Deprecated. Use [tls.createSecureContext][] instead.
6262

6363
Creates a credentials object, with the optional details being a
6464
dictionary with keys:

doc/api/modules.markdown

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ The module system is implemented in the `require("module")` module.
6161

6262
<!--type=misc-->
6363

64-
When there are circular `require()` calls, a module might not be
65-
done being executed when it is returned.
64+
When there are circular `require()` calls, a module might not have finished
65+
executing when it is returned.
6666

6767
Consider this situation:
6868

@@ -93,7 +93,7 @@ Consider this situation:
9393

9494
When `main.js` loads `a.js`, then `a.js` in turn loads `b.js`. At that
9595
point, `b.js` tries to load `a.js`. In order to prevent an infinite
96-
loop an **unfinished copy** of the `a.js` exports object is returned to the
96+
loop, an **unfinished copy** of the `a.js` exports object is returned to the
9797
`b.js` module. `b.js` then finishes loading, and its `exports` object is
9898
provided to the `a.js` module.
9999

@@ -248,7 +248,7 @@ a global but rather local to each module.
248248
* {Object}
249249

250250
The `module.exports` object is created by the Module system. Sometimes this is not
251-
acceptable; many want their module to be an instance of some class. To do this
251+
acceptable; many want their module to be an instance of some class. To do this,
252252
assign the desired export object to `module.exports`. Note that assigning the
253253
desired object to `exports` will simply rebind the local `exports` variable,
254254
which is probably not what you want to do.

doc/api/tls.markdown

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,6 @@ Construct a new TLSSocket object from existing TCP socket.
428428

429429
## tls.createSecureContext(details)
430430

431-
Stability: 0 - Deprecated. Use tls.createSecureContext instead.
432-
433431
Creates a credentials object, with the optional details being a
434432
dictionary with keys:
435433

lib/_stream_writable.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,12 @@ Writable.prototype.uncork = function() {
222222
};
223223

224224
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
225-
if (typeof encoding !== 'string')
226-
return false;
227225
// node::ParseEncoding() requires lower case.
228-
encoding = encoding.toLowerCase();
226+
if (typeof encoding === 'string')
227+
encoding = encoding.toLowerCase();
229228
if (!Buffer.isEncoding(encoding))
230-
return false;
229+
throw new TypeError('Unknown encoding: ' + encoding);
231230
this._writableState.defaultEncoding = encoding;
232-
return true;
233231
};
234232

235233
function decodeChunk(state, chunk, encoding) {

lib/crypto.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,11 @@ function DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding) {
376376
if (!(this instanceof DiffieHellman))
377377
return new DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding);
378378

379+
if (!util.isBuffer(sizeOrKey) &&
380+
typeof sizeOrKey !== 'number' &&
381+
typeof sizeOrKey !== 'string')
382+
throw new TypeError('First argument should be number, string or Buffer');
383+
379384
if (keyEncoding) {
380385
if (typeof keyEncoding !== 'string' ||
381386
(!Buffer.isEncoding(keyEncoding) && keyEncoding !== 'buffer')) {

lib/path.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ if (isWindows) {
163163
resolvedTail = normalizeArray(resolvedTail.split(/[\\\/]+/).filter(f),
164164
!resolvedAbsolute).join('\\');
165165

166+
// If device is a drive letter, we'll normalize to lower case.
167+
if (resolvedDevice && resolvedDevice.charAt(1) === ':')
168+
resolvedDevice = resolvedDevice[0].toLowerCase() +
169+
resolvedDevice.substr(1);
170+
166171
return (resolvedDevice + (resolvedAbsolute ? '\\' : '') + resolvedTail) ||
167172
'.';
168173
};

test/simple/test-child-process-spawn-typeerror.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
var spawn = require('child_process').spawn,
2323
assert = require('assert'),
2424
windows = (process.platform === 'win32'),
25-
cmd = (windows) ? 'dir' : 'ls',
26-
invalidcmd = (windows) ? 'ls' : 'dir',
25+
cmd = (windows) ? 'rundll32' : 'ls',
26+
invalidcmd = 'hopefully_you_dont_have_this_on_your_machine',
2727
invalidArgsMsg = /Incorrect value of args option/,
2828
invalidOptionsMsg = /options argument must be an object/,
2929
errors = 0;

test/simple/test-crypto.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,22 @@ assert.equal(secret1, secret2.toString('base64'));
719719
assert.equal(dh1.verifyError, 0);
720720
assert.equal(dh2.verifyError, 0);
721721

722+
assert.throws(function() {
723+
crypto.createDiffieHellman([0x1, 0x2]);
724+
});
725+
726+
assert.throws(function() {
727+
crypto.createDiffieHellman(function() { });
728+
});
729+
730+
assert.throws(function() {
731+
crypto.createDiffieHellman(/abc/);
732+
});
733+
734+
assert.throws(function() {
735+
crypto.createDiffieHellman({});
736+
});
737+
722738
// Create "another dh1" using generated keys from dh1,
723739
// and compute secret again
724740
var dh3 = crypto.createDiffieHellman(p1, 'buffer');

test/simple/test-module-nodemodulepaths.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
var common = require('../common');
2323
var assert = require('assert');
24+
var path = require('path');
2425

2526
var module = require('module');
2627

@@ -29,7 +30,7 @@ var isWindows = process.platform === 'win32';
2930
var file, delimiter, paths;
3031

3132
if (isWindows) {
32-
file = 'C:\\Users\\Rocko Artischocko\\node_stuff\\foo';
33+
file = path.normalize('C:\\Users\\Rocko Artischocko\\node_stuff\\foo');
3334
delimiter = '\\'
3435
} else {
3536
file = '/usr/test/lib/node_modules/npm/foo';
@@ -39,4 +40,4 @@ if (isWindows) {
3940
paths = module._nodeModulePaths(file);
4041

4142
assert.ok(paths.indexOf(file + delimiter + 'node_modules') !== -1);
42-
assert.ok(Array.isArray(paths));
43+
assert.ok(Array.isArray(paths));

test/simple/test-path.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ if (isWindows) {
321321
[['c:/ignore', 'd:\\a/b\\c/d', '\\e.exe'], 'd:\\e.exe'],
322322
[['c:/ignore', 'c:/some/file'], 'c:\\some\\file'],
323323
[['d:/ignore', 'd:some/dir//'], 'd:\\ignore\\some\\dir'],
324-
[['.'], process.cwd()],
324+
[['.'], path.normalize(process.cwd())],
325325
[['//server/share', '..', 'relative\\'], '\\\\server\\share\\relative'],
326326
[['c:/', '//'], 'c:\\'],
327327
[['c:/', '//dir'], 'c:\\dir'],

test/simple/test-stream-writable-change-default-encoding.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,24 @@ MyWritable.prototype._write = function (chunk, encoding, callback) {
4949
var m = new MyWritable(function(isBuffer, type, enc) {
5050
assert.equal(enc, 'ascii');
5151
}, { decodeStrings: false });
52-
var status = m.setDefaultEncoding('ascii');
53-
assert.equal(status, true);
52+
m.setDefaultEncoding('ascii');
5453
m.write('bar');
5554
m.end();
5655
}());
5756

58-
(function changeDefaultEncodingToInvalidValue() {
57+
assert.throws(function changeDefaultEncodingToInvalidValue() {
5958
var m = new MyWritable(function(isBuffer, type, enc) {
60-
assert.equal(enc, 'utf8');
6159
}, { decodeStrings: false });
62-
var status = m.setDefaultEncoding({});
63-
assert.equal(status, false);
60+
m.setDefaultEncoding({});
6461
m.write('bar');
6562
m.end();
66-
}());
63+
}, TypeError);
6764

6865
(function checkVairableCaseEncoding() {
6966
var m = new MyWritable(function(isBuffer, type, enc) {
7067
assert.equal(enc, 'ascii');
7168
}, { decodeStrings: false });
72-
var status = m.setDefaultEncoding('AsCii');
73-
assert.equal(status, true);
69+
m.setDefaultEncoding('AsCii');
7470
m.write('bar');
7571
m.end();
7672
}());

vcbuild.bat

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ if defined nobuild goto sign
108108
@rem Look for Visual Studio 2013
109109
if not defined VS120COMNTOOLS goto vc-set-2012
110110
if not exist "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2012
111-
call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat"
111+
if "%VCVARS_VER%" NEQ "120" (
112+
call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat"
113+
SET VCVARS_VER=120
114+
)
112115
if not defined VCINSTALLDIR goto msbuild-not-found
113116
set GYP_MSVS_VERSION=2013
114117
goto msbuild-found
@@ -117,15 +120,21 @@ goto msbuild-found
117120
@rem Look for Visual Studio 2012
118121
if not defined VS110COMNTOOLS goto vc-set-2010
119122
if not exist "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2010
120-
call "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat"
123+
if "%VCVARS_VER%" NEQ "110" (
124+
call "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat"
125+
SET VCVARS_VER=110
126+
)
121127
if not defined VCINSTALLDIR goto msbuild-not-found
122128
set GYP_MSVS_VERSION=2012
123129
goto msbuild-found
124130

125131
:vc-set-2010
126132
if not defined VS100COMNTOOLS goto msbuild-not-found
127133
if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto msbuild-not-found
128-
call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat"
134+
if "%VCVARS_VER%" NEQ "100" (
135+
call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat"
136+
SET VCVARS_VER=100
137+
)
129138
if not defined VCINSTALLDIR goto msbuild-not-found
130139
goto msbuild-found
131140

0 commit comments

Comments
 (0)