Merge remote-tracking branch 'upstream/v0.10'

Conflicts:
	lib/tls.js
	src/node.js
This commit is contained in:
Timothy J Fontaine 2013-12-06 21:27:18 -08:00
commit fcca3585fe
13 changed files with 150 additions and 23 deletions

22
configure vendored
View File

@ -697,13 +697,17 @@ config = '\n'.join(map('='.join, config.iteritems())) + '\n'
write('config.mk',
'# Do not edit. Generated by the configure script.\n' + config)
if options.use_ninja:
gyp_args = ['-f', 'ninja-' + flavor]
elif options.use_xcode:
gyp_args = ['-f', 'xcode']
elif flavor == 'win':
gyp_args = ['-f', 'msvs', '-G', 'msvs_version=auto']
else:
gyp_args = ['-f', 'make-' + flavor]
gyp_args = [sys.executable, 'tools/gyp_node.py', '--no-parallel']
subprocess.call([sys.executable, 'tools/gyp_node.py'] + gyp_args)
if options.use_ninja:
gyp_args += ['-f', 'ninja-' + flavor]
elif options.use_xcode:
gyp_args += ['-f', 'xcode']
elif flavor == 'win':
gyp_args += ['-f', 'msvs', '-G', 'msvs_version=auto']
else:
gyp_args += ['-f', 'make-' + flavor]
gyp_args += args
subprocess.call(gyp_args)

View File

@ -559,6 +559,8 @@ leaner than `child_process.exec`. It has the same options.
* `env` {Object} Environment key-value pairs
* `encoding` {String} (Default: 'utf8')
* `execPath` {String} Executable used to create the child process
* `execArgv` {Array} List of string arguments passed to the executable
(Default: `process.execArgv`)
* `silent` {Boolean} If true, prevent stdout and stderr in the spawned node
process from being associated with the parent's (default is false)
* Return: ChildProcess object

View File

@ -121,6 +121,8 @@ values are `"rr"` and `"none"`.
## cluster.settings
* {Object}
* `execArgv` {Array} list of string arguments passed to the node executable.
(Default=`process.execArgv`)
* `exec` {String} file path to worker file. (Default=`process.argv[1]`)
* `args` {Array} string arguments passed to worker.
(Default=`process.argv.slice(2)`)

View File

@ -5,7 +5,7 @@
Use `require('dns')` to access this module. All methods in the dns module
use C-Ares except for `dns.lookup` which uses `getaddrinfo(3)` in a thread
pool. C-Ares is much faster than `getaddrinfo` but the system resolver is
more constant with how other programs operate. When a user does
more consistent with how other programs operate. When a user does
`net.connect(80, 'google.com')` or `http.get({ host: 'google.com' })` the
`dns.lookup` method is used. Users who need to do a large number of lookups
quickly should use the methods that go through C-Ares.

View File

