Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport fixes to v1.x #1560

Merged
merged 6 commits into from
May 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ test-all-valgrind: test-build
$(PYTHON) tools/test.py --mode=debug,release --valgrind

test-ci:
$(PYTHON) tools/test.py -p tap --logfile test.tap -J parallel sequential message
$(PYTHON) tools/test.py -p tap --logfile test.tap --mode=release message parallel sequential
$(MAKE) jslint
$(MAKE) cpplint

test-release: test-build
$(PYTHON) tools/test.py --mode=release
Expand Down
3 changes: 2 additions & 1 deletion lib/_tls_wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,8 @@ exports.connect = function(/* [port, host], options, cb */) {

var hostname = options.servername ||
options.host ||
options.socket && options.socket._host,
(options.socket && options.socket._host) ||
'localhost',
NPN = {},
context = tls.createSecureContext(options);
tls.convertNPNProtocols(options.NPNProtocols, NPN);
Expand Down
6 changes: 3 additions & 3 deletions lib/string_decoder.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

const isEncoding = Buffer.isEncoding;

function assertEncoding(encoding) {
if (encoding && !isEncoding(encoding)) {
// Do not cache `Buffer.isEncoding`, some modules monkey-patch it to support
// additional encodings
if (encoding && !Buffer.isEncoding(encoding)) {
throw new Error('Unknown encoding: ' + encoding);
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,9 @@ static void Open(const FunctionCallbackInfo<Value>& args) {
static void WriteBuffer(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);

CHECK(args[0]->IsInt32());
if (!args[0]->IsInt32())
return env->ThrowTypeError("First argument must be file descriptor");

CHECK(Buffer::HasInstance(args[1]));

int fd = args[0]->Int32Value();
Expand Down
2 changes: 1 addition & 1 deletion test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ exports.platformTimeout = function(ms) {
return ms;

if (process.config.variables.arm_version === '6')
return 6 * ms; // ARMv6
return 7 * ms; // ARMv6

return 2 * ms; // ARMv7 and up.
};
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-child-process-fork-net2.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ if (process.argv[2] === 'child') {
};

var min = 190;
var max = common.platformTimeout(1500);
var max = common.platformTimeout(2000);
process.on('exit', function() {
assert.equal(disconnected, count);
assert.equal(connected, count);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debug-signal-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function onNoMoreLines() {

setTimeout(function testTimedOut() {
assert(false, 'test timed out.');
}, common.platformTimeout(3000)).unref();
}, common.platformTimeout(4000)).unref();

process.on('exit', function onExit() {
// Kill processes in reverse order to avoid timing problems on Windows where
Expand Down
11 changes: 11 additions & 0 deletions test/parallel/test-fs-write-no-fd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const common = require('../common');
const fs = require('fs');
const assert = require('assert');

assert.throws(function() {
fs.write(null, new Buffer(1), 0, 1);
}, /TypeError/);

assert.throws(function() {
fs.write(null, '1', 0, 1);
}, /TypeError/);
34 changes: 34 additions & 0 deletions test/parallel/test-tls-connect-no-host.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
var common = require('../common');

if (!common.hasCrypto) {
console.log('1..0 # Skipped: missing crypto');
process.exit();
}
var tls = require('tls');

var assert = require('assert');
var fs = require('fs');
var path = require('path');

var cert = fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'));
var key = fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem'));

// https://github.com/iojs/io.js/issues/1489
// tls.connect(options) with no options.host should accept a cert with
// CN:'localhost'
tls.createServer({
key: key,
cert: cert
}).listen(common.PORT);

var socket = tls.connect({
port: common.PORT,
ca: cert,
// No host set here. 'localhost' is the default,
// but tls.checkServerIdentity() breaks before the fix with:
// Error: Hostname/IP doesn't match certificate's altnames:
// "Host: undefined. is not cert's CN: localhost"
}, function() {
assert(socket.authorized);
process.exit();
});
2 changes: 1 addition & 1 deletion test/sequential/test-next-tick-error-spin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if (process.argv[2] !== 'child') {
});
var timer = setTimeout(function() {
throw new Error('child is hung');
}, 3000);
}, common.platformTimeout(3000));
child.on('exit', function(code) {
console.error('ok');
assert(!code);
Expand Down
1 change: 1 addition & 0 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ if /i "%1"=="noetw" set noetw=1&goto arg-ok
if /i "%1"=="noperfctr" set noperfctr=1&goto arg-ok
if /i "%1"=="licensertf" set licensertf=1&goto arg-ok
if /i "%1"=="test" set test_args=%test_args% sequential parallel message -J&set jslint=1&goto arg-ok
if /i "%1"=="test-ci" set test_args=%test_args% -p tap --logfile test.tap message sequential parallel&set jslint=1&goto arg-ok
if /i "%1"=="test-simple" set test_args=%test_args% sequential parallel -J&goto arg-ok
if /i "%1"=="test-message" set test_args=%test_args% message&goto arg-ok
if /i "%1"=="test-gc" set test_args=%test_args% gc&set buildnodeweak=1&goto arg-ok
Expand Down