@ -482,6 +482,9 @@ string describing the signal to send. Signal names are strings like
'SIGINT' or 'SIGHUP'. If omitted, the signal will be 'SIGTERM'.
See kill(2) for more information.
Will throw an error if target does not exist, and as a special case, a signal of
`0` can be used to test for the existence of a process.
Note that just because the name of this function is `process.kill`, it is
really just a signal sender, like the `kill` system call. The signal sent
may do something other than kill the target process.
@ -499,8 +502,8 @@ Example of sending a signal to yourself:
process.kill(process.pid, 'SIGHUP');
Note: SIGUSR1 is reserved by node.js. It can be used to kickstart the
debugger.
Note: When SIGUSR1 is received by Node.js it starts the debugger, see
[Signal Events](#process_signal_events).
## process.pid

View File

@ -615,6 +615,10 @@ reader.pipe(writer);
reader.unpipe(writer);
```
#### Event: 'error'
Emitted if there was an error when writing or piping data.
### Class: stream.Duplex
Duplex streams are streams that implement both the [Readable][] and

View File

@ -0,0 +1,17 @@
title: Ben Noordhuis's Departure
date: Tue Dec 3 14:13:57 PST 2013
slug: bnoordhuis-departure
As of this past weekend, Ben Noordhuis has decided to step away from
Node.js and libuv, and is no longer acting as a core committer.
Ben has done a tremendous amount of great work in the past. We're sad
to lose the benefit of his continued hard work and expertise, and
extremely grateful for what he has added to Node.js and libuv over the
years.
Many of you already have expressed your opinion regarding recent
drama, and I'd like to ask that you please respect our wishes to let
this issue rest, so that we can all focus on the road forward.
Thanks.

View File

@ -273,30 +273,29 @@ CryptoStream.prototype._read = function read(size) {
}
var bytesRead = 0,
start = this._buffer.offset;
start = this._buffer.offset,
last = start;
do {
assert(last === this._buffer.offset);
var read = this._buffer.use(this.pair.ssl, out, size - bytesRead);
if (read > 0) {
bytesRead += read;
}
last = this._buffer.offset;
// Handle and report errors
if (this.pair.ssl && this.pair.ssl.error) {
this.pair.error();
break;
}
// Get NPN and Server name when ready
this.pair.maybeInitFinished();
// `maybeInitFinished()` can emit the 'secure' event which
// in turn destroys the connection in case of authentication
// failure and sets `this.pair.ssl` to `null`.
} while (read > 0 &&
!this._buffer.isFull &&
bytesRead < size &&
this.pair.ssl !== null);
// Get NPN and Server name when ready
this.pair.maybeInitFinished();
// Create new buffer if previous was filled up
var pool = this._buffer.pool;
if (this._buffer.isFull) this._buffer.create();

View File

@ -259,7 +259,12 @@ Cipher.prototype._transform = function(chunk, encoding, callback) {
};
Cipher.prototype._flush = function(callback) {
try {
this.push(this._binding.final());
} catch (e) {
callback(e);
return;
}
callback();
};

View File

@ -831,7 +831,8 @@
err = process._kill(pid, 0);
} else {
sig = sig || 'SIGTERM';
if (startup.lazyConstants()[sig]) {
if (startup.lazyConstants()[sig] &&
sig.slice(0, 3) === 'SIG') {
err = process._kill(pid, startup.lazyConstants()[sig]);
} else {
throw new Error('Unknown signal: ' + sig);

View File

@ -60,3 +60,18 @@ crypto.createHash('md5').unpipe({});
crypto.createHash('md5').setEncoding('utf8');
crypto.createHash('md5').pause();
crypto.createHash('md5').resume();
// Decipher._flush() should emit an error event, not an exception.
var key = new Buffer('48fb56eb10ffeb13fc0ef551bbca3b1b', 'hex'),
badkey = new Buffer('12341234123412341234123412341234', 'hex'),
iv = new Buffer('6d358219d1f488f5f4eb12820a66d146', 'hex'),
cipher = crypto.createCipheriv('aes-128-cbc', key, iv),
decipher = crypto.createDecipheriv('aes-128-cbc', badkey, iv);
cipher.pipe(decipher)
.on('error', common.mustCall(function end(err) {
// TypeError: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt
assert(/:06065064:/.test(err));
}));
cipher.end('Papaya!'); // Should not cause an unhandled exception.

View File

@ -27,7 +27,13 @@ var spawn = require('child_process').spawn;
var cat = spawn('cat');
var called;
assert.ok(process.kill(cat.pid, 0));
cat.on('exit', function() {
assert.throws(function() {
process.kill(cat.pid, 0);
}, Error);
});
cat.stdout.on('data', function() {
called = true;

View File

@ -0,0 +1,69 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
var common = require('../common');
var assert = require('assert');
var tls = require('tls');
var fs = require('fs');
var PORT = common.PORT;
var dir = common.fixturesDir;
var options = { key: fs.readFileSync(dir + '/test_key.pem'),
cert: fs.readFileSync(dir + '/test_cert.pem'),
ca: [ fs.readFileSync(dir + '/test_ca.pem') ] };
var writes = [
'some server data',
'and a separate packet',
'and one more',
];
var receivedWrites = 0;
var server = tls.createServer(options, function(c) {
writes.forEach(function(str) {
c.write(str);
});
}).listen(PORT, function() {
var c = tls.connect(PORT, { rejectUnauthorized: false }, function() {
c.write('some client data');
c.on('readable', function() {
var data = c.read();
if (data === null)
return;
data = data.toString();
while (data.length !== 0) {
assert.strictEqual(data.indexOf(writes[receivedWrites]), 0);
data = data.slice(writes[receivedWrites].length);
if (++receivedWrites === writes.length) {
c.end();
server.close();
}
}
});
});
});
process.on('exit', function() {
assert.equal(receivedWrites, writes.length);
});